//----------------------------------------------- #region --------------LoadGrid-------------- //--------------------------------------------------------- //LoadGrid //--------------------------------------------------------- protected void LoadGrid(IList list, string dataKeyField) { if (pager != null) { pager.PageSize = PageSize; } if (list != null && list.Count > 0) { dgControl.DataSource = list; dgControl.DataKeyField = dataKeyField; dgControl.AllowPaging = false; if (pager != null) { pager.Visible = true; pager.TotalRecords = totalRecords; } dgControl.DataBind(); dgControl.Visible = true; } else { dgControl.Visible = false; if (pager != null) { pager.Visible = false; } lblResult.CssClass = "operation_error"; lblResult.Text = DynamicResource.GetText("AdminText", "ThereIsNoData"); } }
//---------------------------------------------------------------------------------------------------------- public static void AddProfilePageDetails(UsersDataEntity usersDataObject) { ItemsEntity page = new ItemsEntity(); page.ModuleTypeID = (int)ModuleTypes.UsersProfiles; page.OwnerID = usersDataObject.UserId; //----------------------------------------------------- //AddDetails //---------------------------- ItemsDetailsEntity itemDetailsObject; if (SiteSettings.Languages_HasArabicLanguages) { itemDetailsObject = new ItemsDetailsEntity(); itemDetailsObject.LangID = Languages.Ar; itemDetailsObject.Title = DynamicResource.GetText("Modules", "PageTitle_UserProfilePage"); itemDetailsObject.ExtraData.Add(""); page.Details[Languages.Ar] = itemDetailsObject; } if (SiteSettings.Languages_HasEnglishLanguages) { itemDetailsObject = new ItemsDetailsEntity(); itemDetailsObject.LangID = Languages.En; itemDetailsObject.Title = DynamicResource.GetText("Modules", "PageTitle_UserProfilePage"); itemDetailsObject.ExtraData.Add(""); page.Details[Languages.En] = itemDetailsObject; } //----------------------------------------------------- ItemsModulesOptions UsersProfilesModule = ItemsModulesOptions.GetType((int)ModuleTypes.UsersProfiles); ItemsFactory.Create(page, UsersProfilesModule); //----------------------------------------------------- usersDataObject.ProfilePageID = page.ItemID; }
//---------------------------------------------------------------------------------------------------------- public static int AddSubSitePageDetails(int PageNo, UsersDataEntity usersDataObject) { ItemsEntity page = new ItemsEntity(); page.ModuleTypeID = (int)ModuleTypes.SubSitePages; page.OwnerID = usersDataObject.UserId; //----------------------------------------------------- //AddDetails //---------------------------- ItemsDetailsEntity itemDetailsObject; if (SiteSettings.Languages_HasArabicLanguages) { itemDetailsObject = new ItemsDetailsEntity(); itemDetailsObject.LangID = Languages.Ar; itemDetailsObject.Title = DynamicResource.GetText("SubSites", "Page_" + PageNo); itemDetailsObject.ExtraData.Add(""); page.Details[Languages.Ar] = itemDetailsObject; } if (SiteSettings.Languages_HasEnglishLanguages) { itemDetailsObject = new ItemsDetailsEntity(); itemDetailsObject.LangID = Languages.En; itemDetailsObject.Title = DynamicResource.GetText("SubSites", "Page_" + PageNo); itemDetailsObject.ExtraData.Add(""); page.Details[Languages.En] = itemDetailsObject; } //----------------------------------------------------- ItemsModulesOptions subSitePagesModule = ItemsModulesOptions.GetType((int)ModuleTypes.SubSitePages); ItemsFactory.Create(page, subSitePagesModule); //----------------------------------------------------- return(page.ItemID); }
//---------------------------------------------------------------------- public static void SendActivationCodeMessage(MailListUsersEntity user) { // prepare message string body = string.Format(DynamicResource.GetText("MailList", "ActivationMailBody"), new string[3] { SitesHandler.GetSiteDomain(), Encryption.Encrypt(user.UserID.ToString()), user.Email }); //string from =MailListEmailsFactory.MailFrom; MailListEmailsEntity mail = new MailListEmailsEntity(); mail.Subject = DynamicResource.GetText("MailList", "ActivationMailSubject"); mail.Body = body; mail.To.Add(user.Email); MailListEmailsFactory.Send(mail); }
//-------------------------------------------------------- #endregion #region --------------Load_ddl()-------------- //--------------------------------------------------------- //Load_ddlItemsCategories //--------------------------------------------------------- protected void Load_ddlItemsCategories(DropDownList dl, IList list, string dataTextField, string dataValueField) { if (list != null && list.Count > 0) { dl.DataSource = list; dl.DataTextField = dataTextField; dl.DataValueField = dataValueField; dl.DataBind(); dl.Items.Insert(0, new ListItem(DynamicResource.GetText("AdminText", "Choose"), "-1")); dl.Enabled = true; } else { dl.Items.Clear(); dl.Items.Insert(0, new ListItem(DynamicResource.GetText("AdminText", "ThereIsNoData"), "-1")); dl.Enabled = false; } }
//----------------------------------------------- //btnSave_Click //----------------------------------------------- protected void btnSave_Click(object sender, EventArgs e) { if (pageType == PagesTypes.AdminEdit && !MoversFW.Components.UrlManager.ChechIsValidIntegerParameter("id")) { Response.Redirect("default.aspx"); } if (!Page.IsValid) { return; } dcObj = SaveData(); if (dcObj == null) { return; } if (status == ExecuteCommandStatus.Done) { SaveFiles(dcObj); if (pageType == PagesTypes.AdminEdit) { Response.Redirect("default.aspx"); } else { lblResult.CssClass = "operation_done"; lblResult.Text = DynamicResource.GetText("AdminText", "SavingDataSuccessfuly"); ClearControls(); } } else if (status == ExecuteCommandStatus.AllreadyExists) { lblResult.CssClass = "operation_error"; lblResult.Text = DynamicResource.GetText("AdminText", "DuplicateItem"); } else { lblResult.CssClass = "operation_error"; lblResult.Text = DynamicResource.GetText("AdminText", "SavingDataFaild"); } }
//-------------------------------------------------------- #endregion #region --------------dgControl_DeleteCommand-------------- //--------------------------------------------------------- //dgControl_DeleteCommand //--------------------------------------------------------- public void dgControl_DeleteCommand(object source, DataGridCommandEventArgs e) { int id = Convert.ToInt32(dgControl.DataKeys[e.Item.ItemIndex]); if (DeleteItem(id)) { //if one item in datagrid if (dgControl.Items.Count == 1 && pager.CurrentPage > 1) { --pager.CurrentPage; } LoadData(); } else { lblResult.CssClass = "operation_error"; lblResult.Text = DynamicResource.GetText("AdminText", "DeletingOprationFaild"); } }
//-------------------------------------------------------- #endregion #region --------------dgControl_ItemDataBound-------------- //--------------------------------------------------------- //dgControl_ItemDataBound //--------------------------------------------------------- public void dgControl_ItemDataBound(object source, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { ImageButton lbtnDelete = (ImageButton)e.Item.FindControl("lbtnDelete"); lbtnDelete.Attributes.Add("onclick", "return confirm('" + DynamicResource.GetText("AdminText", "DeleteActivation") + "')"); lbtnDelete.AlternateText = DynamicResource.GetText("AdminText", "Delete"); #region ---------Index------- //Set Index int previousRowsCount = 0; if (pager != null) { previousRowsCount = (pager.CurrentPage - 1) * pager.PageSize; } int currentRow = e.Item.ItemIndex + 1; e.Item.Cells[0].Text = (previousRowsCount + currentRow).ToString(); #endregion } }
//--------------------------------------------------------------------------- public static void LoadDropDownList(DataView dv, DropDownList ddl, string testFeild, string valueFeild, bool addChoose) { if (dv != null && dv.Count > 0) { ddl.DataSource = dv; ddl.DataTextField = testFeild; ddl.DataValueField = valueFeild; ddl.DataBind(); if (addChoose) { ddl.Items.Insert(0, new ListItem(DynamicResource.GetText("AdminText", "Choose"), "-1")); } ddl.Enabled = true; } else { ddl.Items.Clear(); ddl.Items.Insert(0, new ListItem(DynamicResource.GetText("AdminText", "ThereIsNoData"), "-1")); ddl.Enabled = false; } }
//--------------------------------------------------------------------------- public static void LoadDropDownList <T>(List <T> list, DropDownList ddl, string testFeild, string valueFeild, bool addChoose, int chooseID) { if (list != null && list.Count > 0) { ddl.DataSource = list; ddl.DataTextField = testFeild; ddl.DataValueField = valueFeild; ddl.DataBind(); if (addChoose) { ddl.Items.Insert(0, new ListItem(DynamicResource.GetText("User", "Choose"), chooseID.ToString())); } ddl.Enabled = true; } else { ddl.Items.Clear(); ddl.Items.Insert(0, new ListItem(DynamicResource.GetText("User", "NoData"), chooseID.ToString())); ddl.Enabled = false; } }
public static void PrepareUserPager(OurPager pgr) { Languages pagerLanguage = SiteSettings.GetCurrentLanguage(); pgr.CurrentPageCss = "Pager-Active"; if (pagerLanguage != Languages.Ar) { pgr.Dir = MoversFW.OurPager.Direction.ltr; } else { pgr.Dir = MoversFW.OurPager.Direction.rtl; } //FristLinkActiveImageUrl if (pagerLanguage != Languages.Ar) { pgr.FristLinkActiveImageUrl = SiteDesign.Pager + "FirstEnable.gif"; } else { pgr.FristLinkActiveImageUrl = SiteDesign.Pager + "LastEnable.gif"; } //FristLinkInActiveImageUrl if (pagerLanguage != Languages.Ar) { pgr.FristLinkInActiveImageUrl = SiteDesign.Pager + "FirstDisable.gif"; } else { pgr.FristLinkInActiveImageUrl = SiteDesign.Pager + "LastDisable.gif"; } // pgr.FristLinkText = DynamicResource.GetText("User", "PagerFrist"); //------------------------------------- pgr.ImageClass = "PagerImage"; //NextLinkText pgr.NextLinkText = DynamicResource.GetText("User", "PagerNext"); //NextLinkActiveImageUrl if (pagerLanguage != Languages.Ar) { pgr.NextLinkActiveImageUrl = SiteDesign.Pager + "NextEnable.gif"; } else { pgr.NextLinkActiveImageUrl = SiteDesign.Pager + "PreviousEnable.gif"; } //NextLinkInActiveImageUrl if (pagerLanguage != Languages.Ar) { pgr.NextLinkInActiveImageUrl = SiteDesign.Pager + "NextDisable.gif"; } else { pgr.NextLinkInActiveImageUrl = SiteDesign.Pager + "PreviousDisable.gif"; } //-------------------------------------- //LastLinkText pgr.LastLinkText = DynamicResource.GetText("User", "PagerLast"); //LastLinkActiveImageUrl if (pagerLanguage != Languages.Ar) { pgr.LastLinkActiveImageUrl = SiteDesign.Pager + "LastEnable.gif"; } else { pgr.LastLinkActiveImageUrl = SiteDesign.Pager + "FirstEnable.gif"; } // if (pagerLanguage != Languages.Ar) { pgr.LastLinkInActiveImageUrl = SiteDesign.Pager + "LastDisable.gif"; } else { pgr.LastLinkInActiveImageUrl = SiteDesign.Pager + "FirstDisable.gif"; } //-------------------------------------- //PreviousLinkText pgr.PreviousLinkText = DynamicResource.GetText("User", "PagerPrevious"); //PreviousLinkActiveImageUrl if (pagerLanguage != Languages.Ar) { pgr.PreviousLinkActiveImageUrl = SiteDesign.Pager + "PreviousEnable.gif"; } else { pgr.PreviousLinkActiveImageUrl = SiteDesign.Pager + "NextEnable.gif"; } //PreviousLinkInActiveImageUrl if (pagerLanguage != Languages.Ar) { pgr.PreviousLinkInActiveImageUrl = SiteDesign.Pager + "PreviousDisable.gif"; } else { pgr.PreviousLinkInActiveImageUrl = SiteDesign.Pager + "NextDisable.gif"; } //-------------------------------------- //Details pgr.TextCss = "PagerText"; pgr.FromText = DynamicResource.GetText("User", "PagerFrom"); pgr.PageNoText = DynamicResource.GetText("User", "PagerPageNO"); }
public static void PrepareAdminPager(OurPager pgr) { //Languages pagerLanguage = (Languages)ResourceManager.GetCurrentLanguage(); Languages pagerLanguage = Languages.Ar; pgr.CurrentPageCss = "Pager-Active"; if (pagerLanguage != Languages.Ar) { pgr.Dir = MoversFW.OurPager.Direction.ltr; } else { pgr.Dir = MoversFW.OurPager.Direction.rtl; } //FristLinkActiveImageUrl if (pagerLanguage != Languages.Ar) { pgr.FristLinkActiveImageUrl = "/Content/AdminDesign/Ar/css/images/Pager/FirstEnable.gif"; } else { pgr.FristLinkActiveImageUrl = "/Content/AdminDesign/Ar/css/images/Pager/LastEnable.gif"; } //FristLinkInActiveImageUrl if (pagerLanguage != Languages.Ar) { pgr.FristLinkInActiveImageUrl = "/Content/AdminDesign/Ar/css/images/Pager/FirstDisable.gif"; } else { pgr.FristLinkInActiveImageUrl = "/Content/AdminDesign/Ar/css/images/Pager/LastDisable.gif"; } // pgr.FristLinkText = DynamicResource.GetText("AdminText", "PagerFrist"); //------------------------------------- pgr.ImageClass = "PagerImage"; //NextLinkText pgr.NextLinkText = DynamicResource.GetText("AdminText", "PagerNext"); //NextLinkActiveImageUrl if (pagerLanguage != Languages.Ar) { pgr.NextLinkActiveImageUrl = "/Content/AdminDesign/Ar/css/images/Pager/NextEnable.gif"; } else { pgr.NextLinkActiveImageUrl = "/Content/AdminDesign/Ar/css/images/Pager/PreviousEnable.gif"; } //NextLinkInActiveImageUrl if (pagerLanguage != Languages.Ar) { pgr.NextLinkInActiveImageUrl = "/Content/AdminDesign/Ar/css/images/Pager/NextDisable.gif"; } else { pgr.NextLinkInActiveImageUrl = "/Content/AdminDesign/Ar/css/images/Pager/PreviousDisable.gif"; } //-------------------------------------- //LastLinkText pgr.LastLinkText = DynamicResource.GetText("AdminText", "PagerLast"); //LastLinkActiveImageUrl if (pagerLanguage != Languages.Ar) { pgr.LastLinkActiveImageUrl = "/Content/AdminDesign/Ar/css/images/Pager/LastEnable.gif"; } else { pgr.LastLinkActiveImageUrl = "/Content/AdminDesign/Ar/css/images/Pager/FirstEnable.gif"; } // if (pagerLanguage != Languages.Ar) { pgr.LastLinkInActiveImageUrl = "/Content/AdminDesign/Ar/css/images/Pager/LastDisable.gif"; } else { pgr.LastLinkInActiveImageUrl = "/Content/AdminDesign/Ar/css/images/Pager/FirstDisable.gif"; } //-------------------------------------- //PreviousLinkText pgr.PreviousLinkText = DynamicResource.GetText("AdminText", "PagerPrevious"); //PreviousLinkActiveImageUrl if (pagerLanguage != Languages.Ar) { pgr.PreviousLinkActiveImageUrl = "/Content/AdminDesign/Ar/css/images/Pager/PreviousEnable.gif"; } else { pgr.PreviousLinkActiveImageUrl = "/Content/AdminDesign/Ar/css/images/Pager/NextEnable.gif"; } //PreviousLinkInActiveImageUrl if (pagerLanguage != Languages.Ar) { pgr.PreviousLinkInActiveImageUrl = "/Content/AdminDesign/Ar/css/images/Pager/PreviousDisable.gif"; } else { pgr.PreviousLinkInActiveImageUrl = "/Content/AdminDesign/Ar/css/images/Pager/NextDisable.gif"; } //-------------------------------------- //Details pgr.TextCss = "PagerText"; pgr.FromText = DynamicResource.GetText("AdminText", "PagerFrom"); pgr.PageNoText = DynamicResource.GetText("AdminText", "PagerPageNO"); }