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.PhotoGallery photoGallary = Sanoy.AddisTower.DA.PhotoGallery.Select(int.Parse(strqur)); if (photoGallary != null) { btnSave.Text = "Update"; panStatus.Visible = true; } if (photoGallary.Publish == "D") { lblStatus.Text = "Draft"; btnApprove.Text = "Approve"; } else if (photoGallary.Publish == "P") { lblStatus.Text = "Published"; btnApprove.Text = "Suspend"; } else if (photoGallary.Publish == "X") { lblStatus.Text = "Archive"; btnApprove.Text = "Approve"; } else if (photoGallary.Publish == "S") { lblStatus.Text = "Suspended"; btnApprove.Text = "Approve"; } txtTitle.Text = photoGallary.Title; txtPicName.Text = photoGallary.NormalPicture; txtThumbnails.Text = photoGallary.Thumbnails; Status = photoGallary.Publish; Id = photoGallary.Id; } } catch { } }
private void Save() { try { string id; Sanoy.AddisTower.BE.PhotoGallery photoGallary = new Sanoy.AddisTower.BE.PhotoGallery(); photoGallary.Title = txtTitle.Text; photoGallary.NormalPicture = txtPicName.Text; photoGallary.Thumbnails = txtThumbnails.Text; photoGallary.Catagory = int.Parse(ddlCatagory.SelectedValue); if (ddListOperation.SelectedValue == "-- Create New --") { photoGallary.Id = Sanoy.AddisTower.DA.Utility.GetId("PhotoGallery", "Id"); photoGallary.State = Sanoy.AddisTower.BE.RowState.Added; photoGallary.Publish = "D"; } else { photoGallary.Publish = Status; photoGallary.Id = Id; photoGallary.State = Sanoy.AddisTower.BE.RowState.Modified; } if (PhotoGallery.Save(photoGallary)) { lblMessage.Text = "The content was succesfully saved."; } else { lblMessage.Text = "There was problem saving the content."; } Populate(); clear(); } catch { } }