Ejemplo n.º 1
0
        public ActionResult Create([Bind(Include = "Id,ActivityId,IndexId,ProcessId")] CreateQualityRulePostBackViewModel RuleObj)
        {
            if (RuleObj.IndexId > 0 && ModelState.IsValid)
            {
                if (DmlObj.AddQualityRule(new AMQualityRule {
                    ActivityId = RuleObj.ActivityId, IndexId = RuleObj.IndexId
                }))
                {
                    return(RedirectToAction("ShowActivity", "Sysadmin", new { ActivityId = RuleObj.ActivityId, ProcessId = RuleObj.ProcessId }));
                }
            }

            if (RuleObj.IndexId <= 0)
            {
                ModelState.AddModelError("IndexId", "شاخص انتخابی نادرست است");
            }
            AMActivity Act  = DmlObj.GetActivityById(RuleObj.ActivityId);
            AMProcess  Prcs = DmlObj.GetProcessById(RuleObj.ProcessId);
            IEnumerable <AMQualityIndex> Indx = DmlObj.GetQualityIndexList();

            if (Act == null || Prcs == null)
            {
                return(View("Error"));
            }
            return(View(new CreateQualityRuleViewModel {
                Activity = Act, IndexId = Indx, Process = Prcs
            }));
        }
Ejemplo n.º 2
0
        public ActionResult Add([Bind(Include = "ParentId,Name,Description,ProcessTypeId")] AMProcess ProcessObj)
        {
            if (ModelState.ContainsKey("ProcessType"))
            {
                ModelState["ProcessType"].Errors.Clear();
            }
            if (!ModelState.IsValid)
            {
                ViewBag.ProcessTypes  = DMLObj.GetAllProcessTypes();
                ViewBag.ParentProcess = DMLObj.GetProcessById(ProcessObj.ParentId);
                return(View(ProcessObj));
            }
            bool operationRes = false;

            ProcessObj.ProcessType = DMLObj.GetProcessTypeById(ProcessObj.ProcessTypeId);
            var addedProcess = DMLObj.AddNewProcess(ProcessObj, out operationRes);

            if (operationRes)
            {
                return(RedirectToAction("Index", "SysAdmin", new { Prcs = addedProcess.Id }));
            }
            ViewBag.ProcessTypes  = DMLObj.GetAllProcessTypes();
            ViewBag.ParentProcess = DMLObj.GetProcessById(ProcessObj.ParentId);
            return(View(ProcessObj));
        }
Ejemplo n.º 3
0
        public ActionResult Delete([Bind(Include = "Id,ParentId,Name,Description,ProcessTypeId")] AMProcess ProcessObj)
        {
            int CurrentId = 0;

            Int32.TryParse(ProcessObj.Id.ToString(), out CurrentId);
            if (CurrentId == 0)
            {
                return(View("Error"));
            }
            if (!DMLObj.ProcessHasChild(CurrentId) && !DMLObj.ProcessHasDocument(CurrentId) && DMLObj.DeleteProcessById(CurrentId))
            {
                return(RedirectToAction("Index", "SysAdmin"));
            }
            return(View("Error"));
        }
Ejemplo n.º 4
0
        // GET: InstallmentsFollowUp
        public ActionResult Index(string UnitId, string ProcessId, string ActivityId)
        {
            int CurrentUnit     = 0;
            int CurrrentProcess = 0;
            int CurrentActivity = 0;
            int CurrentUser     = 0;

            Int32.TryParse(UnitId, out CurrentUnit);
            Int32.TryParse(ProcessId, out CurrrentProcess);
            Int32.TryParse(ActivityId, out CurrentActivity);
            Int32.TryParse(User.GetAmUser(), out CurrentUser);

            AMUnitOfOrg UnitObj     = DmlObj.GetUnitById(CurrentUnit);
            AMProcess   ProcessObj  = DmlObj.GetProcessById(CurrrentProcess);
            AMActivity  ActivityObj = DmlObj.GetActivityById(CurrentActivity);

            if (CurrentUnit == 0 || CurrrentProcess == 0 || CurrentActivity == 0 || CurrentUser == 0 || UnitObj == null || ProcessObj == null || ActivityObj == null || DmlObj.GetAmUserById(CurrentUser) == null || !DmlObj.VerifyUserUnit(CurrentUnit, CurrentUser))
            {
                return(View("Error"));
            }

            List <NavViewModel> Nav = DmlObj.GetMainNaviagtion(CurrentUnit);

            Nav         = DmlObj.AddShowActivityNaviagtion(Nav, CurrrentProcess, DmlObj.GetProcessById(CurrrentProcess).Name, CurrentUnit, DmlObj.GetUnitById(CurrentUnit).Name, CurrentActivity, DmlObj.GetActivityById(CurrentActivity).Name);
            ViewBag.Nav = Nav;

            ViewBag.UPA = new UnitProcessActObjectViewModel {
                Unit = UnitObj, Process = ProcessObj, Activity = ActivityObj
            };

            FollowUpIndexViewModel model = new FollowUpIndexViewModel
            {
                LoansWithInstallmentNotification = DmlObj.GetLoansWithInstallmentNotification(CurrentUnit),
                LoansWithCallNotification        = DmlObj.GetLoansWithCallNotification(CurrentUnit),
                TodayOverDueLoans    = DmlObj.GetLoansWithTodayOverDueDate(CurrentUnit),
                WeekOverDueLoans     = DmlObj.GetLoansWithWeekOverDueDate(CurrentUnit),
                OneMonthOverdueLoans = DmlObj.GetLoansWithMonthOverDueDate(CurrentUnit),
                //TwoMonthsOverDueLoans = DmlObj.GetLoansWithTwoMonthsOverDueDate(CurrentUnit),
                //MoreThanTwoMonthsOverDueLoans = DmlObj.GetLoansWithMoreThanTwoMonthsOverDueDate(CurrentUnit)
            };

            return(View(model));
        }
Ejemplo n.º 5
0
 public ActionResult Edit([Bind(Include = "Id,ParentId,Name,Description,ProcessTypeId")] AMProcess ProcessObj)
 {
     if (ModelState.ContainsKey("ProcessType"))
     {
         ModelState["ProcessType"].Errors.Clear();
     }
     if (!ModelState.IsValid)
     {
         ViewBag.ProcessTypes  = DMLObj.GetAllProcessTypes();
         ViewBag.ParentProcess = DMLObj.GetProcessById(ProcessObj.ParentId);
         return(View(ProcessObj));
     }
     ProcessObj.ProcessType = DMLObj.GetProcessTypeById(ProcessObj.ProcessTypeId);
     if (DMLObj.ProcessEditById(ProcessObj))
     {
         return(RedirectToAction("Index", "SysAdmin", new { Prcs = ProcessObj.Id }));
     }
     ViewBag.ProcessTypes = DMLObj.GetAllProcessTypes();
     return(View(ProcessObj));
 }