Ejemplo n.º 1
0
        public bool SubmitRecord(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clAbsentReason, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT);
            bool result = false;

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clAbsentReason, "SubmitRecord", "Debug Submit record method called of AbsentReason", DayCarePL.Common.GUID_DEFAULT);
                DayCareBAL.StaffAttendanceHistoryListService proxySave          = new DayCareBAL.StaffAttendanceHistoryListService();
                DayCarePL.StaffAttendenceHistoryProperties   objStaffAttendance = new DayCarePL.StaffAttendenceHistoryProperties();

                Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)e.Item;

                var InsertItem = e.Item as Telerik.Web.UI.GridEditableItem;
                Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager;

                if (InsertItem != null)
                {
                    foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
                    {
                        if (column is IGridEditableColumn)
                        {
                            IGridEditableColumn editableCol = (column as IGridEditableColumn);
                            if (editableCol.IsEditable)
                            {
                                IGridColumnEditor editor = editMan.GetColumnEditor(editableCol);
                                switch (column.UniqueName)
                                {
                                case "CheckInCheckOutDateTime":
                                {
                                    objStaffAttendance.CheckInCheckOutDateTime = Convert.ToDateTime((e.Item.FindControl("rdpCheckInCheckOutDateTime") as RadDatePicker).SelectedDate);
                                    break;
                                }

                                case "CheckInTime":
                                {
                                    if ((e.Item.FindControl("rtpCheckInTime") as RadTimePicker).SelectedDate != null)
                                    {
                                        objStaffAttendance.CheckInTime = Convert.ToDateTime((e.Item.FindControl("rtpCheckInTime") as RadTimePicker).SelectedDate);
                                    }
                                    break;
                                }

                                case "CheckOutTime":
                                {
                                    if ((e.Item.FindControl("rtpCheckOutTime") as RadTimePicker).SelectedDate != null)
                                    {
                                        objStaffAttendance.CheckOutTime = Convert.ToDateTime((e.Item.FindControl("rtpCheckOutTime") as RadTimePicker).SelectedDate);
                                    }
                                    break;
                                }
                                    //case "StaffSchoolYearId":
                                    //    {
                                    //        objStaffAttendance.StaffSchoolYearId = new Guid((editor as GridTextBoxColumnEditor).Text.Trim());
                                    //        break;
                                    //    }
                                }
                            }
                        }
                    }
                    if (objStaffAttendance.CheckInTime != null)
                    {
                        objStaffAttendance.CheckInCheckOutDateTime = objStaffAttendance.CheckInCheckOutDateTime + objStaffAttendance.CheckInTime.Value.TimeOfDay;
                        objStaffAttendance.CheckInCheckOut         = true;
                    }
                    if (objStaffAttendance.CheckOutTime != null)
                    {
                        objStaffAttendance.CheckInCheckOutDateTime = objStaffAttendance.CheckInCheckOutDateTime + objStaffAttendance.CheckOutTime.Value.TimeOfDay;
                        objStaffAttendance.CheckInCheckOut         = false;
                    }
                    if (objStaffAttendance.CheckInTime == null && objStaffAttendance.CheckOutTime == null)
                    {
                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Please select check in or check out time", "false"));
                        result = false;
                    }
                    else if (objStaffAttendance.CheckInTime != null && objStaffAttendance.CheckOutTime != null)
                    {
                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Please select check in or check out time", "false"));
                        result = false;
                    }
                    else
                    {
                        if (ViewState["StaffSchoolYearId"] != null)
                        {
                            objStaffAttendance.StaffSchoolYearId = new Guid(ViewState["StaffSchoolYearId"].ToString());
                        }

                        if (e.CommandName != "PerformInsert")
                        {
                            objStaffAttendance.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());
                        }
                        if (proxySave.Save(objStaffAttendance))
                        {
                            MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                            MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false"));
                            result = true;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.AbsentReason, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                result = false;
            }
            return(result);
        }
Ejemplo n.º 2
0
        public bool SubmitRecord(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.ClassRoom, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT);
            bool result = false;

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.ClassRoom, "SubmitRecord", " Debug Submit record method called of ClassRoom", DayCarePL.Common.GUID_DEFAULT);

                DayCareBAL.ClassRoomService   proxySave    = new DayCareBAL.ClassRoomService();
                DayCarePL.ClassRoomProperties objClassRoom = new DayCarePL.ClassRoomProperties();

                Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)e.Item;
                var InsertItem = e.Item as Telerik.Web.UI.GridEditableItem;
                Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager;

                if (InsertItem != null)
                {
                    foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
                    {
                        if (column is IGridEditableColumn)
                        {
                            IGridEditableColumn editableCol = (column as IGridEditableColumn);
                            if (editableCol.IsEditable)
                            {
                                IGridColumnEditor editor = editMan.GetColumnEditor(editableCol);
                                switch (column.UniqueName)
                                {
                                case "Name":
                                {
                                    objClassRoom.Name = (editor as GridTextBoxColumnEditor).Text.Trim().ToString();
                                    ViewState["Name"] = objClassRoom.Name;
                                    break;
                                }

                                case "MaxSize":
                                {
                                    if (!string.IsNullOrEmpty((e.Item.FindControl("txtMaxSize") as TextBox).Text))
                                    {
                                        objClassRoom.MaxSize = Convert.ToInt32((e.Item.FindControl("txtMaxSize") as TextBox).Text);
                                        ViewState["MaxSize"] = objClassRoom.MaxSize;
                                    }
                                    else
                                    {
                                        objClassRoom.MaxSize = 0;
                                    }
                                    break;
                                }

                                case "Active":
                                {
                                    objClassRoom.Active = (editor as GridCheckBoxColumnEditor).Value;
                                    break;
                                }

                                case "FullName":
                                {
                                    objClassRoom.StaffId = new Guid((e.Item.FindControl("ddlStaff") as DropDownList).SelectedValue);
                                    break;
                                }
                                }
                            }
                        }
                    }
                    if (Session["SchoolId"] != null)
                    {
                        objClassRoom.SchoolId = new Guid(Session["SchoolId"].ToString());
                    }
                    if (e.CommandName != "PerformInsert")
                    {
                        if (Session["StaffId"] != null)
                        {
                            objClassRoom.LastModifiedById = new Guid(Session["StaffId"].ToString());
                        }
                        objClassRoom.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());
                        // objClassRoom.StaffId = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["FullName"].ToString());
                        if (!objClassRoom.Id.ToString().Equals(hdnName.Value.Trim()))
                        {
                            //  bool ans = Common.CheckDuplicate("ClassRoom", "Name", objClassRoom.Name, "update", objClassRoom.Id.ToString());
                            bool ans = proxySave.CheckDuplicateClassRoomName(objClassRoom.Name, objClassRoom.Id, objClassRoom.SchoolId, objClassRoom.StaffId.Value, new Guid(Session["CurrentSchoolYearId"].ToString()));

                            if (ans)
                            {
                                MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                                MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false"));
                                return(false);
                            }
                        }
                    }
                    else
                    {
                        // bool ans = Common.CheckDuplicate("ClassRoom", "Name", objClassRoom.Name, "insert", objClassRoom.Id.ToString());
                        bool ans = proxySave.CheckDuplicateClassRoomName(objClassRoom.Name, objClassRoom.Id, objClassRoom.SchoolId, objClassRoom.StaffId.Value, new Guid(Session["CurrentSchoolYearId"].ToString()));
                        if (ans)
                        {
                            MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                            MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false"));
                            return(false);
                        }
                    }
                    hdnName.Value = "";
                    //result = proxySave.Save(objClassRoom);
                    if (Session["StaffId"] == null)
                    {
                        Response.Redirect("~/Login.aspx");
                    }
                    else
                    {
                        objClassRoom.LastModifiedById = new Guid(Session["StaffId"].ToString());
                    }

                    result = proxySave.SaveClassRoomYearWise(objClassRoom, new Guid(Session["CurrentSchoolYearId"].ToString()));

                    if (result == true)
                    {
                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false"));
                    }
                }
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.ClassRoom, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                result = false;
            }
            return(result);
        }
