Exemplo n.º 1
0
        public static List <DayCarePL.ChildDataProperties> GetChildList(Guid SchoolYearId)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clChildList, "LoadChildAttendanceHistoryList", "LoadChildAttendanceHistoryList method called", DayCarePL.Common.GUID_DEFAULT);
            clConnection.DoConnection();
            DayCareDataContext db = new DayCareDataContext();
            List <DayCarePL.ChildDataProperties> lstChildList = new List <DayCarePL.ChildDataProperties>();

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.clFamilyPayment, "LoadChildAttendanceHistoryList", "Debug LoadChildAttendanceHistoryList called", DayCarePL.Common.GUID_DEFAULT);
                DayCarePL.ChildDataProperties objChildList = null;
                var data = db.spGetChildList(SchoolYearId);
                foreach (var c in data)
                {
                    objChildList = new DayCarePL.ChildDataProperties();
                    objChildList.ChildSchoolYearId = c.Id;
                    objChildList.FullName          = c.ChildFullName;
                    objChildList.Photo             = c.Photo;
                    lstChildList.Add(objChildList);
                }
                return(lstChildList);
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.clChildProgEnrollment, "Save", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                return(null);
            }
        }
 protected void rgChildAttendsList_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
 {
     if (e.Item is GridPagerItem)
     {
         RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox");
         PageSizeCombo.Items.Clear();
         PageSizeCombo.Items.Add(new RadComboBoxItem("25"));
         PageSizeCombo.FindItemByText("25").Attributes.Add("ownerTableViewId", rgChildAttendsList.MasterTableView.ClientID);
         PageSizeCombo.Items.Add(new RadComboBoxItem("50"));
         PageSizeCombo.FindItemByText("50").Attributes.Add("ownerTableViewId", rgChildAttendsList.MasterTableView.ClientID);
         //PageSizeCombo.Items[0].Text = "25";
         //PageSizeCombo.Items[1].Text = "50";
         PageSizeCombo.FindItemByText(e.Item.OwnerTableView.PageSize.ToString()).Selected = true;
     }
     if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item)
     {
         DayCarePL.ChildDataProperties objChild = e.Item.DataItem as DayCarePL.ChildDataProperties;
         Image imgChild = e.Item.FindControl("imgChild") as Image;
         if (!string.IsNullOrEmpty(objChild.Photo))
         {
             imgChild.ImageUrl = "../ChildImages/" + objChild.Photo;
         }
         else
         {
             if (objChild.Gender == true)//true= Male
             {
                 imgChild.ImageUrl = "../ChildImages/boy.png";
             }
             else
             {
                 imgChild.ImageUrl = "../ChildImages/girl.png";
             }
         }
     }
 }
Exemplo n.º 3
0
        public static List <DayCarePL.ChildDataProperties> GetAllChildList(Guid SchoolId, Guid SchoolYearId)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clChildList, "GetAllChildList", "GetAllChildList method called", DayCarePL.Common.GUID_DEFAULT);
            clConnection.DoConnection();
            DayCareDataContext db = new DayCareDataContext();
            List <DayCarePL.ChildDataProperties> lstChild = new List <DayCarePL.ChildDataProperties>();

            DayCarePL.ChildDataProperties objChild = null;
            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.clChildList, "GetAllChildList", "Debug GetAllChildList called", DayCarePL.Common.GUID_DEFAULT);

                var data = db.spGetAllChildDataList(SchoolId, SchoolYearId);
                foreach (var d in data)
                {
                    objChild               = new DayCarePL.ChildDataProperties();
                    objChild.ChildDataId   = d.ChildDataId;
                    objChild.FullName      = d.ChildFullName;
                    objChild.ChildFamilyId = d.ChildFamilyId;
                    objChild.FamilyName    = d.FamilyFullName;
                    objChild.Email         = d.Email;
                    objChild.HomePhone     = d.HomePhone;
                    objChild.Photo         = d.Photo;
                    objChild.Active        = d.Active; // (bool) (db.ChildSchoolYears.FirstOrDefault(u=>u.SchoolYearId.Equals(SchoolYearId) && u.ChildDataId.Equals(d.ChildDataId))).active;
                    objChild.Gender        = d.Gender;
                    lstChild.Add(objChild);
                }
                return(lstChild);
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.clChildList, "GetAllChildList", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                return(null);
            }
        }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
