Exemplo n.º 1
0
        public ActionResult Edit(TaskdVM poViewModel)
        {
            this.oVAL = new Taskd_Validation(poViewModel, this.oDS);
            this.oVAL.Validate_Edit();

            //Add Error if exists
            for (int i = 0; i < this.oVAL.aValidationMSG.Count; i++)
            {
                ModelState.AddModelError(this.oVAL.aValidationMSG[i].VAL_ERRID, this.oVAL.aValidationMSG[i].VAL_ERRMSG);
            } //End for (int i = 0; i < this.oVAL.aValidationMSG.Count; i++)

            if (ModelState.IsValid)
            {
                this.oCRUD.Update(poViewModel);
                this.oCRUD.Commit();
                if (this.oCRUD.isERR)
                {
                    TempData["ERRMSG"] = this.oCRUD.ERRMSG;
                    return(RedirectToAction("ErrorSYS", "Error"));
                } //End if (!this.oCRUD.isERR) {

                TempData["CRUDSavedOrDelete"] = valFLAG.FLAG_TRUE;
                return(RedirectToAction("Details", new { id = this.oCRUD.ID }));
            }
            return(View(poViewModel));
        }
Exemplo n.º 2
0
        public ActionResult Edit_validate(TaskdVM poViewModel)
        {
            ViewBag.AC_MENU_ID = valMENU.TSK_TASK_VALIDATE;
            this.oVALDetail    = new Taskd_Validation(poViewModel, this.oDSDetail);
            this.oVALDetail.Validate_Edit();

            //Add Error if exists
            for (int i = 0; i < this.oVALDetail.aValidationMSG.Count; i++)
            {
                ModelState.AddModelError(this.oVALDetail.aValidationMSG[i].VAL_ERRID, this.oVALDetail.aValidationMSG[i].VAL_ERRMSG);
            } //End for (int i = 0; i < this.oVAL.aValidationMSG.Count; i++)

            if (ModelState.IsValid)
            {
                this.oCRUD.Update_validate(poViewModel);
                if (this.oCRUD.isERR)
                {
                    TempData["ERRMSG"] = this.oCRUD.ERRMSG;
                    return(RedirectToAction("ErrorSYS", "Error"));
                } //End if (!this.oCRUD.isERR) {

                TempData["CRUDSavedOrDelete"] = valFLAG.FLAG_TRUE;
                return(RedirectToAction("Details2", new { id = this.oCRUD.DETAIL_ID }));
            }
            this.prepareLookup();
            ViewBag.VALIDATESTS = this.oDSValidatests.getDatalist_lookup();
            return(View(poViewModel));
        }
Exemplo n.º 3
0
 public ActionResult Delete(int?id = null)
 {
     //ViewBag.AC_MENU_ID = valMENU.MODULE_DELETE;
     ViewBag.CRUD_type = hlpFlags_CRUDOption.DELETE;
     this.oData        = oDS.getData(id);
     if (this.oData == null)
     {
         return(HttpNotFound());
     }
     return(View(this.oData));
 }
Exemplo n.º 4
0
        public ActionResult Details(int?id = null)
        {
            //ViewBag.AC_MENU_ID = valMENU.MODULE_DETAILS;
            ViewBag.CRUD_type         = hlpFlags_CRUDOption.VIEW;
            ViewBag.CRUDSavedOrDelete = TempData["CRUDSavedOrDelete"];

            this.oData = oDS.getData(id);
            if (this.oData == null)
            {
                return(HttpNotFound());
            }
            return(View(this.oData));
        }
Exemplo n.º 5
0
        //BL
        //MAP


        //Init
        private void initConstructor(DBMAINContext poDB)
        {
            //DBContext
            this.db = poDB;
            //VM
            this.oVM = new TaskdVM();
            //DS
            this.oDS = new TaskdDS(this.db);
            //CRUD
            this.oCRUD = new TaskdCRUD(this.db);

            //BL
            //MAP
        } //End initConstructor
Exemplo n.º 6
0
 public ActionResult Edit_validate(int?id = null)
 {
     ViewBag.AC_MENU_ID = valMENU.TSK_TASK_VALIDATE;
     ViewBag.CRUD_type  = hlpFlags_CRUDOption.UPDATE;
     this.oData_detail  = oDSDetail.getData(id);
     if (this.oData_detail == null)
     {
         return(HttpNotFound());
     }
     this.prepareLookup();
     this.setJson();
     ViewBag.VALIDATESTS = this.oDSValidatests.getDatalist_lookup();
     return(View(oData_detail));
 }
Exemplo n.º 7
0
 public ActionResult Edit_progress(int?id = null)
 {
     ViewBag.AC_MENU_ID = valMENU.TSK_TASK_PROGRESS;
     ViewBag.CRUD_type  = hlpFlags_CRUDOption.UPDATE;
     this.oData_detail  = oDSDetail.getData(id);
     if (this.oData_detail == null)
     {
         return(HttpNotFound());
     }
     if (this.oData_detail.RES_ID != hlpConfig.SessionInfo.getAppResId())
     {
         return(RedirectToAction("Error403", "Error"));
     } //end if
     this.prepareLookup();
     this.setJson_progresssts();
     return(View(oData_detail));
 }