Ejemplo n.º 3
0
        public bool SubmitRecord(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.Font, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT);
            bool   result   = false;
            string FontSize = "";

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.Font, "SubmitRecord", " Debug Submit record method called of Font", DayCarePL.Common.GUID_DEFAULT);

                DayCareBAL.FontService   proxySave = new DayCareBAL.FontService();
                DayCarePL.FontProperties objFont   = new DayCarePL.FontProperties();

                Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)e.Item;
                var InsertItem = e.Item as Telerik.Web.UI.GridEditableItem;
                Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager;

                if (InsertItem != null)
                {
                    foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
                    {
                        if (column is IGridEditableColumn)
                        {
                            IGridEditableColumn editableCol = (column as IGridEditableColumn);
                            if (editableCol.IsEditable)
                            {
                                IGridColumnEditor editor = editMan.GetColumnEditor(editableCol);
                                switch (column.UniqueName)
                                {
                                case "Name":
                                {
                                    objFont.Name      = (editor as GridTextBoxColumnEditor).Text.Trim().ToString();
                                    ViewState["Name"] = objFont.Name;
                                    break;
                                }

                                case "Color":
                                {
                                    //objFont.Color=(e.Item.FindControl("rcpColor") as RadColorPicker ).
                                    if ((e.Item.FindControl("rcpColor") as RadColorPicker) != null && (e.Item.FindControl("rcpColor") as RadColorPicker).SelectedColor.Name != "0")
                                    {
                                        objFont.Color = "#" + (e.Item.FindControl("rcpColor") as RadColorPicker).SelectedColor.Name;
                                    }

                                    break;
                                }

                                case "Size":
                                {
                                    FontSize = (e.Item.FindControl("txtSize") as TextBox).Text.Trim();
                                    //objFont.Size = Convert.ToInt32((e.Item.FindControl("txtSize") as TextBox).Text.Trim());
                                    ViewState["Size"] = objFont.Size;
                                    break;
                                }

                                case "Active":
                                {
                                    objFont.Active = (editor as GridCheckBoxColumnEditor).Value;
                                    break;
                                }
                                }
                            }
                        }
                    }
                    int res = 0;
                    Int32.TryParse(FontSize, out res);
                    if (res == 0)
                    {
                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Font size must be numeric.", "false"));
                        return(false);
                    }
                    else
                    {
                        objFont.Size = Convert.ToInt32(FontSize);
                    }
                    if (string.IsNullOrEmpty(objFont.Color))
                    {
                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Please select color.", "false"));
                        return(false);
                    }
                    if (e.CommandName != "PerformInsert")
                    {
                        //objFont.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());
                        objFont.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());
                        if (!objFont.Name.Trim().Equals(hdnName.Value.Trim()))
                        {
                            bool ans = Common.CheckDuplicate("Font", "Name", objFont.Name, "update", objFont.Id.ToString());
                            if (ans)
                            {
                                MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                                MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false"));
                                return(false);
                            }
                        }
                    }
                    else
                    {
                        bool ans = Common.CheckDuplicate("Font", "Name", objFont.Name, "insert", objFont.Id.ToString());
                        if (ans)
                        {
                            MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                            MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false"));
                            return(false);
                        }
                    }
                    hdnName.Value = "";
                    result        = proxySave.Save(objFont);
                    if (result == true)
                    {
                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false"));
                    }
                }
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.Font, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                result = false;
            }
            return(result);
        }
