using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Text;
using System.IO;
using System.Net;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class ProfileApproval_PhotoGalleryApproval : System.Web.UI.Page
{
// variables decleration
ApprovalUserDetailsBAL objUserDetailBAL = null;
string strUserType = string.Empty;
public string strHeadVal = string.Empty;
public string strImagePath = string.Empty;
string strUserId = string.Empty;
string strBack = string.Empty;
DataTable dtImageGallery;
private int intPageCount = 0;
protected void Page_Load(object sender, EventArgs e)
{
if (ScriptManager.GetCurrent(Page).IsInAsyncPostBack)
{
lblMsg.Text = "";
}
if (!IsPostBack)
{
lblMsg.Text = "";
BindUserPhotoGallery(strUserId);
GetPageNumber();
}
}
///
/// Row command fired on Clicking User Name
///
///
///
protected void dlUserGallery_ItemCommand(object source, DataListCommandEventArgs e)
{
string strImageId = string.Empty;
string strMasterId = string.Empty;
string strPostDate = string.Empty;
string strCaption = string.Empty;
HiddenField HdnCaptionVal = null;
DateTime dtPosted = new DateTime();
Hashtable htblHederData = new Hashtable();
objUserDetailBAL = new ApprovalUserDetailsBAL();
lblMsg.Text = "";
//performs operation on Approve button click
if (e.CommandName == AdminConstantKeys.ProfileApproveDetail)
{
strImageId = e.CommandArgument.ToString();
HdnCaptionVal = (HiddenField)e.Item.FindControl(AdminConstantKeys.ProfilehdCaptionVal);
htblHederData.Add(AdminConstantKeys.AbuseUserIdParam, strUserId);
htblHederData.Add(AdminConstantKeys.ProfileUserTypeParam, strUserType);
strCaption = HdnCaptionVal.Value.ToString();
htblHederData.Add(AdminConstantKeys.ProfileCaptionParamNew, strCaption);
if (CommonFunction.CheckHeaderStatus(AdminConstantKeys.ProfileHeaderArtistImageApproval))
{
lblMsg.Text = objUserDetailBAL.UpdateUserPhotoGalleryImageStatus
(strImageId, AdminConstantKeys.StatusApproved,
Convert.ToInt32(Session[AdminConstantKeys.UserID]), AdminConstantKeys.ProfileHeaderArtistImageApproval, htblHederData);
}
else
{
lblMsg.Text = CommonFunction.GetErrorMessage("ERR4721");
}
GetPageNumber();
if (dlUserGallery.Items.Count == 1)
{
if (CurrentPage > 0) CurrentPage -= 1;
}
BindUserPhotoGallery(strUserId);
}
//performs operation on Decline button click
if (e.CommandName == AdminConstantKeys.ProfileDeclineDetail)
{
strImageId = e.CommandArgument.ToString();
HdnCaptionVal = (HiddenField)e.Item.FindControl(AdminConstantKeys.ProfilehdCaptionVal);
htblHederData.Add(AdminConstantKeys.AbuseUserIdParam, strUserId);
htblHederData.Add(AdminConstantKeys.ProfileUserTypeParam, strUserType);
strCaption = HdnCaptionVal.Value.ToString();
htblHederData.Add(AdminConstantKeys.ProfileCaptionParamNew, strCaption);
if (CommonFunction.CheckHeaderStatus(AdminConstantKeys.ProfileHeaderArtistImageDecline))
{
lblMsg.Text = objUserDetailBAL.UpdateUserPhotoGalleryImageStatus(strImageId,
AdminConstantKeys.StatusDeclined,
Convert.ToInt32(Session[AdminConstantKeys.UserID]), AdminConstantKeys.ProfileHeaderArtistImageDecline, htblHederData);
}
else
{
lblMsg.Text = CommonFunction.GetErrorMessage("ERR4722");
}
GetPageNumber();
// checks the count
if (dlUserGallery.Items.Count == 1)
{
if (CurrentPage > 0) CurrentPage -= 1;
}
BindUserPhotoGallery(strUserId);
}
}
///
/// Item data Bound functionality for check the image exist or not
///
///
///
protected void dlUserGallery_ItemDataBound(object sender, DataListItemEventArgs e)
{
bool blnImageExist = true;
HttpWebRequest myHttpWebRequest;
HttpWebResponse myHttpWebResponse;
// checks if the ListItemType is Item or Alternating Item
if (e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem)
{
Image imgPhoto = (Image)e.Item.FindControl
(AdminConstantKeys.ProfilelblPhotograph);
string strPath = imgPhoto.ImageUrl;
}
}
///
/// functionality on the Decline Button
///
///
///
protected void btnDeclineAll_Click(object sender, EventArgs e)
{
HiddenField HdnImageVal = null;
HiddenField HdnCaptionVal = null;
string strImage = string.Empty;
string strMsg = string.Empty;
StringBuilder strCaption = new StringBuilder();
//StringBuilder strImage = new StringBuilder();
Hashtable htblHederData = new Hashtable();
objUserDetailBAL = new ApprovalUserDetailsBAL();
htblHederData.Add(AdminConstantKeys.AbuseUserIdParam, strUserId);
htblHederData.Add(AdminConstantKeys.ProfileUserTypeParam, strUserType);
//traversing all items
foreach (DataListItem dlPhoto in dlUserGallery.Items)
{
HdnImageVal = (HiddenField)dlPhoto.FindControl
(AdminConstantKeys.ProfilehdImageVal);
HdnCaptionVal = (HiddenField)dlPhoto.FindControl
(AdminConstantKeys.ProfilehdCaptionVal);
strImage += HdnImageVal.Value + ",";
// strImage.Append(strImage.Value + ",");
strCaption.Append(HdnCaptionVal.Value + ",");
}
htblHederData.Add(AdminConstantKeys.ProfileCaptionParamNew, strCaption);
if (CommonFunction.CheckHeaderStatus(AdminConstantKeys.ProfileHeaderImageDeclineAll))
{
lblMsg.Text = objUserDetailBAL.UpdateAllPhotoGalleryImageStatus
(strImage, AdminConstantKeys.StatusDeclined,
Convert.ToInt32(Session[AdminConstantKeys.UserID]), AdminConstantKeys.ProfileHeaderImageDeclineAll, htblHederData);
}
else
{
lblMsg.Text = CommonFunction.GetErrorMessage("ERR4718");
}
if (CurrentPage > 0) CurrentPage -= 1;
BindUserPhotoGallery(strUserId);
}
///
/// functionality on the Approve Button
///
///
///
protected void btnApproveAll_Click(object sender, EventArgs e)
{
HiddenField HdnImageVal = null;
HiddenField HdnCaptionVal = null;
string strImage = string.Empty;
//string strCaption = string.Empty;
string strMsg = string.Empty;
StringBuilder strCaption = new StringBuilder();
//StringBuilder strImage = new StringBuilder();
Hashtable htblHederData = new Hashtable();
objUserDetailBAL = new ApprovalUserDetailsBAL();
htblHederData.Add(AdminConstantKeys.AbuseUserIdParam, strUserId);
htblHederData.Add(AdminConstantKeys.ProfileUserTypeParam, strUserType);
foreach (DataListItem dlPhoto in dlUserGallery.Items)
{
HdnImageVal = (HiddenField)dlPhoto.FindControl(AdminConstantKeys.ProfilehdImageVal);
HdnCaptionVal = (HiddenField)dlPhoto.FindControl(AdminConstantKeys.ProfilehdCaptionVal);
strImage += HdnImageVal.Value + ",";
strCaption.Append(HdnCaptionVal.Value + ",");
}
htblHederData.Add(AdminConstantKeys.ProfileCaptionParamNew, strCaption);
if (CommonFunction.CheckHeaderStatus(AdminConstantKeys.ProfileHeaderImageApprovalAll))
{
lblMsg.Text = objUserDetailBAL.UpdateAllPhotoGalleryImageStatus
(strImage, AdminConstantKeys.StatusApproved,
Convert.ToInt32(Session[AdminConstantKeys.UserID]), AdminConstantKeys.ProfileHeaderImageApprovalAll, htblHederData);
}
else
{
lblMsg.Text = CommonFunction.GetErrorMessage("ERR4716");
}
if (CurrentPage > 0) CurrentPage -= 1;
BindUserPhotoGallery(strUserId);
}
///
/// Assing the CurrentPage value to View State
///
public int CurrentPage
{
get
{
int intCurrentPage = 0;
// checks the viewstate is null or not
if ((ViewState[AdminConstantKeys.ProfileCurrentPageViewState] != null)
&& (Convert.ToString(ViewState[AdminConstantKeys.ProfileCurrentPageViewState]) != string.Empty))
intCurrentPage = Convert.ToInt32(
ViewState[AdminConstantKeys.ProfileCurrentPageViewState]);
return intCurrentPage;
}
set
{
ViewState.Add(AdminConstantKeys.ProfileCurrentPageViewState, value);
}
}
///
/// functionality on the Approve Button
///
///
///
protected void btnBack_Click(object sender, EventArgs e)
{
Response.Redirect("../ProfileApproval/UserPhotoGalleryListing.aspx?Type=A");
}
///
/// Binds the data dispalying all the photos of User
///
/// string type
//private void GetData(int Flag) BindUserPhotoGallery(strUserId)
protected void BindUserPhotoGallery(string strUserId)
{
DataTable dtbUser;
dtbUser = new DataTable();
objUserDetailBAL = new ApprovalUserDetailsBAL();
dtbUser = objUserDetailBAL.GetUserPhotoList(strUserId);
dtImageGallery = dtbUser;
PagedDataSource ObjPDS = new PagedDataSource();
ObjPDS.DataSource = dtImageGallery.DefaultView;
ObjPDS.AllowPaging = true;
ObjPDS.PageSize = Convert.ToInt32(ConfigurationManager.AppSettings
[AdminConstantKeys.ProfileDatalistPageSize].ToString());
ObjPDS.CurrentPageIndex = CurrentPage;
// checks if the datable if row count greater than zero
if (dtImageGallery.Rows.Count > 0)
{
dlUserGallery.DataSource = ObjPDS;
dlUserGallery.DataBind();
lblNorec.Visible = false;
}
else
{
dlUserGallery.DataSource = ObjPDS;
dlUserGallery.DataBind();
lblNorec.Visible = true;
buttonRow.Visible = false;
tab2.Visible = false;
}
intPageCount = ObjPDS.PageCount;
ViewState[AdminConstantKeys.ProfileViewStPageCount] = intPageCount;
if (intPageCount > 1)
{
int[] intPageNumbers = new int[intPageCount];
for (int intIndex = 0; intIndex < intPageCount; intIndex++) intPageNumbers[intIndex] = intIndex + 1;
lblPage.Text = AdminConstantKeys.ProfilePage +
Convert.ToString(CurrentPage + 1) + AdminConstantKeys.ProfileOf
+ Convert.ToString(intPageCount);
tab2.Visible = true;
// checks if current page is zero
if (CurrentPage == 0)
{
btnBottomNext.ImageUrl = AdminConstantKeys.PagerNextImage;
btnBottomNext.Enabled = true;
btnBottomNext.CssClass = AdminConstantKeys.Blank;
btnBottomNext.Style.Add("cursor", "pointer");
btnBottomPrev.ImageUrl = AdminConstantKeys.PagerFirstImage;
btnBottomPrev.Enabled = false;
btnBottomPrev.CssClass = AdminConstantKeys.Blank;
btnBottomPrev.Style.Add("cursor", "default");
}
else
{
btnBottomNext.ImageUrl = AdminConstantKeys.PagerLastImage;
btnBottomNext.Enabled = true;
btnBottomNext.CssClass = AdminConstantKeys.Blank;
btnBottomNext.Style.Add("cursor", "pointer");
btnBottomPrev.ImageUrl = AdminConstantKeys.PagerPrevImage;
btnBottomPrev.Enabled = true;
btnBottomPrev.CssClass = AdminConstantKeys.Blank;
btnBottomPrev.Style.Add("cursor", "pointer");
}
}
else
{
lblPage.Text = AdminConstantKeys.ProfilePage +
Convert.ToString(CurrentPage + 1) + AdminConstantKeys.ProfileOf
+ Convert.ToString(intPageCount);
btnBottomNext.ImageUrl = AdminConstantKeys.PagerLastImage;
btnBottomNext.Enabled = false;
btnBottomNext.CssClass = AdminConstantKeys.Blank;
btnBottomNext.Style.Add("cursor", "default");
btnBottomPrev.ImageUrl = AdminConstantKeys.PagerFirstImage;
btnBottomPrev.Enabled = false;
btnBottomPrev.CssClass = AdminConstantKeys.Blank;
btnBottomPrev.Style.Add("cursor", "default");
}
}
///
/// Performing functionality to get the PageNumber
///
///
///
private void GetPageNumber()
{
int intPageCount1 = Convert.ToInt32(
ViewState[AdminConstantKeys.ProfileViewStPageCount]);
int[] intPageNumbers = new int[intPageCount1];
// initialize the page number
for (int intIndex = 0; intIndex < intPageCount; intIndex++)
{
intPageNumbers[intIndex] = intIndex + 1;
}
}
///
/// Performing functionality on Next button click
///
///
///
protected void ImageNext_Click(object sender, ImageClickEventArgs e)
{
lblMsg.Text = "";
// checks the current page value
if (CurrentPage < Convert.ToInt32(
ViewState[AdminConstantKeys.ProfileViewStPageCount]) - 1)
CurrentPage += 1;
BindUserPhotoGallery(strUserId);
if (intPageCount == CurrentPage + 1)
{
btnBottomNext.ImageUrl = AdminConstantKeys.PagerLastImage;
btnBottomNext.Enabled = false;
btnBottomNext.CssClass = AdminConstantKeys.Blank;
btnBottomNext.Style.Add("cursor", "default");
btnBottomPrev.ImageUrl = AdminConstantKeys.PagerPrevImage;
btnBottomPrev.Enabled = true;
btnBottomPrev.CssClass = AdminConstantKeys.Blank;
btnBottomPrev.Style.Add("cursor", "pointer");
}
else
{
btnBottomNext.ImageUrl = AdminConstantKeys.PagerNextImage;
btnBottomNext.Enabled = true;
btnBottomNext.CssClass = AdminConstantKeys.Blank;
btnBottomNext.Style.Add("cursor", "pointer");
btnBottomPrev.ImageUrl = AdminConstantKeys.PagerPrevImage;
btnBottomPrev.Enabled = true;
btnBottomPrev.CssClass = AdminConstantKeys.Blank;
btnBottomPrev.Style.Add("cursor", "pointer");
}
}
///
/// Performing functionality on previous button click
///
///
///
protected void ImagePrevious_Click(object sender, ImageClickEventArgs e)
{
lblMsg.Text = "";
if (CurrentPage > 0) CurrentPage -= 1;
BindUserPhotoGallery(strUserId);
// enables buttons accordingly when page number is zero
if (CurrentPage == 0)
{
btnBottomPrev.ImageUrl = AdminConstantKeys.PagerFirstImage;
btnBottomPrev.Enabled = false;
btnBottomPrev.CssClass = AdminConstantKeys.Blank;
btnBottomPrev.Style.Add("cursor", "default");
btnBottomNext.ImageUrl = AdminConstantKeys.PagerNextImage;
btnBottomNext.Enabled = true;
btnBottomNext.CssClass = AdminConstantKeys.Blank;
btnBottomNext.Style.Add("cursor", "pointer");
}
else
{
btnBottomNext.ImageUrl = AdminConstantKeys.PagerNextImage;
btnBottomNext.Enabled = true;
btnBottomNext.CssClass = AdminConstantKeys.Blank;
btnBottomNext.Style.Add("cursor", "pointer");
btnBottomPrev.ImageUrl = AdminConstantKeys.PagerPrevImage;
btnBottomPrev.Enabled = true;
btnBottomPrev.CssClass = AdminConstantKeys.Blank;
btnBottomPrev.Style.Add("cursor", "pointer");
}
}
///
/// Wraps the text content
///
/// object
/// int
///
protected string WrapDescription(object objDescription, int intNum)
{
return Server.HtmlEncode(CommonFunction.WrapCharacters(objDescription, intNum));
}
///
/// Action performed on Back Button
///
/// object
///
protected void lnkBack_Click(object sender, EventArgs e)
{
if(strBack.Equals(AdminConstantKeys.ProfileTrue))
{
Response.Redirect("../ProfileApproval/UserPhotoGalleryListing.aspx?Type=B");
}
else
{
Response.Redirect("../ProfileApproval/UserPhotoGalleryListing.aspx?Type=" + strUserType);
}
}
}Here is an Example
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Text;
using System.IO;
using System.Net;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class ProfileApproval_PhotoGalleryApproval : System.Web.UI.Page
{
// variables decleration
ApprovalUserDetailsBAL objUserDetailBAL = null;
string strUserType = string.Empty;
public string strHeadVal = string.Empty;
public string strImagePath = string.Empty;
string strUserId = string.Empty;
string strBack = string.Empty;
DataTable dtImageGallery;
private int intPageCount = 0;
protected void Page_Load(object sender, EventArgs e)
{
if (ScriptManager.GetCurrent(Page).IsInAsyncPostBack)
{
lblMsg.Text = "";
}
if (!IsPostBack)
{
lblMsg.Text = "";
BindUserPhotoGallery(strUserId);
GetPageNumber();
}
}
///
/// Row command fired on Clicking User Name
///
///
///
protected void dlUserGallery_ItemCommand(object source, DataListCommandEventArgs e)
{
string strImageId = string.Empty;
string strMasterId = string.Empty;
string strPostDate = string.Empty;
string strCaption = string.Empty;
HiddenField HdnCaptionVal = null;
DateTime dtPosted = new DateTime();
Hashtable htblHederData = new Hashtable();
objUserDetailBAL = new ApprovalUserDetailsBAL();
lblMsg.Text = "";
//performs operation on Approve button click
if (e.CommandName == AdminConstantKeys.ProfileApproveDetail)
{
strImageId = e.CommandArgument.ToString();
HdnCaptionVal = (HiddenField)e.Item.FindControl(AdminConstantKeys.ProfilehdCaptionVal);
htblHederData.Add(AdminConstantKeys.AbuseUserIdParam, strUserId);
htblHederData.Add(AdminConstantKeys.ProfileUserTypeParam, strUserType);
strCaption = HdnCaptionVal.Value.ToString();
htblHederData.Add(AdminConstantKeys.ProfileCaptionParamNew, strCaption);
if (CommonFunction.CheckHeaderStatus(AdminConstantKeys.ProfileHeaderArtistImageApproval))
{
lblMsg.Text = objUserDetailBAL.UpdateUserPhotoGalleryImageStatus
(strImageId, AdminConstantKeys.StatusApproved,
Convert.ToInt32(Session[AdminConstantKeys.UserID]), AdminConstantKeys.ProfileHeaderArtistImageApproval, htblHederData);
}
else
{
lblMsg.Text = CommonFunction.GetErrorMessage("ERR4721");
}
GetPageNumber();
if (dlUserGallery.Items.Count == 1)
{
if (CurrentPage > 0) CurrentPage -= 1;
}
BindUserPhotoGallery(strUserId);
}
//performs operation on Decline button click
if (e.CommandName == AdminConstantKeys.ProfileDeclineDetail)
{
strImageId = e.CommandArgument.ToString();
HdnCaptionVal = (HiddenField)e.Item.FindControl(AdminConstantKeys.ProfilehdCaptionVal);
htblHederData.Add(AdminConstantKeys.AbuseUserIdParam, strUserId);
htblHederData.Add(AdminConstantKeys.ProfileUserTypeParam, strUserType);
strCaption = HdnCaptionVal.Value.ToString();
htblHederData.Add(AdminConstantKeys.ProfileCaptionParamNew, strCaption);
if (CommonFunction.CheckHeaderStatus(AdminConstantKeys.ProfileHeaderArtistImageDecline))
{
lblMsg.Text = objUserDetailBAL.UpdateUserPhotoGalleryImageStatus(strImageId,
AdminConstantKeys.StatusDeclined,
Convert.ToInt32(Session[AdminConstantKeys.UserID]), AdminConstantKeys.ProfileHeaderArtistImageDecline, htblHederData);
}
else
{
lblMsg.Text = CommonFunction.GetErrorMessage("ERR4722");
}
GetPageNumber();
// checks the count
if (dlUserGallery.Items.Count == 1)
{
if (CurrentPage > 0) CurrentPage -= 1;
}
BindUserPhotoGallery(strUserId);
}
}
///
/// Item data Bound functionality for check the image exist or not
///
///
///
protected void dlUserGallery_ItemDataBound(object sender, DataListItemEventArgs e)
{
bool blnImageExist = true;
HttpWebRequest myHttpWebRequest;
HttpWebResponse myHttpWebResponse;
// checks if the ListItemType is Item or Alternating Item
if (e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem)
{
Image imgPhoto = (Image)e.Item.FindControl
(AdminConstantKeys.ProfilelblPhotograph);
string strPath = imgPhoto.ImageUrl;
}
}
///
/// functionality on the Decline Button
///
///
///
protected void btnDeclineAll_Click(object sender, EventArgs e)
{
HiddenField HdnImageVal = null;
HiddenField HdnCaptionVal = null;
string strImage = string.Empty;
string strMsg = string.Empty;
StringBuilder strCaption = new StringBuilder();
//StringBuilder strImage = new StringBuilder();
Hashtable htblHederData = new Hashtable();
objUserDetailBAL = new ApprovalUserDetailsBAL();
htblHederData.Add(AdminConstantKeys.AbuseUserIdParam, strUserId);
htblHederData.Add(AdminConstantKeys.ProfileUserTypeParam, strUserType);
//traversing all items
foreach (DataListItem dlPhoto in dlUserGallery.Items)
{
HdnImageVal = (HiddenField)dlPhoto.FindControl
(AdminConstantKeys.ProfilehdImageVal);
HdnCaptionVal = (HiddenField)dlPhoto.FindControl
(AdminConstantKeys.ProfilehdCaptionVal);
strImage += HdnImageVal.Value + ",";
// strImage.Append(strImage.Value + ",");
strCaption.Append(HdnCaptionVal.Value + ",");
}
htblHederData.Add(AdminConstantKeys.ProfileCaptionParamNew, strCaption);
if (CommonFunction.CheckHeaderStatus(AdminConstantKeys.ProfileHeaderImageDeclineAll))
{
lblMsg.Text = objUserDetailBAL.UpdateAllPhotoGalleryImageStatus
(strImage, AdminConstantKeys.StatusDeclined,
Convert.ToInt32(Session[AdminConstantKeys.UserID]), AdminConstantKeys.ProfileHeaderImageDeclineAll, htblHederData);
}
else
{
lblMsg.Text = CommonFunction.GetErrorMessage("ERR4718");
}
if (CurrentPage > 0) CurrentPage -= 1;
BindUserPhotoGallery(strUserId);
}
///
/// functionality on the Approve Button
///
///
///
protected void btnApproveAll_Click(object sender, EventArgs e)
{
HiddenField HdnImageVal = null;
HiddenField HdnCaptionVal = null;
string strImage = string.Empty;
//string strCaption = string.Empty;
string strMsg = string.Empty;
StringBuilder strCaption = new StringBuilder();
//StringBuilder strImage = new StringBuilder();
Hashtable htblHederData = new Hashtable();
objUserDetailBAL = new ApprovalUserDetailsBAL();
htblHederData.Add(AdminConstantKeys.AbuseUserIdParam, strUserId);
htblHederData.Add(AdminConstantKeys.ProfileUserTypeParam, strUserType);
foreach (DataListItem dlPhoto in dlUserGallery.Items)
{
HdnImageVal = (HiddenField)dlPhoto.FindControl(AdminConstantKeys.ProfilehdImageVal);
HdnCaptionVal = (HiddenField)dlPhoto.FindControl(AdminConstantKeys.ProfilehdCaptionVal);
strImage += HdnImageVal.Value + ",";
strCaption.Append(HdnCaptionVal.Value + ",");
}
htblHederData.Add(AdminConstantKeys.ProfileCaptionParamNew, strCaption);
if (CommonFunction.CheckHeaderStatus(AdminConstantKeys.ProfileHeaderImageApprovalAll))
{
lblMsg.Text = objUserDetailBAL.UpdateAllPhotoGalleryImageStatus
(strImage, AdminConstantKeys.StatusApproved,
Convert.ToInt32(Session[AdminConstantKeys.UserID]), AdminConstantKeys.ProfileHeaderImageApprovalAll, htblHederData);
}
else
{
lblMsg.Text = CommonFunction.GetErrorMessage("ERR4716");
}
if (CurrentPage > 0) CurrentPage -= 1;
BindUserPhotoGallery(strUserId);
}
///
/// Assing the CurrentPage value to View State
///
public int CurrentPage
{
get
{
int intCurrentPage = 0;
// checks the viewstate is null or not
if ((ViewState[AdminConstantKeys.ProfileCurrentPageViewState] != null)
&& (Convert.ToString(ViewState[AdminConstantKeys.ProfileCurrentPageViewState]) != string.Empty))
intCurrentPage = Convert.ToInt32(
ViewState[AdminConstantKeys.ProfileCurrentPageViewState]);
return intCurrentPage;
}
set
{
ViewState.Add(AdminConstantKeys.ProfileCurrentPageViewState, value);
}
}
///
/// functionality on the Approve Button
///
///
///
protected void btnBack_Click(object sender, EventArgs e)
{
Response.Redirect("../ProfileApproval/UserPhotoGalleryListing.aspx?Type=A");
}
///
/// Binds the data dispalying all the photos of User
///
/// string type
//private void GetData(int Flag) BindUserPhotoGallery(strUserId)
protected void BindUserPhotoGallery(string strUserId)
{
DataTable dtbUser;
dtbUser = new DataTable();
objUserDetailBAL = new ApprovalUserDetailsBAL();
dtbUser = objUserDetailBAL.GetUserPhotoList(strUserId);
dtImageGallery = dtbUser;
PagedDataSource ObjPDS = new PagedDataSource();
ObjPDS.DataSource = dtImageGallery.DefaultView;
ObjPDS.AllowPaging = true;
ObjPDS.PageSize = Convert.ToInt32(ConfigurationManager.AppSettings
[AdminConstantKeys.ProfileDatalistPageSize].ToString());
ObjPDS.CurrentPageIndex = CurrentPage;
// checks if the datable if row count greater than zero
if (dtImageGallery.Rows.Count > 0)
{
dlUserGallery.DataSource = ObjPDS;
dlUserGallery.DataBind();
lblNorec.Visible = false;
}
else
{
dlUserGallery.DataSource = ObjPDS;
dlUserGallery.DataBind();
lblNorec.Visible = true;
buttonRow.Visible = false;
tab2.Visible = false;
}
intPageCount = ObjPDS.PageCount;
ViewState[AdminConstantKeys.ProfileViewStPageCount] = intPageCount;
if (intPageCount > 1)
{
int[] intPageNumbers = new int[intPageCount];
for (int intIndex = 0; intIndex < intPageCount; intIndex++) intPageNumbers[intIndex] = intIndex + 1;
lblPage.Text = AdminConstantKeys.ProfilePage +
Convert.ToString(CurrentPage + 1) + AdminConstantKeys.ProfileOf
+ Convert.ToString(intPageCount);
tab2.Visible = true;
// checks if current page is zero
if (CurrentPage == 0)
{
btnBottomNext.ImageUrl = AdminConstantKeys.PagerNextImage;
btnBottomNext.Enabled = true;
btnBottomNext.CssClass = AdminConstantKeys.Blank;
btnBottomNext.Style.Add("cursor", "pointer");
btnBottomPrev.ImageUrl = AdminConstantKeys.PagerFirstImage;
btnBottomPrev.Enabled = false;
btnBottomPrev.CssClass = AdminConstantKeys.Blank;
btnBottomPrev.Style.Add("cursor", "default");
}
else
{
btnBottomNext.ImageUrl = AdminConstantKeys.PagerLastImage;
btnBottomNext.Enabled = true;
btnBottomNext.CssClass = AdminConstantKeys.Blank;
btnBottomNext.Style.Add("cursor", "pointer");
btnBottomPrev.ImageUrl = AdminConstantKeys.PagerPrevImage;
btnBottomPrev.Enabled = true;
btnBottomPrev.CssClass = AdminConstantKeys.Blank;
btnBottomPrev.Style.Add("cursor", "pointer");
}
}
else
{
lblPage.Text = AdminConstantKeys.ProfilePage +
Convert.ToString(CurrentPage + 1) + AdminConstantKeys.ProfileOf
+ Convert.ToString(intPageCount);
btnBottomNext.ImageUrl = AdminConstantKeys.PagerLastImage;
btnBottomNext.Enabled = false;
btnBottomNext.CssClass = AdminConstantKeys.Blank;
btnBottomNext.Style.Add("cursor", "default");
btnBottomPrev.ImageUrl = AdminConstantKeys.PagerFirstImage;
btnBottomPrev.Enabled = false;
btnBottomPrev.CssClass = AdminConstantKeys.Blank;
btnBottomPrev.Style.Add("cursor", "default");
}
}
///
/// Performing functionality to get the PageNumber
///
///
///
private void GetPageNumber()
{
int intPageCount1 = Convert.ToInt32(
ViewState[AdminConstantKeys.ProfileViewStPageCount]);
int[] intPageNumbers = new int[intPageCount1];
// initialize the page number
for (int intIndex = 0; intIndex < intPageCount; intIndex++)
{
intPageNumbers[intIndex] = intIndex + 1;
}
}
///
/// Performing functionality on Next button click
///
///
///
protected void ImageNext_Click(object sender, ImageClickEventArgs e)
{
lblMsg.Text = "";
// checks the current page value
if (CurrentPage < Convert.ToInt32(
ViewState[AdminConstantKeys.ProfileViewStPageCount]) - 1)
CurrentPage += 1;
BindUserPhotoGallery(strUserId);
if (intPageCount == CurrentPage + 1)
{
btnBottomNext.ImageUrl = AdminConstantKeys.PagerLastImage;
btnBottomNext.Enabled = false;
btnBottomNext.CssClass = AdminConstantKeys.Blank;
btnBottomNext.Style.Add("cursor", "default");
btnBottomPrev.ImageUrl = AdminConstantKeys.PagerPrevImage;
btnBottomPrev.Enabled = true;
btnBottomPrev.CssClass = AdminConstantKeys.Blank;
btnBottomPrev.Style.Add("cursor", "pointer");
}
else
{
btnBottomNext.ImageUrl = AdminConstantKeys.PagerNextImage;
btnBottomNext.Enabled = true;
btnBottomNext.CssClass = AdminConstantKeys.Blank;
btnBottomNext.Style.Add("cursor", "pointer");
btnBottomPrev.ImageUrl = AdminConstantKeys.PagerPrevImage;
btnBottomPrev.Enabled = true;
btnBottomPrev.CssClass = AdminConstantKeys.Blank;
btnBottomPrev.Style.Add("cursor", "pointer");
}
}
///
/// Performing functionality on previous button click
///
///
///
protected void ImagePrevious_Click(object sender, ImageClickEventArgs e)
{
lblMsg.Text = "";
if (CurrentPage > 0) CurrentPage -= 1;
BindUserPhotoGallery(strUserId);
// enables buttons accordingly when page number is zero
if (CurrentPage == 0)
{
btnBottomPrev.ImageUrl = AdminConstantKeys.PagerFirstImage;
btnBottomPrev.Enabled = false;
btnBottomPrev.CssClass = AdminConstantKeys.Blank;
btnBottomPrev.Style.Add("cursor", "default");
btnBottomNext.ImageUrl = AdminConstantKeys.PagerNextImage;
btnBottomNext.Enabled = true;
btnBottomNext.CssClass = AdminConstantKeys.Blank;
btnBottomNext.Style.Add("cursor", "pointer");
}
else
{
btnBottomNext.ImageUrl = AdminConstantKeys.PagerNextImage;
btnBottomNext.Enabled = true;
btnBottomNext.CssClass = AdminConstantKeys.Blank;
btnBottomNext.Style.Add("cursor", "pointer");
btnBottomPrev.ImageUrl = AdminConstantKeys.PagerPrevImage;
btnBottomPrev.Enabled = true;
btnBottomPrev.CssClass = AdminConstantKeys.Blank;
btnBottomPrev.Style.Add("cursor", "pointer");
}
}
///
/// Wraps the text content
///
/// object
/// int
///
protected string WrapDescription(object objDescription, int intNum)
{
return Server.HtmlEncode(CommonFunction.WrapCharacters(objDescription, intNum));
}
///
/// Action performed on Back Button
///
/// object
///
protected void lnkBack_Click(object sender, EventArgs e)
{
if(strBack.Equals(AdminConstantKeys.ProfileTrue))
{
Response.Redirect("../ProfileApproval/UserPhotoGalleryListing.aspx?Type=B");
}
else
{
Response.Redirect("../ProfileApproval/UserPhotoGalleryListing.aspx?Type=" + strUserType);
}
}
}
No comments:
Post a Comment