private void Edit(int OperationID) { try { TestimonialController ctl = new TestimonialController(); TestimonialInfo obj = ctl.GetRecordByID(OperationID, GetPortalID, int.Parse(SageUserModuleID)); txtName.Text = obj.UserName; txtAddress.Text = obj.Address; txtDate.Text = CommonHelper.ShortTimeReturn(obj.TestimonialDate); txtWeburl.Text = obj.WebUrl; txtTestimonial.Value = obj.Testimonial; Session["Image"] = obj.Image; Session["TestimonialID"] = obj.TestimonialID; if (obj.Image != "") { divImage.Visible = true; imgProfilepic.ImageUrl = basePath + "image/UploadedImages/" + obj.Image; } else { divImage.Visible = false; } ShowHidePage(); } catch (Exception e) { throw e; } }
private void LoadRecordsOnGrid() { try { TestimonialController clt = new TestimonialController(); List <TestimonialInfo> lstData = clt.LoadRecordsOnGrid(GetPortalID, int.Parse(SageUserModuleID)); gdvTestRecord.DataSource = lstData; gdvTestRecord.DataBind(); } catch (Exception e) { throw e; } }
private void Delete(int OperationID) { try { TestimonialController ctl = new TestimonialController(); TestimonialInfo obj = ctl.GetImage(OperationID, GetPortalID, int.Parse(SageUserModuleID)); DeleteImage(obj.Image); ctl.DeleteRecordByID(OperationID); ShowMessage(SageMessageTitle.Information.ToString(), SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/Testimonial/ModuleLocalText", "RecordDeletedSuccessfully"), "", SageMessageType.Success); LoadRecordsOnGrid(); } catch (Exception e) { throw e; } }
private void LoadSetting() { try { TestimonialController clt = new TestimonialController(); TestimonialSettingInfo obj = new TestimonialSettingInfo(); obj = clt.GetSetting(GetPortalID, int.Parse(SageUserModuleID)); ActiveImage = obj.Image; NoOListToDisplay = obj.NoOfTestimonial; ActiveDate = obj.DateTime; ActiveViewMore = obj.ViewMore; } catch (Exception ex) { ProcessException(ex); } }
private void LoadSetting() { try { TestimonialController clt = new TestimonialController(); TestimonialSettingInfo obj = new TestimonialSettingInfo(); obj = clt.GetSetting(GetPortalID, int.Parse(SageUserModuleID)); txtNoOfList.Text = obj.NoOfTestimonial; chkImage.Checked = obj.Image; chkDateTime.Checked = obj.DateTime; chkViewMore.Checked = obj.ViewMore; } catch (Exception ex) { ProcessException(ex); } }
private void SaveSetting(string Key, string value, int UserModuleID, string AddedBy, string UpdatedBy, int PortalID) { TestimonialController obj = new TestimonialController(); obj.SaveSetting(Key, value, UserModuleID, AddedBy, UpdatedBy, PortalID); }
private void AddUpdateRecord() { string imagefile = string.Empty; TestimonialController clt = new TestimonialController(); TestimonialInfo obj = new TestimonialInfo(); if (Session["TestimonialID"] != null && Session["TestimonialID"].ToString() != string.Empty) { obj.TestimonialID = Int32.Parse(Session["TestimonialID"].ToString()); } else { obj.TestimonialID = 0; } obj.PortalID = GetPortalID; obj.UserModuleID = int.Parse(SageUserModuleID); obj.UserName = txtName.Text; obj.Address = txtAddress.Text; obj.WebUrl = txtWeburl.Text; obj.Title = txtTitle.Text; obj.Testimonial = txtTestimonial.Value; obj.AddedBy = GetUsername; obj.TestimonialDate = DateTime.Parse(txtDate.Text); string TargetFolder = Server.MapPath(basePath + "image/UploadedImages"); if (!Directory.Exists(TargetFolder)) { Directory.CreateDirectory(TargetFolder); } imagefile = ProfileImage.FileName.Replace(" ", "_"); if (Session["Image"] == null && imagefile == "") { obj.Image = ""; } else if (imagefile == "" && Session["Image"] != null) { obj.Image = Session["Image"].ToString(); } else { if (ProfileImage.HasFile) { System.Drawing.Image.GetThumbnailImageAbort thumbnailImageAbortDelegate = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback); obj.Image = imagefile; using (System.Drawing.Bitmap originalImage = new System.Drawing.Bitmap(ProfileImage.PostedFile.InputStream)) { using (System.Drawing.Image thumbnail = originalImage.GetThumbnailImage(250, 150, thumbnailImageAbortDelegate, IntPtr.Zero)) { thumbnail.Save(System.IO.Path.Combine(TargetFolder, imagefile)); } } } } clt.SaveRecord(obj); ShowMessage(SageMessageTitle.Information.ToString(), SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/Testimonial/ModuleLocalText", "SaveRecordSuccessfully"), "", SageMessageType.Success); LoadRecordsOnGrid(); divGrid.Visible = true; ClearField(); }
private void AddUpdateRecord() { string imagefile=string.Empty; TestimonialController clt = new TestimonialController(); TestimonialInfo obj = new TestimonialInfo(); if (Session["TestimonialID"] != null && Session["TestimonialID"].ToString() != string.Empty) { obj.TestimonialID = Int32.Parse(Session["TestimonialID"].ToString()); } else { obj.TestimonialID = 0; } obj.PortalID = GetPortalID; obj.UserModuleID = int.Parse(SageUserModuleID); obj.UserName = txtName.Text; obj.Address = txtAddress.Text; obj.WebUrl = txtWeburl.Text; obj.Title = txtTitle.Text; obj.Testimonial = txtTestimonial.Value; obj.AddedBy = GetUsername; obj.TestimonialDate = DateTime.Parse(txtDate.Text); string TargetFolder = Server.MapPath(basePath + "image/UploadedImages"); if (!Directory.Exists(TargetFolder)) { Directory.CreateDirectory(TargetFolder); } imagefile = ProfileImage.FileName.Replace(" ", "_"); if (Session["Image"] == null && imagefile == "") { obj.Image = ""; } else if (imagefile == "" && Session["Image"] != null) { obj.Image = Session["Image"].ToString(); } else { if (ProfileImage.HasFile) { System.Drawing.Image.GetThumbnailImageAbort thumbnailImageAbortDelegate = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback); obj.Image = imagefile; using (System.Drawing.Bitmap originalImage = new System.Drawing.Bitmap(ProfileImage.PostedFile.InputStream)) { using (System.Drawing.Image thumbnail = originalImage.GetThumbnailImage(250, 150, thumbnailImageAbortDelegate, IntPtr.Zero)) { thumbnail.Save(System.IO.Path.Combine(TargetFolder, imagefile)); } } } } clt.SaveRecord(obj); ShowMessage(SageMessageTitle.Information.ToString(), SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/Testimonial/ModuleLocalText", "SaveRecordSuccessfully"), "", SageMessageType.Success); LoadRecordsOnGrid(); divGrid.Visible = true; ClearField(); }
private void Edit(int OperationID) { try { TestimonialController ctl = new TestimonialController(); TestimonialInfo obj = ctl.GetRecordByID(OperationID,GetPortalID,int.Parse(SageUserModuleID)); txtName.Text = obj.UserName; txtAddress.Text = obj.Address; txtDate.Text = CommonHelper.ShortTimeReturn(obj.TestimonialDate); txtWeburl.Text = obj.WebUrl; txtTestimonial.Value = obj.Testimonial; Session["Image"] = obj.Image; Session["TestimonialID"] = obj.TestimonialID; if (obj.Image != "") { divImage.Visible = true; imgProfilepic.ImageUrl = basePath + "image/UploadedImages/" + obj.Image; } else { divImage.Visible = false; } ShowHidePage(); } catch (Exception e) { throw e; } }
private void LoadRecordsOnGrid() { try { TestimonialController clt = new TestimonialController(); List<TestimonialInfo> lstData = clt.LoadRecordsOnGrid(GetPortalID, int.Parse(SageUserModuleID)); gdvTestRecord.DataSource = lstData; gdvTestRecord.DataBind(); } catch (Exception e) { throw e; } }