Ejemplo n.º 4
0
        public bool SubmitRecord(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.EnrollmentStatus, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT);
            bool result = false;

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.EnrollmentStatus, "SubmitRecord", " Debug Submit record method called of Enrollmentstatus", DayCarePL.Common.GUID_DEFAULT);

                DayCareBAL.EnrollmentStausService    proxySave     = new DayCareBAL.EnrollmentStausService();
                DayCarePL.EnrollmentStatusProperties objEnrollment = new DayCarePL.EnrollmentStatusProperties();

                Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)e.Item;
                var InsertItem = e.Item as Telerik.Web.UI.GridEditableItem;
                Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager;

                if (InsertItem != null)
                {
                    foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
                    {
                        if (column is IGridEditableColumn)
                        {
                            IGridEditableColumn editableCol = (column as IGridEditableColumn);
                            if (editableCol.IsEditable)
                            {
                                IGridColumnEditor editor = editMan.GetColumnEditor(editableCol);
                                switch (column.UniqueName)
                                {
                                case "Status":
                                {
                                    objEnrollment.Status = (editor as GridTextBoxColumnEditor).Text.Trim().ToString();
                                    ViewState["Staus"]   = objEnrollment.Status;
                                    break;
                                }

                                case "Active":
                                {
                                    objEnrollment.Active = (editor as GridCheckBoxColumnEditor).Value;
                                    break;
                                }

                                case "Comments":
                                {
                                    objEnrollment.Comments = (e.Item.FindControl("txtComments") as TextBox).Text.Trim().ToString();
                                    ViewState["Comments"]  = objEnrollment.Comments;
                                    break;
                                }
                                }
                            }
                        }
                    }
                    if (Session["SchoolId"] != null)
                    {
                        objEnrollment.SchoolId = new Guid(Session["SchoolId"].ToString());
                    }
                    if (e.CommandName != "PerformInsert")
                    {
                        objEnrollment.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());
                        if (!objEnrollment.Id.ToString().Equals(hdnName.Value.Trim()))
                        {
                            bool ans = proxySave.CheckDuplicateEnrollmentStatusName(objEnrollment.Status, objEnrollment.Id, objEnrollment.SchoolId);
                            if (ans)
                            {
                                MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                                MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false"));
                                return(false);
                            }
                        }
                    }
                    else
                    {
                        bool ans = proxySave.CheckDuplicateEnrollmentStatusName(objEnrollment.Status, objEnrollment.Id, objEnrollment.SchoolId);
                        if (ans)
                        {
                            MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                            MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false"));
                            return(false);
                        }
                    }
                    hdnName.Value = "";
                    result        = proxySave.Save(objEnrollment);
                    if (result == true)
                    {
                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false"));
                    }
                }
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.EnrollmentStatus, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                result = false;
            }
            return(result);
        }
Ejemplo n.º 5
0
        public bool SubmitRecord(object sender, GridCommandEventArgs e)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.ChildAbsentHistory, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT);
            bool result = false;

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.ChildAbsentHistory, "SubmitRecord", "Debug Submit Record Of SchoolYear", DayCarePL.Common.GUID_DEFAULT);
                DayCareBAL.ChildAbsentHistoryService   proxyChildAbsentHistory = new DayCareBAL.ChildAbsentHistoryService();
                DayCarePL.ChildAbsentHistoryProperties objChildAbsentHistory   = new DayCarePL.ChildAbsentHistoryProperties();

                GridDataItem item       = (GridDataItem)e.Item;
                var          InsertItem = e.Item as Telerik.Web.UI.GridEditableItem;

                Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager;

                if (InsertItem != null)
                {
                    foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
                    {
                        if (column is GridEditableColumn)
                        {
                            IGridEditableColumn editTableColumn = (column as IGridEditableColumn);

                            if (editTableColumn.IsEditable)
                            {
                                IGridColumnEditor editor = editMan.GetColumnEditor(editTableColumn);

                                switch (column.UniqueName)
                                {
                                case "AbsentReason":
                                {
                                    objChildAbsentHistory.AbsentReasonId = new Guid((item["AbsentReason"].Controls[1] as DropDownList).SelectedValue);
                                    break;
                                }

                                case "StartDate":
                                {
                                    if ((e.Item.FindControl("rdpStartDate") as RadDatePicker).SelectedDate != null)
                                    {
                                        objChildAbsentHistory.StartDate = (e.Item.FindControl("rdpStartDate") as RadDatePicker).SelectedDate.Value;
                                    }
                                    break;
                                }

                                case "EndDate":
                                {
                                    if ((e.Item.FindControl("rdpEndDate") as RadDatePicker).SelectedDate != null)
                                    {
                                        objChildAbsentHistory.EndDate = (e.Item.FindControl("rdpEndDate") as RadDatePicker).SelectedDate.Value;
                                    }

                                    break;
                                }

                                case "Comment":
                                {
                                    objChildAbsentHistory.Comments = (e.Item.FindControl("txtComment") as TextBox).Text;
                                    break;
                                }
                                }
                            }
                        }
                    }
                    if (objChildAbsentHistory.StartDate != null && objChildAbsentHistory.EndDate != null)
                    {
                        if (objChildAbsentHistory.StartDate > objChildAbsentHistory.EndDate)
                        {
                            MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                            MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Start Date must be less than End Date.", "false"));
                            return(false);
                        }
                    }
                    if (ViewState["ChildSchoolYearId"] != null)
                    {
                        objChildAbsentHistory.ChildSchoolYearId = new Guid(ViewState["ChildSchoolYearId"].ToString());
                    }
                    if (e.CommandName != "PerformInsert")
                    {
                        if (Session["StaffId"] != null)
                        {
                            objChildAbsentHistory.LastModifiedById = new Guid(Session["StaffId"].ToString());
                        }
                        objChildAbsentHistory.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());
                    }
                    else
                    {
                        if (Session["StaffId"] != null)
                        {
                            objChildAbsentHistory.CreatedById = new Guid(Session["StaffId"].ToString());
                        }
                    }
                    result = proxyChildAbsentHistory.Save(objChildAbsentHistory);
                    if (result)
                    {
                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false"));
                    }
                }
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.ChildAbsentHistory, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                result = false;
            }
            return(result);
        }