0
        protected void rgChildData_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item)
            {
                DayCarePL.ChildDataProperties objChildData = e.Item.DataItem as DayCarePL.ChildDataProperties;
                Image     imgChild = e.Item.FindControl("imgPhoto") as Image;
                HyperLink hlChildEnrollmentStatus = e.Item.FindControl("hlChildEnrollmentStatus") as HyperLink;
                HyperLink hlChildAbsentHistory    = e.Item.FindControl("hlChildAbsentHistory") as HyperLink;
                HyperLink hlChildSchedule         = e.Item.FindControl("hlChildSchedule") as HyperLink;

                if (!string.IsNullOrEmpty(objChildData.Photo))
                {
                    imgChild.ImageUrl = "../ChildImages/" + objChildData.Photo;
                }
                else
                {
                    if (objChildData.Gender == true)
                    {
                        imgChild.ImageUrl = "../ChildImages/boy.png";
                    }
                    else
                    {
                        imgChild.ImageUrl = "../ChildImages/girl.png";
                    }
                }

                hlChildEnrollmentStatus.NavigateUrl = "ChildEnrollmentStatus.aspx?Id=" + objChildData.Id;
                hlChildAbsentHistory.NavigateUrl    = "ChildAbsentHistory.aspx?Id=" + objChildData.Id;
                // hlChildSchedule.NavigateUrl = "ChildSchedule.aspx?Id=" + objChildData.Id;
                hlChildSchedule.NavigateUrl = "ChildProgEnrollment.aspx?ChildDataId=" + objChildData.Id;
            }
        }
Exemplo n.º 6
0
        public static List <DayCarePL.ChildDataProperties> GetAllChildListForImport(Guid CurrentSchoolYearId, Guid PreSchoolYearId, Guid SchoolId)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clChildSchoolYear, "GetAllChildListForImport", "Execute GetAllChildListForImport Method", DayCarePL.Common.GUID_DEFAULT);
            clConnection.DoConnection();
            DayCareDataContext db = new DayCareDataContext();

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.clChildSchoolYear, "GetAllChildListForImport", "Debug GetAllChildListForImport Method", DayCarePL.Common.GUID_DEFAULT);
                var Data = db.spGetAllChildListForImport(CurrentSchoolYearId, PreSchoolYearId, SchoolId);
                DayCarePL.ChildDataProperties        objChildData;
                List <DayCarePL.ChildDataProperties> lstChildData = new List <DayCarePL.ChildDataProperties>();

                foreach (var d in Data)
                {
                    objChildData               = new DayCarePL.ChildDataProperties();
                    objChildData.ChildDataId   = d.ChildDataId;
                    objChildData.FullName      = d.FullName;
                    objChildData.FamilyName    = d.FamilyName;
                    objChildData.ChildFamilyId = d.ChildFamilyId;
                    objChildData.Active        = d.Active == null ? false : d.Active.Value;
                    objChildData.ImportedCount = d.ImportedCount == null ? 0 : d.ImportedCount.Value;
                    lstChildData.Add(objChildData);
                }
                return(lstChildData);;
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.clChildSchoolYear, "GetAllChildListForImport", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                return(new List <DayCarePL.ChildDataProperties>());
            }
        }
