protected void RadGridParameters_InsertCommand(object source, GridCommandEventArgs e)
    {
        bool            hasKey  = false;
        string          key     = string.Empty;
        string          value   = string.Empty;
        GridEditManager editMan = (e.Item as GridEditableItem).EditManager;

        //Set new values
        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);

                    if (editor is GridTextColumnEditor)
                    {
                        if (column.HeaderText.ToUpper() == "KEY")
                        {
                            hasKey = true;
                            key    = (editor as GridTextColumnEditor).Text;
                        }
                        if (column.HeaderText.ToUpper() == "VALUE")
                        {
                            value = (editor as GridTextColumnEditor).Text;
                        }
                    }
                }
            }
        }
        if (hasKey)
        {
            this.Parameters.Add(key, value);
        }
    }
Esempio n. 2
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);
        }
Esempio n. 3
0
        protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e)
        {
            try
            {
                GridEditableItem editedItem = e.Item as GridEditableItem;
                GridEditManager  editMan    = editedItem.EditManager;
                int i = 2;
                int j = 0;
                dt = (DataTable)Session[SessionContents.FPS_AddProspect_DataTable];
                dr = dt.NewRow();
                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);
                            string            editorType  = editor.ToString();
                            string            editorText  = "unknown";
                            object            editorValue = null;

                            if (editor is GridTextColumnEditor)
                            {
                                editorText  = (editor as GridTextColumnEditor).Text;
                                editorValue = (editor as GridTextColumnEditor).Text;
                            }
                            if (editor is GridBoolColumnEditor)
                            {
                                editorText  = (editor as GridBoolColumnEditor).Value.ToString();
                                editorValue = (editor as GridBoolColumnEditor).Value;
                            }
                            if (editor is GridDropDownColumnEditor)
                            {
                                editorText  = (editor as GridDropDownColumnEditor).SelectedValue;
                                editorValue = (editor as GridDropDownColumnEditor).SelectedValue;
                            }
                            if (editor is GridTemplateColumnEditor)
                            {
                                if (i != 3)
                                {
                                    TextBox txt = (TextBox)e.Item.FindControl("txtGridEmailId");
                                    editorText  = txt.Text;
                                    editorValue = txt.Text;
                                }
                                else if (i == 3)
                                {
                                    TextBox txt = (TextBox)e.Item.FindControl("txtChildFirstName");
                                    editorText  = txt.Text;
                                    editorValue = txt.Text;
                                }
                            }
                            try
                            {
                                dr[i] = editorText;
                            }
                            catch (Exception ex)
                            {
                                RadGrid1.Controls.Add(new LiteralControl("<strong>Unable to set value of column '" + column.UniqueName + "'</strong> - " + ex.Message));
                                e.Canceled = true;
                                break;
                            }
                        }
                        i++;
                    }
                }
                dt.Rows.Add(dr);
                Session[SessionContents.FPS_AddProspect_DataTable] = dt;
                Rebind();
            }
            catch (Exception ex)
            {
                e.Canceled = true;
                throw ex;
            }
        }
Esempio n. 4
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);
        }
Esempio n. 5
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);
        }
Esempio n. 6
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);
        }
Esempio n. 7
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);
        }
Esempio n. 8
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);
        }
        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);
        }
Esempio n. 10
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);
        }