Ejemplo n.º 6
0
        public bool SubmitRecord(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.ChildEnrollmentStatus, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT);
            bool result = false;

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.ChildEnrollmentStatus, "SubmitRecord", " Debug Submit record method called of ChildEnrollmentStatus", DayCarePL.Common.GUID_DEFAULT);
                DayCareBAL.ChildEnrollmentStatusService   proxyChildEnrollmentStatus = new DayCareBAL.ChildEnrollmentStatusService();
                DayCarePL.ChildEnrollmentStatusProperties objChildEnrollmentStatus   = new DayCarePL.ChildEnrollmentStatusProperties();

                GridDataItem item       = (GridDataItem)e.Item;
                var          InsertItem = e.Item as Telerik.Web.UI.GridEditableItem;

                Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager;

                if (InsertItem != null)
                {
                    foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
                    {
                        if (column is GridEditableColumn)
                        {
                            IGridEditableColumn editTableColumn = (column as IGridEditableColumn);

                            if (editTableColumn.IsEditable)
                            {
                                IGridColumnEditor editor = editMan.GetColumnEditor(editTableColumn);

                                switch (column.UniqueName)
                                {
                                case "Enrollmentstatus":
                                {
                                    objChildEnrollmentStatus.EnrollmentStatusId = new Guid((e.Item.FindControl("ddlEnrollmentStatus") as DropDownList).SelectedValue);
                                    break;
                                }

                                case "EnrollmentDate":
                                {
                                    objChildEnrollmentStatus.EnrollmentDate = Convert.ToDateTime((e.Item.FindControl("rdpEnrollmentDate") as RadDatePicker).SelectedDate);
                                    break;
                                }

                                case "Comments":
                                {
                                    objChildEnrollmentStatus.Comments = (e.Item.FindControl("txtComments") as TextBox).Text;
                                    break;
                                }
                                }
                            }
                        }
                    }
                    if (e.CommandName != "PerformInsert")
                    {
                        if (Session["StaffId"] != null)
                        {
                            objChildEnrollmentStatus.LastModifiedById = new Guid(Session["StaffId"].ToString());
                        }
                        objChildEnrollmentStatus.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());
                    }
                    hdnName.Value = "";
                    Guid ChildSchoolYearId = Common.GetChildSchoolYearId(new Guid(ViewState["ChildDataId"].ToString()), new Guid(Session["CurrentSchoolYearId"].ToString()));
                    objChildEnrollmentStatus.ChildSchoolYearId = ChildSchoolYearId;
                    if (Session["StaffId"] != null)
                    {
                        objChildEnrollmentStatus.CreatedById = new Guid(Session["StaffId"].ToString());
                    }
                    if (objChildEnrollmentStatus.EnrollmentStatusId != null && objChildEnrollmentStatus.EnrollmentDate != null)
                    {
                        bool check = proxyChildEnrollmentStatus.CheckDuplicateChildEnrollmentStatus(ChildSchoolYearId, objChildEnrollmentStatus.EnrollmentStatusId.Value, objChildEnrollmentStatus.EnrollmentDate.Value, objChildEnrollmentStatus.Id);
                        if (check == false)
                        {
                            result = proxyChildEnrollmentStatus.Save(objChildEnrollmentStatus);
                            if (result == true)
                            {
                                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}')", "Already Assigned", "false"));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.ChildEnrollmentStatus, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                result = false;
            }
            return(result);
        }
Ejemplo n.º 7
0
        public bool SubmitRecord(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.ClassRoom, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT);
            bool result = false;
            Guid Id;

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.ClassRoom, "SubmitRecord", " Debug Submit record method called of ClassRoom", DayCarePL.Common.GUID_DEFAULT);

                DayCareBAL.SchoolProgramService   proxySchoolProgram = new DayCareBAL.SchoolProgramService();
                DayCarePL.SchoolProgramProperties objSchoolProgram   = new DayCarePL.SchoolProgramProperties();

                GridDataItem item       = (GridDataItem)e.Item;
                var          InsertItem = e.Item as Telerik.Web.UI.GridEditableItem;

                Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager;

                if (InsertItem != null)
                {
                    foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
                    {
                        if (column is GridEditableColumn)
                        {
                            IGridEditableColumn editTableColumn = (column as IGridEditableColumn);

                            if (editTableColumn.IsEditable)
                            {
                                IGridColumnEditor editor = editMan.GetColumnEditor(editTableColumn);

                                switch (column.UniqueName)
                                {
                                case "Title":
                                {
                                    objSchoolProgram.Title = (e.Item.FindControl("txtTitle") as TextBox).Text;
                                    break;
                                }
                                //case "Fees":
                                //    {
                                //        objSchoolProgram.Fees = Convert.ToDouble((e.Item.FindControl("txtFees") as TextBox).Text);
                                //        break;
                                //    }
                                //case "FeesPeriodName":
                                //    {

                                //        objSchoolProgram.FeesPeriodId = new Guid((e.Item.FindControl("ddlFeesPeriodName") as DropDownList).SelectedValue);
                                //        break;
                                //    }
                                case "Comments":
                                {
                                    objSchoolProgram.Comments = (e.Item.FindControl("txtComments") as TextBox).Text;
                                    break;
                                }

                                case "Active":
                                {
                                    objSchoolProgram.Active = (editor as GridCheckBoxColumnEditor).Value;
                                    break;
                                }

                                case "IsPrimary":
                                {
                                    objSchoolProgram.IsPrimary = (editor as GridCheckBoxColumnEditor).Value;
                                    break;
                                }
                                }
                            }
                        }
                    }

                    if (Session["CurrentSchoolYearId"] != null)
                    {
                        objSchoolProgram.SchoolYearId = new Guid(Session["CurrentSchoolYearId"].ToString());
                    }
                    if (e.CommandName != "PerformInsert")
                    {
                        if (Session["StaffId"] != null)
                        {
                            objSchoolProgram.LastModifiedById = new Guid(Session["StaffId"].ToString());
                        }
                        objSchoolProgram.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());
                    }
                    else
                    {
                        if (Session["StaffId"] != null)
                        {
                            objSchoolProgram.CreatedById = new Guid(Session["StaffId"].ToString());
                        }
                    }
                    if (!lblName.Text.ToLower().Equals(objSchoolProgram.Title.ToLower()))
                    {
                        Guid SchoolId = new Guid();
                        if (Session["SchoolId"] != null)
                        {
                            SchoolId = new Guid(Session["SchoolId"].ToString());
                        }

                        if (proxySchoolProgram.CheckDuplicateSchoolProgramName(objSchoolProgram.Title, SchoolId))
                        {
                            MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                            MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Title already exists", "false"));
                            return(false);
                        }
                    }
                    lblName.Text = "";
                    //result = proxySchoolProgram.Save(objSchoolProgram);
                    Id = proxySchoolProgram.Save(objSchoolProgram);
                    if (!Id.ToString().Equals(DayCarePL.Common.GUID_DEFAULT))
                    {
                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false"));
                    }
                }
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.HoursOfOperation, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                result = false;
            }
            return(result);
        }