Exemplo n.º 7
0
        public static List <DayCarePL.ChildDataProperties> LoadChildData(Guid SchoolId, Guid SchoolYearId, Guid ChildFamilyId)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clChildData, "LoadChildData", "Execute LoadChildData Method", DayCarePL.Common.GUID_DEFAULT);
            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.clChildData, "LoadChildData", "Debug LoadChildData Method", DayCarePL.Common.GUID_DEFAULT);
                DayCarePL.ChildDataProperties        objChlidata  = null;
                List <DayCarePL.ChildDataProperties> lstChildData = new List <DayCarePL.ChildDataProperties>();
                SortedList sl = new SortedList();
                sl.Add("@SchoolID", SchoolId);
                sl.Add("@SchoolYearId", SchoolYearId);
                sl.Add("@ChildFamilyId", ChildFamilyId);
                DataSet ds = clConnection.GetDataSet("spGetChildDataList", sl);
                if (ds != null && ds.Tables.Count > 0)
                {
                    for (int iRow = 0; iRow < ds.Tables[0].Rows.Count; iRow++)
                    {
                        objChlidata               = new DayCarePL.ChildDataProperties();
                        objChlidata.Id            = new Guid(ds.Tables[0].Rows[iRow]["Id"].ToString());
                        objChlidata.ChildFamilyId = new Guid(ds.Tables[0].Rows[iRow]["ChildFamilyId"].ToString());
                        objChlidata.FirstName     = ds.Tables[0].Rows[iRow]["FirstName"].ToString();
                        objChlidata.LastName      = ds.Tables[0].Rows[iRow]["LastName"].ToString();
                        objChlidata.FullName      = objChlidata.FirstName + " " + objChlidata.LastName;
                        objChlidata.Gender        = Convert.ToBoolean(ds.Tables[0].Rows[iRow]["Gender"].ToString());
                        if (!string.IsNullOrEmpty(ds.Tables[0].Rows[iRow]["DOB"].ToString()))
                        {
                            objChlidata.DOB = Convert.ToDateTime(ds.Tables[0].Rows[iRow]["DOB"].ToString());
                        }
                        if (!string.IsNullOrEmpty(ds.Tables[0].Rows[iRow]["SocSec"].ToString()))
                        {
                            objChlidata.SocSec = ds.Tables[0].Rows[iRow]["SocSec"].ToString();
                        }
                        if (!string.IsNullOrEmpty(ds.Tables[0].Rows[iRow]["Photo"].ToString()))
                        {
                            objChlidata.Photo = ds.Tables[0].Rows[iRow]["Photo"].ToString();
                        }
                        if (!string.IsNullOrEmpty(ds.Tables[0].Rows[iRow]["Comments"].ToString()))
                        {
                            objChlidata.Comments = ds.Tables[0].Rows[iRow]["Comments"].ToString();
                        }
                        objChlidata.Active = Convert.ToBoolean(ds.Tables[0].Rows[iRow]["ChildSchoolYearActive"].ToString());
                        //objChlidata.FamilyName = ds.Tables[0].Rows[iRow]["FamilyName"].ToString();

                        lstChildData.Add(objChlidata);
                        objChlidata = null;
                    }
                }
                return(lstChildData);
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.clChildData, "LoadChildData", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                return(null);
            }
        }
Exemplo n.º 8
0
 protected void rgChildList_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
 {
     if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
     {
         CheckBox chkChildItem = e.Item.FindControl("chkChildItem") as CheckBox;
         DayCarePL.ChildDataProperties objChildList = e.Item.DataItem as DayCarePL.ChildDataProperties;
         if (objChildList.ImportedCount > 0)
         {
             chkChildItem.Enabled = false;
             chkChildItem.Checked = true;
             chkChildItem.ToolTip = "This child is imported!";
         }
     }
 }
