Exemplo n.º 1
0
        protected void gvShifts_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            var newShiftName = Utils.ConvertToTrimmedString(e.NewValues["shift_name"]);

            if (newShiftName == null)
            {
                e.Cancel = true;
                throw new Exception("Complete all fields!");
            }

            var id = Utils.ConvertToTrimmedString(e.Keys["id"]);

            if (id == null)
            {
                e.Cancel = true;
                throw new Exception("System error!");
            }
            string message = SettsUtils.ShiftUpdateVerify(newShiftName, id);

            if (message != null)
            {
                e.Cancel = true;
                throw new Exception(message);
            }

            e.NewValues["shift_name"] = newShiftName;
        }
Exemplo n.º 2
0
        protected void gvAuditors_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            var newAuditType    = Utils.ConvertToTrimmedString(e.NewValues["audit_type"]);
            var newAuditorLogin = Utils.ConvertToTrimmedString(e.NewValues["auditor_login"]);

            if (newAuditType == null ||
                newAuditorLogin == null)
            {
                e.Cancel = true;
                throw new Exception("Complete all fields!");
            }

            var id = Utils.ConvertToTrimmedString(e.Keys["id"]);

            if (id == null)
            {
                e.Cancel = true;
                throw new Exception("System error!");
            }
            string message = SettsUtils.AuditorUpdateVerify(newAuditType, newAuditorLogin, id);

            if (message != null)
            {
                e.Cancel = true;
                throw new Exception(message);
            }

            e.NewValues["audit_type"]    = newAuditType;
            e.NewValues["auditor_login"] = newAuditorLogin.ToUpper();
        }
Exemplo n.º 3
0
        protected void gvAuditTargets_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            var    newAuditType       = Utils.ConvertToTrimmedString(e.NewValues["audit_type"]);
            var    newAuditTarget     = Utils.ConvertToTrimmedString(e.NewValues["audit_target"]);
            var    newArea            = Utils.ConvertToTrimmedString(e.NewValues["area"]);
            var    newSubarea         = Utils.ConvertToTrimmedString(e.NewValues["subarea"]);
            var    newSection         = Utils.ConvertToTrimmedString(e.NewValues["section"]);
            var    newSupervisorLogin = Utils.ConvertToTrimmedString(e.NewValues["supervisor_login"]);
            string newSupervisor      = null;

            if (newAuditType == null ||
                newAuditTarget == null)
            {
                e.Cancel = true;
                throw new Exception("Complete TYPE and TARGET fields!");
            }

            string message = SettsUtils.AuditTargetInsertVerify(newAuditType, newAuditTarget);

            if (message != null)
            {
                e.Cancel = true;
                throw new Exception(message);
            }

            message = AuditTypes.VerifyAuditTargetEntry(newAuditType, newArea, newSubarea, newSection, newSupervisorLogin);
            if (message != null)
            {
                e.Cancel = true;
                throw new Exception(message);
            }

            if (newSupervisorLogin != null)
            {
                var user = new AppUser(newSupervisorLogin);
                if (user.Exist)
                {
                    newSupervisor = user.FullName;
                }
                else
                {
                    e.Cancel = true;
                    throw new Exception("User does not exist (SUPERVISOR)!");
                }
            }

            e.NewValues["audit_type"]       = newAuditType;
            e.NewValues["audit_target"]     = newAuditTarget;
            e.NewValues["area"]             = newAuditType;
            e.NewValues["subarea"]          = newSubarea;
            e.NewValues["section"]          = newSection;
            e.NewValues["supervisor_login"] = newSupervisorLogin;
            e.NewValues["supervisor"]       = newSupervisor;
        }
Exemplo n.º 4
0
        protected void gvShifts_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            var newShiftName = Utils.ConvertToTrimmedString(e.NewValues["shift_name"]);

            if (newShiftName == null)
            {
                e.Cancel = true;
                throw new Exception("Complete all fields!");
            }

            string message = SettsUtils.ShiftInsertVerify(newShiftName);

            if (message != null)
            {
                e.Cancel = true;
                throw new Exception(message);
            }

            e.NewValues["shift_name"] = newShiftName;
        }
Exemplo n.º 5
0
        protected void gvAuditTypes_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            var newAuditType = Utils.ConvertToTrimmedString(e.NewValues["audit_type"]);
            var newName      = Utils.ConvertToTrimmedString(e.NewValues["name"]);

            if (newAuditType == null ||
                newName == null)
            {
                e.Cancel = true;
                throw new Exception("Complete all fields!");
            }

            string message = SettsUtils.AuditTypeInsertVerify(newAuditType);

            if (message != null)
            {
                e.Cancel = true;
                throw new Exception(message);
            }

            e.NewValues["audit_type"] = newAuditType;
            e.NewValues["name"]       = newName;
        }
Exemplo n.º 6
0
        protected void gvSchedules_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            var newScheduleName        = Utils.ConvertToTrimmedString(e.NewValues["schedule_name"]);
            var newScheduleDescription = Utils.ConvertToTrimmedString(e.NewValues["schedule_description"]);

            if (newScheduleName == null ||
                newScheduleDescription == null)
            {
                e.Cancel = true;
                throw new Exception("Complete all fields!");
            }

            string message = SettsUtils.ScheduleInsertVerify(newScheduleName);

            if (message != null)
            {
                e.Cancel = true;
                throw new Exception(message);
            }

            e.NewValues["schedule_name"]        = newScheduleName;
            e.NewValues["schedule_description"] = newScheduleDescription;
        }