Exemplo n.º 8
0
        public ActionResult Create2()
        {
            ViewBag.AC_MENU_ID = valMENU.TSK_TASK_CREATE;
            ViewBag.CRUD_type  = hlpFlags_CRUDOption.CREATE;

            int?nROLE_ID = hlpConfig.SessionInfo.getAppRoleId();
            int?nRES_ID  = hlpConfig.SessionInfo.getAppResId();

            this.oDatadetail_list = oDSDetail_worker.getDatalist(5, nROLE_ID, null, nRES_ID);

            this.oData        = new TaskVM();
            this.oData.DETAIL = oDatadetail_list;
            this.prepareLookup();
            this.setJson();
            this.oData_detail = new TaskdVM();

            this.oData_detail.RESOWNER_ID = nRES_ID;
            return(View(this.oData_detail));
        }
Exemplo n.º 9
0
        public ActionResult Create2_backup(TaskdVM poViewModel)
        {
            ViewBag.AC_MENU_ID = valMENU.TSK_TASK_CREATE;
            TaskVM oViewModel = new TaskVM();

            oViewModel.RES_ID      = poViewModel.RES_ID;
            oViewModel.RESOWNER_ID = poViewModel.RESOWNER_ID;
            oViewModel.TASK_DESC   = poViewModel.TASKD_PLANDESC;
            oViewModel.DETAIL      = new List <TaskdVM>();
            oViewModel.DETAIL.Add(poViewModel);
            //oViewModel.RESOWNER_ID = hlpConfig.SessionInfo.getAppResId();

            this.oVAL = new Task_Validation(oViewModel, this.oDS);
            this.oVAL.Validate_Create();

            //Add Error if exists
            for (int i = 0; i < oVAL.aValidationMSG.Count; i++)
            {
                ModelState.AddModelError(this.oVAL.aValidationMSG[i].VAL_ERRID, this.oVAL.aValidationMSG[i].VAL_ERRMSG);
            } //End for (int i = 0; i < this.oVAL.aValidationMSG.Count; i++)

            if (ModelState.IsValid)
            {
                this.oCRUD.Create(oViewModel);
                if (this.oCRUD.isERR)
                {
                    TempData["ERRMSG"] = this.oCRUD.ERRMSG;
                    return(RedirectToAction("ErrorSYS", "Error"));
                } //End if (!this.oCRUD.isERR) {

                TempData["CRUDSavedOrDelete"] = valFLAG.FLAG_TRUE;
                return(RedirectToAction("Details", new { id = this.oCRUD.ID }));
            } //End if (ModelState.IsValid)
            this.prepareLookup();
            return(View(poViewModel));
        }
Exemplo n.º 10
0
        public ActionResult Create2(TaskdVM poViewModel)
        {
            ViewBag.AC_MENU_ID = valMENU.TSK_TASK_CREATE;

            this.oData_detail = this.oDSDetail.getData(poViewModel.ID);
            if (this.oData_detail != null)
            {
                this.oData = this.oDS.getData(this.oData_detail.TASK_ID);
            } //end if
            if (this.oData == null)
            {
                this.oData = new TaskVM();
            }
            this.oData.DETAIL = new List <TaskdVM>();
            this.oData.DETAIL.Add(poViewModel);
            TaskVM oViewModel = new TaskVM();

            oViewModel.InjectFrom(this.oData);
            oViewModel.TASK_DESC   = poViewModel.TASKD_PLANDESC;
            oViewModel.RES_ID      = poViewModel.RES_ID;
            oViewModel.RESOWNER_ID = poViewModel.RESOWNER_ID;

            this.oVAL = new Task_Validation(oViewModel, this.oDS);
            this.oVAL.Validate_Save();
            //Add Error if exists
            for (int i = 0; i < oVAL.aValidationMSG.Count; i++)
            {
                ModelState.AddModelError(this.oVAL.aValidationMSG[i].VAL_ERRID, this.oVAL.aValidationMSG[i].VAL_ERRMSG);
            } //End for (int i = 0; i < this.oVAL.aValidationMSG.Count; i++)

            if (ModelState.IsValid)
            {
                //this.oCRUD.Create(oViewModel);

                //Create [Do nothing]
                if (poViewModel.DETAIL_ACTION == null)
                {
                    this.oCRUD.Create(oViewModel);
                }                                                                         //end if
                //Create [Do nothing]
                if (poViewModel.DETAIL_ACTION == 1)
                {
                    this.oCRUD.Create(oViewModel);
                }                                                                      //end if
                //Update
                if (poViewModel.DETAIL_ACTION == 2)
                {
                    this.Edit(oViewModel);
                }                                                              //end if
                //Delete
                if (poViewModel.DETAIL_ACTION == 3)
                {
                    this.DeleteConfirmed(oViewModel.ID);
                }                                                                            //end if

                if (this.oCRUD.isERR)
                {
                    TempData["ERRMSG"] = this.oCRUD.ERRMSG;
                    return(RedirectToAction("ErrorSYS", "Error"));
                } //End if (!this.oCRUD.isERR) {

                TempData["CRUDSavedOrDelete"] = valFLAG.FLAG_TRUE;
                return(RedirectToAction("Create2"));
                //return RedirectToAction("Details", new { id = this.oCRUD.ID });
            } //End if (ModelState.IsValid)
            this.prepareLookup();
            return(View(poViewModel));
        }