Esempio n. 11
0
        protected void RGExisitingLoads_UpdateCommand(object source, GridCommandEventArgs e)
        {
            //Console.WriteLine(e.Item.Cells[0].Text);
            Console.WriteLine(" Table to be updated: " + e.Item.OwnerTableView.DataMember);
            GridEditableItem editedItem = e.Item as GridEditableItem;
            GridEditManager  editMan    = editedItem.EditManager;
            int    targetId             = 0;
            string Driver = string.Empty;

            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);
                        string            editorText  = "unknown";
                        object            editorValue = null;
                        if (editor is GridTextColumnEditor)
                        {
                            if (editableCol.Column.OrderIndex == 0)
                            {
                                editorText = (editor as GridTextColumnEditor).Text;
                            }
                            editorValue = (editor as GridTextColumnEditor).Text;
                            if (editableCol.Column.OrderIndex == 0)
                            {
                                targetId = int.Parse(editorText);
                            }
                            else if
                            (editableCol.Column.OrderIndex == 2)
                            {
                                Driver = editorText;
                            }
                        }
                        if (editor is GridBoolColumnEditor)
                        {
                            editorText  = (editor as GridBoolColumnEditor).Value.ToString();
                            editorValue = (editor as GridBoolColumnEditor).Value;
                        }
                        if (editor is GridDropDownColumnEditor)
                        {
                            editorText = (editor as GridDropDownColumnEditor).SelectedText + "; " +
                                         (editor as GridDropDownColumnEditor).SelectedValue;
                            editorValue = (editor as GridDropDownColumnEditor).SelectedValue;
                        }
                        try
                        {
                            //SqlDataSource1.UpdateParameters.Add("LoadId", targetId.ToString());
                            //SqlDataSource1.UpdateParameters.Add("Driver", Driver);
                            ////SqlDataSource1.UpdateParameters.Add("Driver", Driver);
                            //SqlDataSource1.Update();
                            // DataRow[] changedRows = this.GridSource.Select("OrderID = " + editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["OrderID"].ToString());
                            // changedRows[0][column.UniqueName] = editorValue;
                            // this.GridSource.AcceptChanges();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine("Unable to set value of column '" + column.UniqueName + "  " + ex.Message);
                            e.Canceled = true;
                            break;
                        }
                    }
                }
            }
            //SqlDataSource1.UpdateParameters.Add("LoadId", targetId.ToString());
            // SqlDataSource1.UpdateParameters.Add("Driver", Driver);
            //SqlDataSource1.UpdateParameters.Add("Driver", Driver);
            //SqlDataSource1.Update();
        }
Esempio 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);
        }
Esempio n. 14
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);
        }
Esempio n. 15
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);
        }
Esempio n. 16
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);
        }
