private void PopulateFilelds() { try { string strqur = ddListOperation.SelectedValue.ToString(); lblMessage.Text = ""; if (strqur.Equals("-- Create New --")) { clear(); panStatus.Visible = false; btnSave.Text = "Save"; btnApprove.Text = "Approve"; } else if (short.Parse(strqur) > 0) { short pageId = short.Parse(strqur); Sanoy.AddisTower.BE.CommonPageContent commonPageContent = Sanoy.AddisTower.DA.CommonPageContent.Select(int.Parse(strqur)); if (commonPageContent != null) { btnSave.Text = "Update"; panStatus.Visible = true; } if (commonPageContent.Publish == "D") { lblStatus.Text = "Draft"; btnApprove.Text = "Approve"; } else if (commonPageContent.Publish == "P") { lblStatus.Text = "Published"; btnApprove.Text = "Suspend"; } else if (commonPageContent.Publish == "X") { lblStatus.Text = "Archive"; btnApprove.Text = "Approve"; } else if (commonPageContent.Publish == "S") { lblStatus.Text = "Suspended"; btnApprove.Text = "Approve"; } Status = commonPageContent.Publish; lblUpdated.Text = (commonPageContent.Edited.ToShortDateString() == "1/1/1900" ? "" : commonPageContent.Edited.ToShortDateString()); lblUpdated.Text += "<br> By " + commonPageContent.EditedBy; lblCreated.Text = commonPageContent.Created.ToShortDateString() + "<br> By " + commonPageContent.CreatedBy; txtTitle.Text = commonPageContent.Title; FCKeditor1.Value = commonPageContent.Content; CreatedDate = commonPageContent.Created; CreatedBy = commonPageContent.CreatedBy; } } catch { } }
private void Save() { try { Sanoy.AddisTower.BE.CommonPageContent commonPageContent = new Sanoy.AddisTower.BE.CommonPageContent(); commonPageContent.Content = FCKeditor1.Value.Replace("\'", "\'\'"); commonPageContent.Title = txtTitle.Text; commonPageContent.CommonPage = int.Parse(QueryString); if (ddListOperation.SelectedValue == "-- Create New --") { commonPageContent.Publish = "D"; commonPageContent.State = Sanoy.AddisTower.BE.RowState.Added; commonPageContent.Created = DateTime.Now; commonPageContent.CreatedBy = Session["UserName"].ToString(); commonPageContent.EditedBy = ""; commonPageContent.Edited = Convert.ToDateTime("01/01/1900"); } else { commonPageContent.Created = CreatedDate; commonPageContent.CreatedBy = CreatedBy; commonPageContent.Publish = Status; commonPageContent.State = Sanoy.AddisTower.BE.RowState.Modified; commonPageContent.EditedBy = Session["UserName"].ToString(); commonPageContent.Edited = DateTime.Now; commonPageContent.Id = Int32.Parse(ddListOperation.SelectedValue); } if (Sanoy.AddisTower.DA.CommonPageContent.Save(commonPageContent)) { lblMessage.Text = "The content was succesfully saved."; } else { lblMessage.Text = "There was problem saving the content."; } Populate(); } catch { } }
protected void Page_Load(object sender, EventArgs e) { try { if (Request.QueryString["Id"] == "3") { panMotorcycle.Visible = true; //txtName.Text = Guid.NewGuid().ToString(); } else { panMotorcycle.Visible = false; } if (Request.QueryString["Id"] == "4") { panSparepart.Visible = true; //List<DataAccessSearch.SparepartCategory>category = BusinessEntitySearch.SparepartCategory.PopulateAllSparepartCategoy(); // ddlCategory.SelectedItem.Text = category[0].Name.ToString(); } else { panSparepart.Visible = false; } if (Request.QueryString["Id"] != null) { Sanoy.AddisTower.BE.CommonPage commonPage = Sanoy.AddisTower.DA.CommonPage.Select(Convert.ToInt32(Request.QueryString["Id"].ToString())); this.Title = litContentTitle.Text = commonPage.Title.ToString(); Sanoy.AddisTower.BE.CommonPageContent commonPageContent = Sanoy.AddisTower.DA.CommonPageContent.SelectApproved(int.Parse(Request.QueryString["Id"].ToString())); litContent.Text = commonPageContent.Content; } } catch { } }