void GetInfo() { if (!string.IsNullOrEmpty(PageSectionId)) { _rpoObj = new PageSectionsRepository(); PageSection PageSectionEnt = _rpoObj.LoadById(PageSectionId); if (PageSectionEnt != null) { txtSectionTitle.Text = PageSectionEnt.SectionTitle; //if (!string.IsNullOrEmpty(PageSectionEnt.ImageFile)) //{ // imgSection.ImageUrl = ConfigurationManager.AppSettings["Pages"].ToString() + PageSectionEnt.ImageFile; // imgSection.Visible = true; //} //else // imgSection.Visible = false; edSectionContent.Content = PageSectionEnt.SectionContent; try { ddlPage.SelectedValue = PageSectionEnt.PageId.ToString(); ddlLanguage.SelectedValue = PageSectionEnt.LanguageId.ToString(); } catch { ddlPage.SelectedIndex = -1; ddlLanguage.SelectedIndex = -1; } } } }
protected void grdData_RowCommand(object sender, GridViewCommandEventArgs e) { _rpoObj = new PageSectionsRepository(); switch (e.CommandName) { case "restoreitem": if (_rpoObj.Restore(e.CommandArgument.ToString(), Request.Cookies["CooLoginUserId"].Value)) { grdData.DataBind(); } break; case "deleteitem": if (_rpoObj.Delete(e.CommandArgument.ToString(), Request.Cookies["CooLoginUserId"].Value)) { grdData.DataBind(); } break; } }
private void LoadPageSectionsByLanguageAndPageID() { PageSectionsRepository _Obj = new PageSectionsRepository(); grdData.DataSource = _Obj.LoadByLanguageIdAndPageId(ddlPage.SelectedValue.ToString(), ddlLanguage.SelectedValue.ToString()); grdData.DataBind(); }
private void LoadAboutUS() { PageSectionsRepository _rpoObj = new PageSectionsRepository(); PageSection _PageSectionObjDefault = new PageSection(); _PageSectionObjDefault = _rpoObj.LoadByLanguageIdPram("097BE02E-A019-4853-AD50-F22EF5F0BF0F"); try { lblAboutTitleDefault.Text = _PageSectionObjDefault.SectionTitle; lblAboutContentDefault.Text = _PageSectionObjDefault.SectionContent; } catch (Exception) { } }
private void LoadAboutUS() { try { PageSectionsRepository _rpoObj = new PageSectionsRepository(); PageSection _PageSectionObjDefault = new PageSection(); _PageSectionObjDefault = _rpoObj.LoadByLanguageIdAndIsDefault(true, "b5c66d73-b2fa-436d-817a-e5332af83934"); lblAboutTitleDefault.Text = _PageSectionObjDefault.SectionTitle; lblAboutContentDefault.Text = _PageSectionObjDefault.SectionContent; //imgAboutDefault.ImageUrl = ConfigurationManager.AppSettings["Pages"].ToString() + _PageSectionObjDefault.ImageFile; //_PageSectionObjDefault = new PageSection(); //_PageSectionObjDefault = _rpoObj.LoadById("8dd20d86-fdec-4c73-aab6-681a450d5057"); //lblAboutTitle1.Text = _PageSectionObjDefault.SectionTitle; //lblAboutContent1.Text = _PageSectionObjDefault.SectionContent; //_PageSectionObjDefault = new PageSection(); //_PageSectionObjDefault = _rpoObj.LoadById("f22f80bd-eb48-4dc7-b7f7-73b37ee1135c"); //lblAboutTitle2.Text = _PageSectionObjDefault.SectionTitle; //lblAboutContent2.Text = _PageSectionObjDefault.SectionContent; } catch (Exception) { } }
void Save() { string ImageFile = string.Empty; _rpoObj = new PageSectionsRepository(); #region Manage Item string FileName = string.Empty; _rpoObj._Obj.PageId = new Guid(ddlPage.SelectedValue.ToString()); _rpoObj._Obj.LanguageId = new Guid(ddlLanguage.SelectedValue.ToString()); _rpoObj._Obj.SectionTitle = txtSectionTitle.Text; _rpoObj._Obj.SectionContent = edSectionContent.Content; _rpoObj._Obj.IsDefault = chkIsDefault.Checked; if (string.IsNullOrEmpty(PageSectionId)) { _rpoObj._Obj.CreatedBy = new Guid(Request.Cookies["CooLoginUserId"].Value); if (fpld.PostedFile.FileName != "") { FileName = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(fpld.PostedFile.FileName); string PathUrl = Server.MapPath(ConfigurationManager.AppSettings["Pages"].ToString()) + FileName; fpld.SaveAs(PathUrl); // DAL.ImagesFact.ResizeWithCropResizeImage("", FileName, "Section"); _rpoObj._Obj.ImageFile = FileName; } PageSectionId = _rpoObj.Add().ToString(); //if (!string.IsNullOrEmpty(PageSectionId)) //{ // BackendMessages(101); //} //else //{ // BackendMessages(201); //} } else { _rpoObj._Obj = _rpoObj.LoadById(PageSectionId); _rpoObj._Obj.PageId = new Guid(ddlPage.SelectedValue); _rpoObj._Obj.LanguageId = new Guid(ddlLanguage.SelectedValue); _rpoObj._Obj.SectionTitle = txtSectionTitle.Text; _rpoObj._Obj.SectionContent = edSectionContent.Content; if (fpld.PostedFile.FileName != "") { if (_rpoObj._Obj.ImageFile != null) { DirectoryInfo di = new DirectoryInfo(Server.MapPath(ConfigurationManager.AppSettings["Pages"])); foreach (FileInfo fi in di.GetFiles()) { if (_rpoObj._Obj.ImageFile == fi.Name) { File.Delete(fi.Name); } } } FileName = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(fpld.PostedFile.FileName); string PathUrl = Server.MapPath(ConfigurationManager.AppSettings["Pages"].ToString()) + FileName; fpld.SaveAs(PathUrl); // DAL.ImagesFact.ResizeWithCropResizeImage("", FileName, "Section"); _rpoObj._Obj.ImageFile = FileName; } _rpoObj._Obj.ModifiedBy = new Guid(Request.Cookies["CooLoginUserId"].Value); if (_rpoObj.Edit()) { //lblMessge.Text = "Done, changes has been saved successfully!"; //msg.Attributes["class"] = "msg-success"; } else { //lblMessge.Text = "Error, Please try again later!"; //msg.Attributes["class"] = "msg-error"; } } #endregion }