Ejemplo n.º 8
0
        public bool SubmitRecord(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.ClassRoom, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT);
            bool result = false;

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.ClassRoom, "SubmitRecord", " Debug Submit record method called of ClassRoom", DayCarePL.Common.GUID_DEFAULT);

                DayCareBAL.ProgScheduleService   proxyProgSchedule = new DayCareBAL.ProgScheduleService();
                DayCarePL.ProgScheduleProperties objProgSchedule   = new DayCarePL.ProgScheduleProperties();

                GridDataItem item       = (GridDataItem)e.Item;
                var          InsertItem = e.Item as Telerik.Web.UI.GridEditableItem;

                Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager;

                if (InsertItem != null)
                {
                    foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
                    {
                        if (column is GridEditableColumn)
                        {
                            IGridEditableColumn editTableColumn = (column as IGridEditableColumn);

                            if (editTableColumn.IsEditable)
                            {
                                IGridColumnEditor editor = editMan.GetColumnEditor(editTableColumn);

                                switch (column.UniqueName)
                                {
                                case "SchoolProgram":
                                {
                                    objProgSchedule.SchoolProgramId = new Guid(ViewState["SchoolProgramId"].ToString());
                                    break;
                                }

                                case "Day":
                                {
                                    objProgSchedule.Day      = (item["Day"].Controls[1] as DropDownList).SelectedItem.ToString();
                                    objProgSchedule.DayIndex = Convert.ToInt32((item["Day"].Controls[1] as DropDownList).SelectedValue);
                                    break;
                                }

                                case "BeginTime":
                                {
                                    if ((e.Item.FindControl("rdBiginTp") as RadTimePicker).SelectedDate != null)
                                    {
                                        objProgSchedule.BeginTime = (e.Item.FindControl("rdBiginTp") as RadTimePicker).SelectedDate;
                                    }
                                    break;
                                }

                                case "CloseTime":
                                {
                                    if ((e.Item.FindControl("rdCloseTp") as RadTimePicker).SelectedDate != null)
                                    {
                                        objProgSchedule.EndTime = (e.Item.FindControl("rdCloseTp") as RadTimePicker).SelectedDate;
                                    }
                                    break;
                                }

                                case "Active":
                                {
                                    objProgSchedule.Active = (editor as GridCheckBoxColumnEditor).Value;
                                    break;
                                }

                                case "ProgClassRoom":
                                {
                                    objProgSchedule.ProgClassRoomId = new Guid((item["ProgClassRoom"].Controls[1] as DropDownList).SelectedValue);
                                    DayCareBAL.ProgClassRoomService proxyClassroom = new DayCareBAL.ProgClassRoomService();
                                    objProgSchedule.ClassRoomId = proxyClassroom.LoadProgClassRoom(new Guid(Session["SchoolId"].ToString()), new Guid(ViewState["SchoolProgramId"].ToString())).FirstOrDefault(u => u.Id.Equals(objProgSchedule.ProgClassRoomId)).ClassRoomId.Value;
                                    break;
                                }
                                }
                            }
                        }
                    }
                    if (objProgSchedule.BeginTime != null && objProgSchedule.EndTime != null)
                    {
                        if (objProgSchedule.BeginTime > objProgSchedule.BeginTime)
                        {
                            MasterAjaxManager = this.Page.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                            MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Begin Time must be less than End Time.", "false"));
                            return(false);
                        }
                    }
                    else
                    {
                        MasterAjaxManager = this.Page.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Begin Time/End Time is not valid.", "false"));
                        return(false);
                    }



                    if (e.CommandName != "PerformInsert")
                    {
                        if (Session["StaffId"] != null)
                        {
                            objProgSchedule.LastModifiedById = new Guid(Session["StaffId"].ToString());
                        }
                        objProgSchedule.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());
                    }
                    else
                    {
                        if (Session["StaffId"] != null)
                        {
                            objProgSchedule.CreatedById      = new Guid(Session["StaffId"].ToString());
                            objProgSchedule.LastModifiedById = new Guid(Session["StaffId"].ToString());
                        }
                    }
                    DropDownList ddlClassRoom = e.Item.FindControl("ddlProgClassRoom") as DropDownList;
                    if (ddlClassRoom.SelectedIndex == 0)
                    {
                        MasterAjaxManager = this.Page.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Select ClassRoom.", "false"));
                        return(false);
                    }
                    else
                    {
                        hdnName.Value = "";
                        DayCarePL.ProgScheduleProperties objCheck  = proxyProgSchedule.CheckDuplicateProgClassRoom(objProgSchedule.ClassRoomId, Convert.ToDateTime(objProgSchedule.BeginTime), Convert.ToDateTime(objProgSchedule.EndTime), Convert.ToInt32(objProgSchedule.DayIndex), objProgSchedule.Id);
                        DayCarePL.ProgScheduleProperties objResult = proxyProgSchedule.CheckBeginTimeAndEndTime(new Guid(Session["SchoolId"].ToString()), objProgSchedule.DayIndex, Convert.ToDateTime(objProgSchedule.BeginTime), Convert.ToDateTime(objProgSchedule.EndTime));
                        if (objResult == null)
                        {
                            MasterAjaxManager = this.Page.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                            MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "BeginTime And EndTime Does not Match  Hours Of Opration OpenTime And CloseTime", "false"));
                            return(false);
                        }
                        if (objCheck != null)
                        {
                            MasterAjaxManager = this.Page.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                            MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "" + objCheck.SchoolProgramTitle + " (program) already assigned to " + objCheck.ProgClassRoomTitle + " (class room) from " + Convert.ToDateTime(objCheck.BeginTime).ToShortTimeString() + "  to  " + Convert.ToDateTime(objCheck.EndTime).ToShortTimeString() + ".", "false"));
                            return(false);
                        }
                        else
                        {
                            result = proxyProgSchedule.Save(objProgSchedule);
                            if (result == true)
                            {
                                MasterAjaxManager = this.Page.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                                MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false"));
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.HoursOfOperation, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                result = false;
            }
            return(result);
        }
Ejemplo n.º 9
0
        public bool SubmitRecord(object sender, GridCommandEventArgs e)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.SchoolYear, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT);
            bool result = false;

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.SchoolYear, "SubmitRecord", "Debug Submit Record Of SchoolYear", DayCarePL.Common.GUID_DEFAULT);
                DayCareBAL.ProgStaffService   proxyProgStaff = new DayCareBAL.ProgStaffService();
                DayCarePL.ProgStaffProperties objProgStaff   = new DayCarePL.ProgStaffProperties();

                GridDataItem item       = (GridDataItem)e.Item;
                var          InsertItem = e.Item as Telerik.Web.UI.GridEditableItem;

                Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager;

                if (InsertItem != null)
                {
                    foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
                    {
                        if (column is GridEditableColumn)
                        {
                            IGridEditableColumn editTableColumn = (column as IGridEditableColumn);

                            if (editTableColumn.IsEditable)
                            {
                                IGridColumnEditor editor = editMan.GetColumnEditor(editTableColumn);

                                switch (column.UniqueName)
                                {
                                case "Name":
                                {
                                    objProgStaff.StaffId = new Guid((e.Item.FindControl("lblStaffId") as Label).Text);
                                    break;
                                }

                                case "Active":
                                {
                                    objProgStaff.Active = (e.Item.FindControl("chkActive") as CheckBox).Checked;
                                    break;
                                }
                                }
                            }
                        }
                    }



                    if (e.CommandName != "PerformInsert")
                    {
                        objProgStaff.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());

                        if (Session["StaffId"] != null)
                        {
                            objProgStaff.LastModifiedById = new Guid(Session["StaffId"].ToString());
                        }
                    }
                    else
                    {
                    }
                    hdnName.Value = "";

                    //result = proxyProgStaff.Save(objProgStaff);
                    //MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                    //MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully!", "false"));
                }
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.Relationship, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                result = false;
            }
            return(result);
        }