Exemplo n.º 9
0
        protected void FillChildlist()
        {
            DayCarePL.ChildDataProperties        ChildDataProperties = new DayCarePL.ChildDataProperties();
            DayCareBAL.ChildListService          proxyChild          = new DayCareBAL.ChildListService();
            List <DayCarePL.ChildDataProperties> lstChild            = proxyChild.GetAllChildList(new Guid(Session["SchoolId"].ToString()), new Guid(Session["CurrentSchoolYearId"].ToString()));

            ChildDataProperties.ChildDataId = new Guid("00000000-0000-0000-0000-000000000000");
            ChildDataProperties.FullName    = "--Select All--";
            lstChild.Insert(0, ChildDataProperties);

            rcbchildList.DataSource     = lstChild;
            rcbchildList.DataTextField  = "FullName";
            rcbchildList.DataValueField = "ChildDataId";
            rcbchildList.DataBind();
            rcbchildList.EmptyMessage = "---Select---";
        }
Exemplo n.º 10
0
        protected void rgChildData_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item)
            {
                DayCarePL.ChildDataProperties objChildData = e.Item.DataItem as DayCarePL.ChildDataProperties;
                Image     imgChild = e.Item.FindControl("imgPhoto") as Image;
                HyperLink hlChildEnrollmentStatus = e.Item.FindControl("hlChildEnrollmentStatus") as HyperLink;
                HyperLink hlChildAbsentHistory    = e.Item.FindControl("hlChildAbsentHistory") as HyperLink;
                HyperLink hlChildSchedule         = e.Item.FindControl("hlChildSchedule") as HyperLink;

                if (!string.IsNullOrEmpty(objChildData.Photo))
                {
                    imgChild.ImageUrl = "../ChildImages/" + objChildData.Photo;
                }
                else
                {
                    if (objChildData.Gender == true)
                    {
                        imgChild.ImageUrl = "../ChildImages/boy.png";
                    }
                    else
                    {
                        imgChild.ImageUrl = "../ChildImages/girl.png";
                    }
                }

                hlChildEnrollmentStatus.NavigateUrl = "ChildEnrollmentStatus.aspx?Id=" + objChildData.Id;
                hlChildAbsentHistory.NavigateUrl    = "ChildAbsentHistory.aspx?Id=" + objChildData.Id;
                hlChildSchedule.NavigateUrl         = "ChildProgEnrollment.aspx?ChildDataId=" + objChildData.Id;
            }

            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
                RadUpload   upload      = userControl.FindControl("fupImage") as RadUpload;
                MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                MasterAjaxManager.ResponseScripts.Add(string.Format("window['UploadId'] = '{0}';", upload.ClientID));
            }
        }
        protected void FillCombo()
        {
            DayCareBAL.ChildAttendanceHistoryListService proxyChildList = new DayCareBAL.ChildAttendanceHistoryListService();
            DayCarePL.ChildDataProperties[]      result = proxyChildList.GetChildList(new Guid(Session["CurrentSchoolYearId"].ToString())).ToArray();
            List <DayCarePL.ChildDataProperties> data   = new List <DayCarePL.ChildDataProperties>();

            DayCarePL.ChildDataProperties Rec = new DayCarePL.ChildDataProperties();
            Rec.Id       = new Guid("00000000-0000-0000-0000-000000000000");
            Rec.FullName = "--Select All--";
            foreach (DayCarePL.ChildDataProperties d in result)
            {
                data.Add(d);
            }
            data.Insert(0, Rec);
            rcbStudentList.Items.Clear();
            rcbStudentList.DataSource    = data;
            rcbStudentList.DataTextField = "FullName";
            rcbStudentList.DataBind();
            rcbStudentList.EmptyMessage = "---Select---";
            //rcbStudentList.DataTextField = "FullName";
            //rcbStudentList.DataSource = proxyChildList.GetChildList(new Guid(Session["CurrentSchoolYearId"].ToString()));
            //rcbStudentList.DataBind();
        }