Esempio n. 17
0
        protected void gv_presencia_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            try
            {
                lblmensaje.Text = "";
                Conexion Ocoon      = new Conexion();
                DateTime Fec_reg_bd = DateTime.Today;

                GridItem item = gv_presencia.Items[e.Item.ItemIndex];

                CheckBox cb_validar_presencia  = (CheckBox)item.FindControl("cb_validar_presencia");
                Label    lbl_validar_presencia = (Label)item.FindControl("lbl_validar_presencia");
                Label    lbl_id_cliente        = (Label)item.FindControl("lbl_id_cliente");
                Label    lbl_id_node           = (Label)item.FindControl("lbl_id_node");
                Label    lbl_fecha             = (Label)item.FindControl("lbl_fecha");
                Label    lbl_id_mercaderista   = (Label)item.FindControl("lbl_id_mercaderista");

                int    node            = Int32.Parse(lbl_id_node.Text);
                string cliente         = lbl_id_cliente.Text;
                string fecha           = lbl_fecha.Text;
                int    id_mercaderista = Int32.Parse(lbl_id_mercaderista.Text);
                bool   validado        = cb_validar_presencia.Checked;
                string Message         = "";

                List <object[]> ArrayEditorValue = new List <object[]>();

                GridEditableItem editedItem = e.Item as GridEditableItem;
                GridEditManager  editMan    = editedItem.EditManager;

                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);
                            string            editorType  = editor.ToString();
                            string            editorText  = "unknown";
                            object            editorValue = null;
                            if (editor is GridNumericColumnEditor)
                            {
                                editorText  = (editor as GridNumericColumnEditor).Text;
                                editorValue = (editor as GridNumericColumnEditor).NumericTextBox.DbValue;
                                object[] EditValue = new object[2];
                                EditValue[0] = column.HeaderText;
                                EditValue[1] = editorText;
                                ArrayEditorValue.Add(EditValue);
                            }
                            if (editor is GridDateTimeColumnEditor)
                            {
                                editorText = (editor as GridDateTimeColumnEditor).Text;
                                Fec_reg_bd = Convert.ToDateTime(editorText);
                            }
                        }
                    }
                }
                string    selectDatosRegistro = String.Format("nodocomercial={0} and PDV_Client='{1}' and fec_reg_cel='{2}' and id_mercaderista={3}", node, cliente, fecha, id_mercaderista);
                DataRow[] Datos = Productos.Select(selectDatosRegistro);
                if (Datos.Count() > 0)
                {
                    string sId_Reg_Presencia = Datos[0]["id_detalle_presencia"].ToString();
                    Datos = null;

                    foreach (object[] value in ArrayEditorValue)
                    {
                        string updatValor = "";
                        int    count      = 0;
                        string cabecera   = value[0].ToString();
                        string valor      = value[1].ToString();

                        if (!valor.Equals(""))
                        {
                            string    select          = String.Format("nodocomercial={0} and PDV_Client='{1}' and fec_reg_cel='{2}' and id_mercaderista={3} and dato='{4}'", node, cliente, fecha, id_mercaderista, cabecera);
                            DataRow[] filasActualizar = Productos.Select(select);

                            if (filasActualizar.Length == 0)
                            { //Crear el registro
                                string    selectProducto = String.Format("dato='{4}'", node, cliente, fecha, id_mercaderista, cabecera);
                                DataRow[] CodProducto    = Productos.Select(selectProducto);
                                string    sId_Dato       = CodProducto[0]["cod_dato"].ToString();
                                CodProducto = null;
                                OPE_Reporte_Presencia  oOPE_Reporte_Presencia  = new OPE_Reporte_Presencia();
                                EOPE_Reporte_Presencia oEOPE_Reporte_Presencia = oOPE_Reporte_Presencia.RegistrarReportePresencia_Pivot(sId_Dato, sId_Reg_Presencia, "");
                                oOPE_Reporte_Presencia.RegistrarReportePresenciaDetalle_Pivot(Convert.ToInt64(oEOPE_Reporte_Presencia.ID), sId_Dato, valor);
                            }
                            else
                            {//Actualizar el registro
                                string NomProduct  = "";
                                double valors      = double.Parse(valor);
                                double valorActual = 0;
                                double valorTotal  = 0;
                                Array.ForEach(filasActualizar, delegate(DataRow fila)
                                {
                                    updatValor      += (fila["id_detalle_presencia"].ToString() + ",");
                                    fila["validado"] = validado;
                                    valorActual      = double.Parse(fila["valor"].ToString());
                                    NomProduct       = fila["dato"].ToString();
                                    count++;
                                    TipoReporte = fila["opcion_reporte"].ToString();
                                    valorTotal += double.Parse(fila["valor"].ToString());
                                });

                                //updatValor = updatValor.Remove(updatValor.Length - 1, 1);se remplazo por el Sub String :Ing Ditmar Estrada, 17/05/2012 - 12:31pm
                                updatValor = updatValor.Substring(0, updatValor.Length - 1);
                                if (valors != valorTotal)
                                {
                                    Ocoon.ejecutarDataReader("UP_WEBXPLORA_OPE_ACTUALIZAR_REPORTE_PRESENCIA_COLGATE_PIVOT", updatValor, TipoReporte, valor, Fec_reg_bd, Session["sUser"].ToString(), DateTime.Now, validado);
                                }
                                if (filasActualizar.Count() > 1)
                                {
                                    Message += string.Format("El producto {0} contiene {1} registros, debe invalidar algunos de ellos.<br />", NomProduct, count);
                                }
                            }
                        }
                    }
                }
                else
                {
                    lblmensaje.ForeColor = System.Drawing.Color.Blue;
                    lblmensaje.Text      = "No es posible actualizar.";
                }
                cargarGrilla_Reporte_Presencia();
                lblmensaje.ForeColor = System.Drawing.Color.Blue;
                lblmensaje.Text      = Message; lblmensaje.Text = Message;
            }
            catch (Exception ex)
            {
                lblmensaje.Text = ex.ToString();
                Response.Redirect("~/err_mensaje_seccion.aspx", true);
            }
        }
        protected void gv_precios_UpdateCommand(object source, GridCommandEventArgs e)
        {
            try
            {
                lblmensaje.Text = "";
                Conexion Ocoon = new Conexion();

                GridItem item = gv_precios.Items[e.Item.ItemIndex];

                Label lbl_id_StockDetalle = (Label)item.FindControl("lbl_id_StockDetalle");
                int   iid_det             = Convert.ToInt32(lbl_id_StockDetalle.Text.Trim());

                CheckBox ckvalidado = (CheckBox)item.FindControl("cb_validar");



                List <object> ArrayEditorValue = new List <object>();

                GridEditableItem editedItem = e.Item as GridEditableItem;
                GridEditManager  editMan    = editedItem.EditManager;

                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);

                            string editorType  = editor.ToString();
                            string editorText  = "unknown";
                            object editorValue = null;

                            if (editor is GridNumericColumnEditor)
                            {
                                editorText  = (editor as GridNumericColumnEditor).Text;
                                editorValue = (editor as GridNumericColumnEditor).NumericTextBox.DbValue;
                                ArrayEditorValue.Add(editorValue);
                            }

                            if (editor is GridDateTimeColumnEditor)
                            {
                                editorText  = (editor as GridDateTimeColumnEditor).Text;
                                editorValue = (editor as GridDateTimeColumnEditor).PickerControl;
                                ArrayEditorValue.Add(editorValue);
                            }
                        }
                    }
                }
                DateTime Fec_reg_bd = Convert.ToDateTime((ArrayEditorValue[0] as RadDateTimePicker).SelectedDate);


                string ingreso = ArrayEditorValue[1].ToString();
                string pedido  = ArrayEditorValue[2].ToString();


                Ocoon.ejecutarDataReader("UP_WEBXPLORA_OPE_ACTUALIZAR_REPORTE_STOCK_SANFERNDO", iid_det, pedido, ingreso, Fec_reg_bd, Session["sUser"].ToString(), DateTime.Now, ckvalidado.Checked);

                cargarGrilla_Precio();
            }
            catch (Exception ex)
            {
                lblmensaje.Text = ex.ToString();
                Response.Redirect("~/err_mensaje_seccion.aspx", true);
            }
        }
        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);
        }
        protected void gv_competencia_UpdateCommand(object source, GridCommandEventArgs e)
        {
            try
            {
                lblmensaje.Text = "";
                Conexion Ocoon = new Conexion();

                GridItem item = gv_competencia.Items[e.Item.ItemIndex];

                Label lbl_id_regcompetencia = (Label)item.FindControl("lblregcompetencia");
                int   iid_regcompetencia    = Convert.ToInt32(lbl_id_regcompetencia.Text.Trim());


                CheckBox ckvalidado = (CheckBox)item.FindControl("cb_validar");
                //psalas, 16/08/2011, se agrega esta logica porque en la tabla ope_reporte_competencia,
                //los validados se consideran como 0 y los invalidados como 1
                if (ckvalidado.Checked == true)
                {
                    ckvalidado.Checked = false;
                }
                else
                {
                    ckvalidado.Checked = true;
                }


                List <object> ArrayEditorValue = new List <object>();

                GridEditableItem editedItem = e.Item as GridEditableItem;
                GridEditManager  editMan    = editedItem.EditManager;

                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);

                            string editorType  = editor.ToString();
                            string editorText  = "unknown";
                            object editorValue = null;

                            if (editor is GridNumericColumnEditor)
                            {
                                editorText  = (editor as GridNumericColumnEditor).Text;
                                editorValue = (editor as GridNumericColumnEditor).NumericTextBox.DbValue;
                                ArrayEditorValue.Add(editorValue);
                            }

                            if (editor is GridDateTimeColumnEditor)
                            {
                                editorText  = (editor as GridDateTimeColumnEditor).Text;
                                editorValue = (editor as GridDateTimeColumnEditor).PickerControl;
                                ArrayEditorValue.Add(editorValue);
                            }
                        }
                    }
                }

                DateTime promocionini  = Convert.ToDateTime((ArrayEditorValue[0] as RadDateTimePicker).SelectedDate);
                DateTime promocionfin  = Convert.ToDateTime((ArrayEditorValue[1] as RadDateTimePicker).SelectedDate);
                string   precioregular = ArrayEditorValue[2].ToString();
                //psalas. 16/08/2011. se agrega preciooferta por requerimiento san fernando
                string preciooferta = ArrayEditorValue[3].ToString();

                string strpromocionini = Convert.ToString(promocionini);
                string strpromocionfin = Convert.ToString(promocionfin);


                Ocoon.ejecutarDataReader("UP_WEBXPLORA_OPE_ACTUALIZAR_REPORTE_COMPETENCIA_SF_MODERNO", iid_regcompetencia, precioregular, preciooferta, strpromocionini, strpromocionfin, Session["sUser"].ToString(), DateTime.Now, ckvalidado.Checked);
                cargarGrilla_Competencias();
            }
            catch (Exception ex)
            {
                lblmensaje.Text = ex.ToString();
                Response.Redirect("~/err_mensaje_seccion.aspx", true);
            }
        }
Esempio n. 21
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);
        }