Ejemplo n.º 10
0
        public bool SubmitRecord(object sender, GridCommandEventArgs e)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.Role, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT);
            bool result = false;

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.Role, "SubmitRecord", "Debug Submit Record Of Role", DayCarePL.Common.GUID_DEFAULT);
                DayCareBAL.RoleService   proxyRole = new DayCareBAL.RoleService();
                DayCarePL.RoleProperties objRole   = new DayCarePL.RoleProperties();

                GridDataItem item       = (GridDataItem)e.Item;
                var          InsertItem = e.Item as Telerik.Web.UI.GridEditableItem;

                Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager;

                if (InsertItem != null)
                {
                    foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
                    {
                        if (column is GridEditableColumn)
                        {
                            IGridEditableColumn editTableColumn = (column as IGridEditableColumn);

                            if (editTableColumn.IsEditable)
                            {
                                IGridColumnEditor editor = editMan.GetColumnEditor(editTableColumn);

                                switch (column.UniqueName)
                                {
                                case "Name":
                                {
                                    objRole.Name = (e.Item.FindControl("txtName") as TextBox).Text;
                                    break;
                                }

                                case "Active":
                                {
                                    objRole.Active = (editor as GridCheckBoxColumnEditor).Value;
                                    break;
                                }
                                }
                            }
                        }
                    }

                    if (e.CommandName != "PerformInsert")
                    {
                        objRole.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());
                        if (!objRole.Name.Trim().Equals(hdnName.Value.Trim()))
                        {
                            bool ans = Common.CheckDuplicate("Role", "Name", objRole.Name, "update", objRole.Id.ToString());
                            if (ans)
                            {
                                MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                                MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false"));
                                return(false);
                            }
                        }
                    }
                    else
                    {
                        bool ans = Common.CheckDuplicate("Role", "Name", objRole.Name, "insert", "");
                        if (ans)
                        {
                            MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                            MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false"));
                            return(false);
                        }
                    }
                    hdnName.Value = "";
                    result        = proxyRole.Save(objRole);
                }
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.Role, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                result = false;
            }
            return(result);
        }
Ejemplo n.º 11
0
        public bool SubmitRecord(object sender, GridCommandEventArgs e)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.SchoolYear, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT);
            Guid SchoolYearId = new Guid();
            bool result       = false;

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.SchoolYear, "SubmitRecord", "Debug Submit Record Of SchoolYear", DayCarePL.Common.GUID_DEFAULT);
                DayCareBAL.SchoolYearService   proxySchoolYear = new DayCareBAL.SchoolYearService();
                DayCarePL.SchoolYearProperties objSchoolYear   = new DayCarePL.SchoolYearProperties();

                GridDataItem item       = (GridDataItem)e.Item;
                var          InsertItem = e.Item as Telerik.Web.UI.GridEditableItem;

                Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager;

                if (InsertItem != null)
                {
                    foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
                    {
                        if (column is GridEditableColumn)
                        {
                            IGridEditableColumn editTableColumn = (column as IGridEditableColumn);

                            if (editTableColumn.IsEditable)
                            {
                                IGridColumnEditor editor = editMan.GetColumnEditor(editTableColumn);

                                switch (column.UniqueName)
                                {
                                case "Year":
                                {
                                    objSchoolYear.Year = (e.Item.FindControl("ddlYear") as DropDownList).SelectedValue;
                                    break;
                                }

                                case "StartDate":
                                {
                                    objSchoolYear.StartDate = (e.Item.FindControl("rdpStartDate") as RadDatePicker).SelectedDate.Value;
                                    break;
                                }

                                case "EndDate":
                                {
                                    if ((e.Item.FindControl("rdpEndDate") as RadDatePicker).SelectedDate != null)
                                    {
                                        objSchoolYear.EndDate = (e.Item.FindControl("rdpEndDate") as RadDatePicker).SelectedDate.Value;
                                    }
                                    else
                                    {
                                        objSchoolYear.EndDate = null;
                                    }
                                    break;
                                }

                                case "Comment":
                                {
                                    objSchoolYear.Comments = (e.Item.FindControl("txtComment") as TextBox).Text;
                                    break;
                                }

                                case "CurrentId":
                                {
                                    objSchoolYear.CurrentId = (editor as GridCheckBoxColumnEditor).Value;
                                    break;
                                }
                                }
                            }
                        }
                    }
                    if (objSchoolYear.EndDate != null)
                    {
                        if (objSchoolYear.StartDate > objSchoolYear.EndDate)
                        {
                            MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                            MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Start Date must be less than End Date.", "false"));
                            return(false);
                        }
                    }
                    if (Session["SchoolId"] != null)
                    {
                        objSchoolYear.SchoolId = new Guid(Session["SchoolId"].ToString());
                    }
                    if (e.CommandName != "PerformInsert")
                    {
                        if (Session["StaffId"] != null)
                        {
                            objSchoolYear.LastModifiedById = new Guid(Session["StaffId"].ToString());
                        }
                        objSchoolYear.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());
                        if (!objSchoolYear.Year.Trim().Equals(hdnName.Value.Trim()))
                        {
                            bool ans = proxySchoolYear.CheckDuplicateSchoolYear(objSchoolYear.Year, objSchoolYear.Id, objSchoolYear.SchoolId);
                            if (ans)
                            {
                                MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                                MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "School Year Already Exist", "false"));
                                return(false);
                            }
                        }
                    }
                    else
                    {
                        if (Session["StaffId"] != null)
                        {
                            objSchoolYear.CreatedById = new Guid(Session["StaffId"].ToString());
                        }
                        bool ans = proxySchoolYear.CheckDuplicateSchoolYear(objSchoolYear.Year, objSchoolYear.Id, objSchoolYear.SchoolId);
                        if (ans)
                        {
                            MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                            MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "School Year Already Exist", "false"));
                            return(false);
                        }
                    }
                    hdnName.Value = "";

                    SchoolYearId = proxySchoolYear.Save(objSchoolYear, new Guid(Session["CurrentSchoolYearId"].ToString()));
                    if (!SchoolYearId.ToString().Equals(DayCarePL.Common.GUID_DEFAULT))
                    {
                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false"));

                        if (objSchoolYear.CurrentId == true)
                        {
                            Session["CurrentSchoolYearId"] = SchoolYearId;
                        }

                        result = true;
                        Session["SchoolYearMessage"] = true;
                    }
                    else
                    {
                        result = false;
                    }
                }
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.SchoolYear, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                result = false;
            }
            return(result);
        }