Exemplo n.º 12
0
        public static Guid Save(DayCarePL.ChildDataProperties objChildData)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clChildData, "Save", "Execute Save Method", DayCarePL.Common.GUID_DEFAULT);
            SqlConnection conn   = clConnection.CreateConnection();
            Guid          result = new Guid();

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.clChildData, "Save", "Debug Save Method", DayCarePL.Common.GUID_DEFAULT);
                clConnection.OpenConnection(conn);
                SqlCommand cmd;
                if (objChildData.Id.ToString().Equals(DayCarePL.Common.GUID_DEFAULT))
                {
                    cmd = clConnection.CreateCommand("spAddChildData", conn);
                    cmd.Parameters.Add(clConnection.GetInputParameter("@CreatedDateTime", DateTime.Now));
                    cmd.Parameters.Add(clConnection.GetInputParameter("@CreatedById", objChildData.CreatedById));
                    cmd.Parameters.Add(clConnection.GetInputParameter("@SchoolYearId", objChildData.ChildSchoolYearId));
                    //cmd.Parameters.Add(clConnection.GetInputParameter("@ChildDataId", objChildData.ChildDataId));
                }
                else
                {
                    cmd = clConnection.CreateCommand("spUpdateChildData", conn);
                }
                if (!objChildData.Id.ToString().Equals(DayCarePL.Common.GUID_DEFAULT))
                {
                    cmd.Parameters.Add(clConnection.GetInputParameter("@Id", objChildData.Id));
                }

                cmd.Parameters.Add(clConnection.GetInputParameter("@ChildFamilyId", objChildData.ChildFamilyId));
                cmd.Parameters.Add(clConnection.GetInputParameter("@FirstName", objChildData.FirstName));
                cmd.Parameters.Add(clConnection.GetInputParameter("@LastName", objChildData.LastName));
                cmd.Parameters.Add(clConnection.GetInputParameter("@Gender", objChildData.Gender));
                cmd.Parameters.Add(clConnection.GetInputParameter("@DOB", objChildData.DOB));
                cmd.Parameters.Add(clConnection.GetInputParameter("@SocSec", objChildData.SocSec));
                cmd.Parameters.Add(clConnection.GetInputParameter("@Photo", objChildData.Photo));
                cmd.Parameters.Add(clConnection.GetInputParameter("@Comments", objChildData.Comments));
                cmd.Parameters.Add(clConnection.GetInputParameter("@Active", objChildData.Active));
                cmd.Parameters.Add(clConnection.GetInputParameter("@LastModifiedById", objChildData.LastModifiedById));
                cmd.Parameters.Add(clConnection.GetInputParameter("@LastModifiedDateTime", DateTime.Now));
                cmd.Parameters.Add(clConnection.GetOutputParameter("@status", SqlDbType.Bit));
                if (objChildData.Id.ToString().Equals(DayCarePL.Common.GUID_DEFAULT))
                {
                    cmd.Parameters.Add(clConnection.GetOutputParameter("@Id", SqlDbType.UniqueIdentifier));
                }
                cmd.ExecuteNonQuery();
                if (Convert.ToBoolean(cmd.Parameters["@status"].Value))
                {
                    if (objChildData.Id.ToString().Equals(DayCarePL.Common.GUID_DEFAULT))
                    {
                        if (!cmd.Parameters["@Id"].Value.Equals(DayCarePL.Common.GUID_DEFAULT))
                        {
                            result = new Guid(cmd.Parameters["@Id"].Value.ToString());
                        }
                        else
                        {
                            result = new Guid(DayCarePL.Common.GUID_DEFAULT);
                        }
                    }
                    else
                    {
                        result = objChildData.Id;
                    }
                }
                else
                {
                    result = new Guid(DayCarePL.Common.GUID_DEFAULT);
                }
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.clChildData, "Save", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                result = new Guid(DayCarePL.Common.GUID_DEFAULT);
            }
            finally
            {
                clConnection.CloseConnection(conn);
            }
            return(result);
        }
Exemplo n.º 13
0
        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"));
            }
        }
Exemplo n.º 14
0
 public Guid Save(DayCarePL.ChildDataProperties objChildData)
 {
     return(DayCareDAL.clChilData.Save(objChildData));
 }