protected void LoadDataById(Guid ChildDataId, Guid SchoolId, Guid SchoolYearId) { DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.ChildData, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT); try { DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.ChildData, "SubmitRecord", "Debug Submit Record Of ChildData", DayCarePL.Common.GUID_DEFAULT); DayCareBAL.ChildDataService proxyChildData = new DayCareBAL.ChildDataService(); if (Session["SchoolId"] != null) { SchoolId = new Guid(Session["SchoolId"].ToString()); } DayCarePL.ChildDataProperties objChildDataId = proxyChildData.LoadChildDataId(ChildDataId, SchoolId, SchoolYearId); if (objChildDataId != null) { txtFirstName.Text = objChildDataId.FirstName; txtLastName.Text = objChildDataId.LastName; txtComments.Text = objChildDataId.Comments; txtSocSec.Text = objChildDataId.SocSec; rdpDOB.SelectedDate = objChildDataId.DOB; if (objChildDataId.Gender == true) { rdMale.Checked = true; } if (objChildDataId.Active == true) { chkActive.Checked = true; } } } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.ChildData, "LoadChildDataDetails", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); } }
protected void rgChildData_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { try { Guid SchoolId = new Guid(); if (Session["SchoolId"] != null) { SchoolId = new Guid(Session["SchoolId"].ToString()); } DayCareBAL.ChildDataService proxyChildData = new DayCareBAL.ChildDataService(); if (ViewState["ChildFamilyId"] != null) { List <DayCarePL.ChildDataProperties> lstChildData = proxyChildData.LoadChildData(new Guid(Session["SchoolId"].ToString()), new Guid(Session["CurrentSchoolYearId"].ToString()), new Guid(ViewState["ChildFamilyId"].ToString())); if (lstChildData != null) { rgChildData.DataSource = lstChildData; } } else { rgChildData.DataSource = new List <DayCarePL.ChildDataProperties>(); } // rgChildData.DataSource = proxyChildData.LoadChildData(new Guid(ViewState["SchoolId"].ToString()), new Guid(ViewState["SchoolYearId"].ToString())); } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.FamilyInfo, "rgChildData_NeedDataSource", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); } }
protected void btnSave_Click(object sender, EventArgs e) { DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.ChildData, "btnSave_Click", "Submit btnSave_Click called", DayCarePL.Common.GUID_DEFAULT); try { DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.ChildData, "btnSave_Click", "Debug btnSave_Click ", DayCarePL.Common.GUID_DEFAULT); DayCareBAL.ChildDataService proxyChildData = new DayCareBAL.ChildDataService(); DayCarePL.ChildDataProperties objChildData = new DayCarePL.ChildDataProperties(); Guid ChildDataId; if (ViewState["ChildId"] != null) { objChildData.Id = new Guid(ViewState["ChildId"].ToString()); } if (fupImage.HasFile) { string Extention = Path.GetExtension(fupImage.FileName).ToLower(); string[] Ext = { ".jpeg", ".jpg", ".png" }; if (Ext.ToList().FindAll(et => et.Equals(Extention)).Count == 0) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Please select .JPEG,.PNG file!", "false")); return; } } if (ViewState["ChildFamilyId"] != null) { objChildData.ChildFamilyId = new Guid(ViewState["ChildFamilyId"].ToString()); objChildData.ChildSchoolYearId = new Guid(Session["CurrentSchoolYearId"].ToString()); if (Session["StaffId"] != null) { objChildData.LastModifiedById = new Guid(Session["StaffId"].ToString()); objChildData.CreatedById = new Guid(Session["StaffId"].ToString()); } } else { } objChildData.FirstName = txtFirstName.Text.Trim(); objChildData.LastName = txtLastName.Text.Trim(); if (rdMale.Checked == true) { objChildData.Gender = true; } else { objChildData.Gender = false; } objChildData.DOB = Convert.ToDateTime(rdpDOB.SelectedDate.ToString()); objChildData.SocSec = txtSocSec.Text.Trim(); if (fupImage.HasFile) { objChildData.Photo = Path.GetExtension(fupImage.FileName); } else { objChildData.Photo = string.Empty; } objChildData.Comments = txtComments.Text.Trim(); if (chkActive.Checked == true) { objChildData.Active = true; } else { objChildData.Active = false; } //if (proxyChildData.Save(objChildData)) ChildDataId = proxyChildData.Save(objChildData); if (!ChildDataId.ToString().Equals(DayCarePL.Common.GUID_DEFAULT)) { if (fupImage.HasFile) { string strFile = Server.MapPath("~/ChildImages/" + ChildDataId + Path.GetExtension(fupImage.FileName)); if (System.IO.File.Exists(strFile)) { System.IO.File.SetAttributes(strFile, FileAttributes.Normal); System.IO.File.Delete(strFile); } fupImage.SaveAs(Server.MapPath("~/ChildImages/" + ChildDataId + Path.GetExtension(fupImage.FileName))); } rgChildData.MasterTableView.Rebind(); txtFirstName.Text = ""; txtLastName.Text = ""; txtComments.Text = ""; txtSocSec.Text = ""; rdpDOB.SelectedDate = null; MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false")); } else { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Internal Error,Please try again.", "false")); } } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.ChildData, "btnSave_Click", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Internal Error,Please try again.", "false")); } }