Ejemplo n.º 12
0
        public bool SubmitRecord(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.ChargeCode, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT);
            bool result = false;

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.ChargeCode, "SubmitRecord", " Debug Submit record method called of ChargeCode", DayCarePL.Common.GUID_DEFAULT);

                DayCareBAL.ChargeCodeService   proxySave     = new DayCareBAL.ChargeCodeService();
                DayCarePL.ChargeCodeProperties objChargeCode = new DayCarePL.ChargeCodeProperties();

                Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)e.Item;
                var InsertItem = e.Item as Telerik.Web.UI.GridEditableItem;
                Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager;

                if (InsertItem != null)
                {
                    foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
                    {
                        if (column is IGridEditableColumn)
                        {
                            IGridEditableColumn editableCol = (column as IGridEditableColumn);
                            if (editableCol.IsEditable)
                            {
                                IGridColumnEditor editor = editMan.GetColumnEditor(editableCol);
                                switch (column.UniqueName)
                                {
                                case "Name":
                                {
                                    objChargeCode.Name = (item["Name"].Controls[1] as TextBox).Text;
                                    ViewState["Name"]  = objChargeCode.Name;
                                    break;
                                }

                                case "Category":
                                {
                                    objChargeCode.Category = (e.Item.FindControl("ddlCategory") as DropDownList).SelectedValue.Trim().ToString();
                                    ViewState["Category"]  = objChargeCode.Category;
                                    break;
                                }

                                case "Debit":
                                {
                                    if ((e.Item.FindControl("rbDebit") as RadioButton).Checked == true)
                                    {
                                        objChargeCode.DebitCrdit = (e.Item.FindControl("rbDebit") as RadioButton).Checked;
                                    }

                                    break;
                                }
                                }
                            }
                        }
                    }
                    if (e.CommandName != "PerformInsert")
                    {
                        if (Session["StaffId"] != null)
                        {
                            objChargeCode.LastModifiedById = new Guid(Session["StaffId"].ToString());
                            objChargeCode.CreatedById      = new Guid(Session["StaffId"].ToString());
                        }
                        objChargeCode.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());
                        if (!objChargeCode.Name.Trim().Equals(hdnName.Value.Trim()))
                        {
                            bool ans = Common.CheckDuplicate("ChargeCode", "Name", objChargeCode.Name, "update", objChargeCode.Id.ToString());
                            if (ans)
                            {
                                MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                                MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false"));
                                return(false);
                            }
                        }
                    }
                    else
                    {
                        if (Session["StaffId"] != null)
                        {
                            objChargeCode.LastModifiedById = new Guid(Session["StaffId"].ToString());
                            objChargeCode.CreatedById      = new Guid(Session["StaffId"].ToString());
                        }
                        bool ans = Common.CheckDuplicate("ChargeCode", "Name", objChargeCode.Name, "insert", objChargeCode.Id.ToString());
                        if (ans)
                        {
                            MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                            MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false"));
                            return(false);
                        }
                    }
                    hdnName.Value = "";
                    result        = proxySave.Save(objChargeCode);
                    if (result == true)
                    {
                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false"));
                    }
                }
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.ChargeCode, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
            }
            return(result);
        }
        public bool SubmitRecord(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.ClassRoom, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT);
            bool result = false;

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.ClassRoom, "SubmitRecord", " Debug Submit record method called of ClassRoom", DayCarePL.Common.GUID_DEFAULT);

                DayCareBAL.HoursOfOperationService   proxyHoursOfOperation = new DayCareBAL.HoursOfOperationService();
                DayCarePL.HoursOfOperationProperties objHoursOfOperation   = new DayCarePL.HoursOfOperationProperties();

                GridDataItem item       = (GridDataItem)e.Item;
                var          InsertItem = e.Item as Telerik.Web.UI.GridEditableItem;

                Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager;

                if (InsertItem != null)
                {
                    foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
                    {
                        if (column is GridEditableColumn)
                        {
                            IGridEditableColumn editTableColumn = (column as IGridEditableColumn);

                            if (editTableColumn.IsEditable)
                            {
                                IGridColumnEditor editor = editMan.GetColumnEditor(editTableColumn);

                                switch (column.UniqueName)
                                {
                                case "Day":
                                {
                                    //objHoursOfOperation.Day = (e.Item.FindControl("ddlDayName") as DropDownList).SelectedItem.Text;
                                    //objHoursOfOperation.DayIndex = Convert.ToInt32((e.Item.FindControl("ddlDayName") as DropDownList).SelectedValue);
                                    objHoursOfOperation.Day      = (item["Day"].Controls[1] as DropDownList).SelectedItem.Text;
                                    objHoursOfOperation.DayIndex = Convert.ToInt32((item["Day"].Controls[1] as DropDownList).SelectedValue);
                                    break;
                                }

                                case "OpenTime":
                                {
                                    if ((e.Item.FindControl("rdOpenTp") as RadTimePicker).SelectedDate != null)
                                    {
                                        objHoursOfOperation.OpenTime = Convert.ToDateTime((e.Item.FindControl("rdOpenTp") as RadTimePicker).SelectedDate);
                                    }
                                    break;
                                }

                                case "CloseTime":
                                {
                                    if ((e.Item.FindControl("rdCloseTp") as RadTimePicker).SelectedDate != null)
                                    {
                                        objHoursOfOperation.CloseTime = Convert.ToDateTime((e.Item.FindControl("rdCloseTp") as RadTimePicker).SelectedDate.Value);
                                    }
                                    break;
                                }

                                case "Comments":
                                {
                                    objHoursOfOperation.Comments = (e.Item.FindControl("txtComments") as TextBox).Text;
                                    break;
                                }
                                }
                            }
                        }
                    }
                    if (objHoursOfOperation.OpenTime != null && objHoursOfOperation.CloseTime != null)
                    {
                        if (objHoursOfOperation.OpenTime.TimeOfDay > objHoursOfOperation.CloseTime.TimeOfDay)
                        {
                            MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                            MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Open Time must be less than Close Time.", "false"));
                            return(false);
                        }
                    }
                    else
                    {
                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Open Time/Close Time is not valid.", "false"));
                        return(false);
                    }


                    if (Session["SchoolId"] != null)
                    {
                        objHoursOfOperation.SchoolId = new Guid(Session["SchoolId"].ToString());
                    }
                    if (e.CommandName != "PerformInsert")
                    {
                        if (Session["StaffId"] != null)
                        {
                            objHoursOfOperation.LastModifiedById = new Guid(Session["StaffId"].ToString());
                        }
                        objHoursOfOperation.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());
                    }

                    hdnName.Value = "";
                    result        = proxyHoursOfOperation.Save(objHoursOfOperation);
                    if (result)
                    {
                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false"));
                    }
                }
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.HoursOfOperation, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                result = false;
            }
            return(result);
        }
Ejemplo n.º 14
0
        public bool SubmitRecord(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clUserGroup, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT);
            bool result = false;

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clUserGroup, "SubmitRecord", "Debug Submit record method called of UserGroup", DayCarePL.Common.GUID_DEFAULT);
                DayCareBAL.UserGroupService   proxySave    = new DayCareBAL.UserGroupService();
                DayCarePL.UserGroupProperties objUserGroup = new DayCarePL.UserGroupProperties();

                Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)e.Item;
                var InsertItem = e.Item as Telerik.Web.UI.GridEditableItem;
                Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager;
                if (InsertItem != null)
                {
                    foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
                    {
                        if (column is IGridEditableColumn)
                        {
                            IGridEditableColumn editableCol = (column as IGridEditableColumn);
                            if (editableCol.IsEditable)
                            {
                                IGridColumnEditor editor = editMan.GetColumnEditor(editableCol);
                                switch (column.UniqueName)
                                {
                                case "GroupTitle":
                                {
                                    objUserGroup.GroupTitle = (e.Item.FindControl("txtGroupTitle") as TextBox).Text;
                                    ViewState["GroupTitle"] = objUserGroup.GroupTitle;
                                    break;
                                }

                                case "Role":
                                {
                                    objUserGroup.RoleId   = new Guid((e.Item.FindControl("ddlRole") as DropDownList).SelectedValue);
                                    ViewState["RoleName"] = objUserGroup.RoleId;
                                    break;
                                }

                                case "Comments":
                                {
                                    objUserGroup.Comments = (e.Item.FindControl("txtComments") as TextBox).Text;
                                    ViewState["Comments"] = objUserGroup.Comments;
                                    break;
                                }
                                }
                            }
                        }
                    }
                    if (Session["SchoolId"] != null)
                    {
                        objUserGroup.SchoolId = new Guid(Session["SchoolId"].ToString());
                    }
                    if (e.CommandName != "PerformInsert")
                    {
                        if (Session["StaffId"] != null)
                        {
                            objUserGroup.LastModifiedById = new Guid(Session["StaffId"].ToString());
                        }
                        objUserGroup.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());
                        if (!objUserGroup.GroupTitle.Trim().Equals(hdnName.Value.Trim()))
                        {
                            bool ans = proxySave.CheckDuplicateUserGroupTitle(objUserGroup.GroupTitle, objUserGroup.Id, objUserGroup.SchoolId);
                            if (ans)
                            {
                                MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                                MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false"));
                                return(false);
                            }
                        }
                    }
                    else
                    {
                        bool ans = proxySave.CheckDuplicateUserGroupTitle(objUserGroup.GroupTitle, objUserGroup.Id, objUserGroup.SchoolId);
                        //bool ans = Common.CheckDuplicate("UserGroup", "Group Title", objUserGroup.GroupTitle, "insert", objUserGroup.Id.ToString());
                        if (ans)
                        {
                            MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                            MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false"));
                            return(false);
                        }
                    }
                    hdnName.Value = "";
                    result        = proxySave.Save(objUserGroup);
                    if (result == true)
                    {
                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false"));
                    }
                }
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.UserGroup, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                result = false;
            }
            return(result);
        }
Ejemplo n.º 15
0
        public bool SubmitRecord(object source, GridCommandEventArgs e)
        {
            bool result = false;

            try
            {
                DayCareBAL.StateService   proxyState = new DayCareBAL.StateService();
                DayCarePL.StateProperties objState   = new DayCarePL.StateProperties();

                Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)e.Item;

                var InsertItem = e.Item as Telerik.Web.UI.GridEditableItem;
                Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager;

                if (InsertItem != null)
                {
                    foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
                    {
                        if (column is IGridEditableColumn)
                        {
                            IGridEditableColumn editableCol = (column as IGridEditableColumn);
                            if (editableCol.IsEditable)
                            {
                                IGridColumnEditor editor = editMan.GetColumnEditor(editableCol);

                                switch (column.UniqueName)
                                {
                                case "Name":
                                {
                                    objState.Name = (item["Name"].Controls[1] as TextBox).Text;
                                    break;
                                }

                                case "CountryName":
                                {
                                    objState.CountryId = new Guid((e.Item.FindControl("ddlCountry") as DropDownList).SelectedValue);
                                    break;
                                }
                                }
                            }
                        }
                    }
                    if (e.CommandName != "PerformInsert")
                    {
                        objState.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());
                        if (!objState.Name.Trim().Equals(hdnName.Value.Trim()))
                        {
                            bool ans = Common.CheckDuplicate("State", "Name", objState.Name, "update", objState.Id.ToString());
                            if (ans)
                            {
                                MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                                MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false"));
                                return(false);
                            }
                        }
                    }
                    else
                    {
                        bool ans = Common.CheckDuplicate("State", "Name", objState.Name, "insert", "");
                        if (ans)
                        {
                            MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                            MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false"));
                            return(false);
                        }
                    }
                    hdnName.Value = "";


                    result = proxyState.Save(objState);
                    if (result)
                    {
                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false"));
                    }
                }
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.State, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                result = false;
            }
            return(result);
        }