Exemple #1
0
        } //End public void CreateCPAR(User_DetailCPARVM poViewModel, HttpPostedFileBase poFileimage)
        public void UpdateCPAR(User_DetailCPARVM poViewModel, HttpPostedFileBase poFileimage)
        {
            string vsMsgErr = "";
            try
            {
                using (var db = new DBMAINContext())
                {
                    #region User Area
                        User oModel = db.Users.AsNoTracking().SingleOrDefault(fld => fld.RUID == poViewModel.RUID);
                        //Set Field Header
                        oModel.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
                        //Set DTA_STS
                        oModel.DTA_STS = oModel.setDTA_STS(hlpFlags_CRUDOption.UPDATE);
                        //Set BP_STS (Active)
                        oModel.setActivate();
                        //Set model from Viewmodel
                        oModel.USR_NM1 = poViewModel.USR_NM1;
                        oModel.USR_PSWD = hlpObf.randomEncrypt(poViewModel.USR_PSWD);
                    #endregion

                    #region Employee Area
                        Employee oModelEmployee = db.Employees.AsNoTracking().SingleOrDefault(fld => fld.RUID == oModel.RES_RUID);
                        //Set Field Header
                        oModelEmployee.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
                        //Set DTA_STS
                        oModelEmployee.DTA_STS = oModel.setDTA_STS(hlpFlags_CRUDOption.UPDATE);
                        //Set RES_TYPE
                        oModelEmployee.setRES_TYPE();
                        //Set model from Viewmodel
                        oModelEmployee.RES_NM1 = poViewModel.USR_NM1;
                        oModelEmployee.DEPT_RUID = poViewModel.DEPT_RUID;

                        //Set Image file name
                        if (poFileimage != null)
                        {
                            oModelEmployee.IMG_SRC = Utility_FileUploadDownload.setImage(oModelEmployee.RUID);
                            Utility_FileUploadDownload.saveImage_Employee(poFileimage, oModelEmployee.IMG_SRC);
                        } //End if (poFileimage != null)

                    #endregion

                    //Process CRUD
                    db.Entry(oModel).State = EntityState.Modified;
                    db.Entry(oModelEmployee).State = EntityState.Modified;
                    //Save to Database
                    db.SaveChanges();
                    this.RUID = oModel.RUID;
                } //End using
            } //End try
            catch (Exception e) { vsMsgErr = e.Message; } //End catch
        } //End public void UpdateCPAR(User_DetailCPARVM poViewModel, HttpPostedFileBase poFileimage)
        }                                                 //End public void Create

        public void Update(Complain_DetailVM poViewModel)
        {
            string vsMsgErr = "";

            try
            {
                using (var db = new DBMAINContext())
                {
                    Complain oModel = db.Complains.AsNoTracking().SingleOrDefault(fld => fld.RUID == poViewModel.RUID);
                    poViewModel.COMPLAIN_STS = oModel.COMPLAIN_STS;
                    poViewModel.IS_CPAR      = oModel.IS_CPAR;
                    //Map Form Data
                    Mapper.CreateMap <Complain_DetailVM, Complain>();
                    oModel = Mapper.Map <Complain_DetailVM, Complain>(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
                    //Set DTA_STS
                    oModel.DTA_STS = valFLAG.FLAG_CRUDOPT_CREATE;
                    //Process CRUD
                    db.Entry(oModel).State = EntityState.Modified;
                    db.SaveChanges();
                }                                         //End using
            }                                             //End try
            catch (Exception e) { vsMsgErr = e.Message; } //End catch
        }                                                 //End public void Update
Exemple #3
0
        }                                                 //End public void Cancel(CPAR_VerifyVM poViewModel)

        //PATCH morefeature#1
        public void patch_morefeature1(CPAR_DetailVM poViewModel)
        {
            string vsMsgErr = "";

            try
            {
                using (var db = new DBMAINContext())
                {
                    var oData = oDSCPAR.getDatalist();
                    foreach (var item in oData)
                    {
                        CPAR oModel = db.CPARs.AsNoTracking().SingleOrDefault(fld => fld.RUID == item.RUID);
                        //Set CPAR_FINISG_DT base on CPAR_DT
                        if (oModel.CPAR_FINISH_DT == null)
                        {
                            oModel.setFIELD_finishdate();
                        } //End if (oModel.CPAR_FINISH_DT == null)

                        //Set CPAR_RSPNLMT_DT base on CPAR_DT
                        oModel.setFIELD_responsedate();
                        //Set CPAR_VERLMT_DT base on CPAR_DT
                        oModel.setFIELD_verifydate();
                        //Process CRUD
                        db.Entry(oModel).State = EntityState.Modified;
                        //Process CRUD
                        db.SaveChanges();
                    }                                     //End foreach (var item in oData)
                }                                         //End using
            }                                             //End try
            catch (Exception e) { vsMsgErr = e.Message; } //End catch
        }                                                 //End public void patch_morefeature1(CPAR_DetailVM poViewModel)
        }                                                                                      //End public void Create

        public void Update(StudentdetailVM poViewModel, HttpPostedFileBase poFileimage = null)
        {
            try
            {
                using (var db = new DBMAINContext())
                {
                    Student oModel = db.Students.AsNoTracking().SingleOrDefault(fld => fld.ID == poViewModel.ID);
                    //Map Form Data
                    oModel.InjectFrom(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
                    //Set DTA_STS
                    oModel.DTA_STS = valFLAG.FLAG_DTA_STS_UPDATE;
                    //Set Image file name
                    if (poFileimage != null)
                    {
                        if ((oModel.STUDENT_IMG == null) || (oModel.STUDENT_IMG == ""))
                        {
                            oModel.STUDENT_IMG = Utility_FileUploadDownload.setImage_Student();
                        }
                    }                                                                                                                                                                    //End if (poFileimage != null)
                    //Process CRUD
                    db.Entry(oModel).State = EntityState.Modified;
                    db.SaveChanges();
                    this.ID = oModel.ID;

                    //Save file
                    if (poFileimage != null)
                    {
                        Utility_FileUploadDownload.saveImage_Student(poFileimage, oModel.STUDENT_IMG);
                    }                                                                        //End if (poFileimage != null)
                }                                                                            //End using
            }                                                                                //End try
            catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Update" + e.Message; } //End catch
        }                                                                                    //End public void Update
        }                                                                                      //End public void Create

        public void Update(SuggestdetailVM poViewModel)
        {
            try
            {
                using (var db = new DBMAINContext())
                {
                    poViewModel.SHORT_DESC = poViewModel.FULL_DESC;
                    Suggest         oModel       = db.Suggests.AsNoTracking().SingleOrDefault(fld => fld.ID == poViewModel.ID);
                    SuggesthiddenVM oModelhidden = new SuggesthiddenVM();
                    oModelhidden.InjectFrom(oModel);
                    poViewModel.InjectFrom(oModelhidden);

                    //Map Form Data
                    oModel.InjectFrom(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
                    //Process CRUD
                    db.Entry(oModel).State = EntityState.Modified;
                    db.SaveChanges();
                    this.ID          = oModel.ID;
                    this.TIMELINE_ID = oModel.TIMELINE_ID;
                }                                                                            //End using
            }                                                                                //End try
            catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Update" + e.Message; } //End catch
        }                                                                                    //End public void Update
        }                                                 //End public void Update

        public void UpdateQuit(Employee_DetailVM poViewModel)
        {
            string vsMsgErr = "";

            try
            {
                using (var db = new DBMAINContext())
                {
                    #region Employee
                    Employee oModel = db.Employees.AsNoTracking().SingleOrDefault(fld => fld.RUID == poViewModel.RUID);
                    //Map Form Data
                    Mapper.CreateMap <Employee_DetailVM, Employee>();
                    oModel = Mapper.Map <Employee_DetailVM, Employee>(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
                    //Set DTA_STS
                    oModel.DTA_STS = oModel.setDTA_STS(hlpFlags_CRUDOption.UPDATE);
                    //Set RES_TYPE
                    oModel.setRES_TYPE();
                    //Set BP_STS
                    oModel.BP_STS = APPBASE.Svcbiz.valFLAG.FLAG_EMP_BPSTS_QUIT;

                    //Process CRUD
                    db.Entry(oModel).State = EntityState.Modified;
                    db.SaveChanges();
                    #endregion
                }                                         //End using
            }                                             //End try
            catch (Exception e) { vsMsgErr = e.Message; } //End catch
        }                                                 //End public void Update
        }                                                 //End public void Delete

        public void Career(Employee_DetailVM poViewModel)
        {
            string vsMsgErr = "";

            try
            {
                using (var db = new DBMAINContext())
                {
                    //Get Current Data by RUID
                    Employee oModel = db.Employees.AsNoTracking().SingleOrDefault(fld => fld.RUID == poViewModel.RUID);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
                    //Set DTA_STS
                    oModel.DTA_STS = oModel.setDTA_STS(hlpFlags_CRUDOption.UPDATE);
                    //Set Job info
                    oModel.RES_STS        = poViewModel.RES_STS;
                    oModel.DEPT_RUID      = poViewModel.DEPT_RUID;
                    oModel.JOB_TITLE_RUID = poViewModel.JOB_TITLE_RUID;
                    oModel.JOIN_DT        = poViewModel.JOIN_DT;
                    oModel.JAMSOSTEK_NO   = poViewModel.JAMSOSTEK_NO;

                    //Process CRUD
                    db.Entry(oModel).State = EntityState.Modified;
                    db.SaveChanges();
                }                                         //End using
            }                                             //End try
            catch (Exception e) { vsMsgErr = e.Message; } //End catch
        }                                                 //End public void Update
Exemple #8
0
        }                                                 //End public void Close(CPAR_VerifyVM poViewModel)

        public void Cancel(CPAR_VerifyVM poViewModel)
        {
            string vsMsgErr = "";

            try
            {
                using (var db = new DBMAINContext())
                {
                    CPAR oModel = db.CPARs.AsNoTracking().SingleOrDefault(fld => fld.RUID == poViewModel.RUID);
                    //Map Form Data
                    //Mapper.CreateMap<CPAR_DetailVM, CPAR>();
                    //oModel = Mapper.Map<CPAR_DetailVM, CPAR>(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
                    //Set DTA_STS
                    oModel.DTA_STS = valFLAG.FLAG_CRUDOPT_UPDATE;
                    //Set FIELD
                    oModel.setFIELD_cancel();
                    //Process CRUD
                    db.Entry(oModel).State = EntityState.Modified;
                    db.SaveChanges();
                    this.RUID = oModel.RUID;
                }                                         //End using
            }                                             //End try
            catch (Exception e) { vsMsgErr = e.Message; } //End catch
        }                                                 //End public void Cancel(CPAR_VerifyVM poViewModel)
Exemple #9
0
        }                                                           //End public UserCRUD()

        //ALL
        public void Changepassword(UserChangepasswordVM poViewModel)
        {
            try
            {
                using (var db = new DBMAINContext())
                {
                    User oModel = db.Users.AsNoTracking().SingleOrDefault(fld => fld.ID == poViewModel.ID);
                    poViewModel.PASSWORD_NEW = hlpObf.randomEncrypt(poViewModel.PASSWORD_NEW);
                    oModel.PASSWORD          = poViewModel.PASSWORD_NEW;
                    //Process CRUD
                    db.Entry(oModel).State = EntityState.Modified;
                    db.SaveChanges();
                    this.ID = oModel.ID;
                }                                                                            //End using
            }                                                                                //End try
            catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Update" + e.Message; } //End catch
        }                                                                                    //End public void Update
Exemple #10
0
 } //End public void ActivateCPAR(string id)
 public void DeactivateCPAR(string id)
 {
     string vsMsgErr = "";
     try
     {
         using (var db = new DBMAINContext())
         {
             User oModel = db.Users.AsNoTracking().SingleOrDefault(fld => fld.RUID == id);
             oModel.setDeactivate();
             //Set Field Header
             oModel.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
             //Process CRUD
             db.Entry(oModel).State = EntityState.Modified;
             db.SaveChanges();
         } //End using
     } //End try
     catch (Exception e) { vsMsgErr = e.Message; } //End catch
 } //End public void DeactivateCPAR(string id)
Exemple #11
0
        }                                                                                      //End public void Create

        public void Update(ThemedetailVM poViewModel)
        {
            try
            {
                using (var db = new DBMAINContext())
                {
                    Theme oModel = db.Themes.AsNoTracking().SingleOrDefault(fld => fld.ID == poViewModel.ID);
                    //Map Form Data
                    oModel.InjectFrom(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
                    //Process CRUD
                    db.Entry(oModel).State = EntityState.Modified;
                    db.SaveChanges();
                    this.ID = oModel.ID;
                }                                                                            //End using
            }                                                                                //End try
            catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Update" + e.Message; } //End catch
        }                                                                                    //End public void Update
Exemple #12
0
        } //End public void Deactivate

        public void Create_Usermenu(Userrole_DetailVM poViewModel, string psMDLE_RUID)
        {
            string vsMsgErr = "";

            try
            {
                using (var db = new DBMAINContext())
                {
                    ////Map Form Data
                    //List<Userrolemenu_ListVM> oUserrolemenu_ListVM = poViewModel.Userrolemenu_ListVM;
                    //Mapper.CreateMap < List<Userrolemenu_ListVM>, List<Usermenu>>();
                    Mapper.CreateMap<Userrolemenu_ListVM, Usermenu>();
                    List<Usermenu> oModel = Mapper.Map<List<Userrolemenu_ListVM>, List<Usermenu>>(poViewModel.Userrolemenu_ListVM);
                    var oCurrentModel = db.Usermenus.Where(fld => fld.MDLE_RUID == psMDLE_RUID &&
                                        fld.USR_RUID == poViewModel.RUID);
                    //Delete old usermenu
                    foreach (Usermenu item in oCurrentModel) { db.Usermenus.Remove(item); } //End foreach
                    //Add New usermenu
                    foreach (Usermenu item in oModel) {
                        item.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                        item.MDLE_RUID = psMDLE_RUID;
                        item.USR_RUID = poViewModel.RUID;
                        item.IS_GRANTED = hlpGeneral.FlagInfo.getFlagValid();
                        db.Usermenus.Add(item);
                    } //End foreach
                    //Update User (field ROLE_RUID)
                    User oModelUser = db.Users.AsNoTracking().SingleOrDefault(fld => fld.RUID == poViewModel.RUID);
                    //Set Field Header
                    oModelUser.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
                    //Set ROLE_RUID
                    oModelUser.ROLE_RUID = poViewModel.ROLE_RUID;
                    //Process CRUD
                    db.Entry(oModelUser).State = EntityState.Modified;
                    
                    //Save Database
                    db.SaveChanges();
                    
                    
                } //End using
            } //End try
            catch (Exception e) { vsMsgErr = e.Message; } //End catch
        } //End public void Create
Exemple #13
0
 } //End public void Create
 public void Update(User_DetailVM poViewModel)
 {
     string vsMsgErr = "";
     try
     {
         using (var db = new DBMAINContext())
         {
             User oModel = db.Users.AsNoTracking().SingleOrDefault(fld => fld.RUID == poViewModel.RUID);
             //Map Form Data
             Mapper.CreateMap<User_DetailVM, User>();
             oModel = Mapper.Map<User_DetailVM, User>(poViewModel);
             //Set Field Header
             oModel.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
             //Process CRUD
             db.Entry(oModel).State = EntityState.Modified;
             db.SaveChanges();
         } //End using
     } //End try
     catch (Exception e) { vsMsgErr = e.Message; } //End catch
 } //End public void Update
Exemple #14
0
        }                                                 //End public void patch_hotfix2()

        //PATCH Patchhotfix3
        public void patch_hotfix3()
        {
            string vsMsgErr = "";

            try
            {
                using (var db = new DBMAINContext())
                {
                    var oData = oDSCPAR.getDatalist_Patchhotfix3();
                    foreach (var item in oData)
                    {
                        CPAR oModel = db.CPARs.AsNoTracking().SingleOrDefault(fld => fld.RUID == item.RUID);
                        //Set CPAR_VERLMT_DT base on CPAR_DT
                        oModel.setFIELD_verifydate();
                        //Process CRUD
                        db.Entry(oModel).State = EntityState.Modified;
                        //Process CRUD
                        db.SaveChanges();
                    }                                     //End foreach (var item in oData)
                }                                         //End using
            }                                             //End try
            catch (Exception e) { vsMsgErr = e.Message; } //End catch
        }                                                 //End public void patch_hotfix3()
        }                                                                                    //End public void Delete

        public void Rollup_RECEIPTNO()
        {
            try
            {
                using (var db = new DBMAINContext())
                {
                    Mainconfig oModel = db.Mainconfigs.AsNoTracking().FirstOrDefault();
                    if (oModel.RECEIPT_NO == null)
                    {
                        oModel.RECEIPT_NO = 1;
                    }
                    else
                    {
                        oModel.RECEIPT_NO = oModel.RECEIPT_NO + 1;
                    }
                    //Process CRUD
                    db.Entry(oModel).State = EntityState.Modified;
                    db.SaveChanges();
                    this.ID         = oModel.ID;
                    this.RECEIPT_NO = oModel.RECEIPT_NO;
                }                                                                            //End using
            }                                                                                //End try
            catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Update" + e.Message; } //End catch
        }                                                                                    //End public void Update
Exemple #16
0
        }                                                 //End public void Create

        public void Update(CPAR_DetailVM poViewModel)
        {
            string vsMsgErr = "";

            try
            {
                using (var db = new DBMAINContext())
                {
                    CPAR oModel = db.CPARs.AsNoTracking().SingleOrDefault(fld => fld.RUID == poViewModel.RUID);
                    poViewModel.CPAR_STS         = oModel.CPAR_STS;
                    poViewModel.CPAR_TYPE        = oModel.CPAR_TYPE;
                    poViewModel.AUDITORDEPT_RUID = oModel.AUDITORDEPT_RUID;
                    poViewModel.AUDITEEDEPT_RUID = oModel.AUDITEEDEPT_RUID;

                    //Reflect data VM
                    if (oModel.CPAR_TYPE == valFLAG.FLAG_CPAR_TYPE_CC)
                    {
                        poViewModel.AUDITEE_RUID     = oModel.AUDITEE_RUID;
                        poViewModel.AUDITEEDEPT_RUID = oModel.AUDITEEDEPT_RUID;
                        poViewModel.CPAR_DT          = oModel.CPAR_DT;
                        poViewModel.CPAR_TRGT_DT     = oModel.CPAR_TRGT_DT;
                        //poViewModel.CPAR_DESC = oModel.CPAR_DESC;
                        poViewModel.CPAR_RESOLUTION2 = oModel.CPAR_RESOLUTION2;
                        poViewModel.COMPLAIN_RUID    = oModel.COMPLAIN_RUID;
                    } //End if (this.CPAR_TYPE == valFLAG.FLAG_CPAR_TYPE_CC)

                    //Map Form Data
                    Mapper.CreateMap <CPAR_DetailVM, CPAR>();
                    oModel = Mapper.Map <CPAR_DetailVM, CPAR>(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
                    //Set DTA_STS
                    oModel.DTA_STS = valFLAG.FLAG_CRUDOPT_UPDATE;
                    //Set FIELD
                    oModel.setFIELD();

                    //Set CPAR_FINISG_DT base on CPAR_DT
                    //oModel.setFIELD_finishdate(poViewModel);
                    oModel.setFIELD_finishdate();
                    //Set CPAR_RSPNLMT_DT base on CPAR_DT
                    //oModel.setFIELD_responsedate(poViewModel);
                    oModel.setFIELD_responsedate();
                    //Set CPAR_VERLMT_DT base on CPAR_DT
                    //oModel.setFIELD_verifydate(poViewModel);
                    oModel.setFIELD_verifydate();

                    //Process CRUD
                    db.Entry(oModel).State = EntityState.Modified;

                    //Set CPAR_stdref Delete by CPAR RUID
                    oCRUD_Stdref  = new CPARStdrefCRUD();
                    oDSCPARStdref = new CPARStdrefDS();
                    var oQRY = oDSCPARStdref.getDatalist_byCPAR_RUID(oModel.RUID);
                    foreach (var item in oQRY)
                    {
                        CPARStdref oItem = db.CPARStdrefs.Find(item.RUID);
                        db.CPARStdrefs.Remove(oItem);
                    } //End foreach (var item in oQRY)

                    //Set CPAR_stdref Add by STDREF_LIST
                    if (poViewModel.STDREF_LIST != null)
                    {
                        foreach (var item in poViewModel.STDREF_LIST)
                        {
                            //LASTWORK
                            CPARStdref_DetailVM oItem = new CPARStdref_DetailVM();
                            //Map Form Data
                            Mapper.CreateMap <CPARStdref_ListVM, CPARStdref_DetailVM>();
                            oItem           = Mapper.Map <CPARStdref_ListVM, CPARStdref_DetailVM>(item);
                            oItem.CPAR_RUID = oModel.RUID;
                            oCRUD_Stdref.Create_prepare(oItem);

                            db.CPARStdrefs.Add(oCRUD_Stdref.oModel);
                        } //End foreach (var item in poViewModel.STDREF_LIST)
                    }     //End if (poViewModel.STDREF_LIST != null)

                    //Process CRUD
                    db.SaveChanges();
                    this.RUID = oModel.RUID;
                }                                         //End using
            }                                             //End try
            catch (Exception e) { vsMsgErr = e.Message; } //End catch
        }                                                 //End public void Update
Exemple #17
0
        } //End public void SaveNEW

        public void SaveNEW_create(Transaction_indetailVM poViewModel)
        {
            try
            {
                using (var db = new DBMAINContext())
                {
                    //TRN
                    Transaction_in oModelTRN = new Transaction_in();
                    //Map Form Data
                    oModelTRN.InjectFrom(poViewModel);
                    //Set Field Header
                    oModelTRN.setFIELD_HEADER(this.FIELD_HEADER);
                    //Set DTA_STS
                    oModelTRN.DTA_STS = this.DTA_STS;
                    //Process CRUD
                    db.Transaction_ins.Add(oModelTRN);
                    //Update database
                    db.SaveChanges();
                    this.ID     = oModelTRN.ID;
                    this.TRN_DT = oModelTRN.TRN_DT;

                    //INST
                    Installment_in        oModelINST  = null;
                    List <Installment_in> LIST_INST   = new List <Installment_in>();
                    Installment_in        DETAIL_INST = null;

                    //INST - SPP
                    if (poViewModel.MONTHLY_INST_SPP != null)
                    {
                        poViewModel.MONTHLY_INST = poViewModel.MONTHLY_INST_SPP;
                        //Create
                        if (poViewModel.MONTHLY_INST.DTA_STS == valFLAG.FLAG_DTA_STS_CREATE)
                        {
                            oModelINST = new Installment_in();
                            //Map Form Data
                            oModelINST.InjectFrom(poViewModel.MONTHLY_INST);
                            //Set Field Header
                            oModelINST.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                            //Set DTA_STS : Set in METHOD controller
                            //oModelINST.DTA_STS = this.DTA_STS;
                            //Set TRN_DT
                            oModelINST.INST_DT = this.TRN_DT;
                            //Process CRUD
                            db.Installment_ins.Add(oModelINST);
                        } //End if (poViewModel.MONTHLY_INST.DTA_STS == valFLAG.FLAG_DTA_STS_CREATE)
                        //Update
                        if (poViewModel.MONTHLY_INST.DTA_STS == valFLAG.FLAG_DTA_STS_UPDATE)
                        {
                            oModelINST = db.Installment_ins.AsNoTracking().SingleOrDefault(fld => fld.ID == poViewModel.MONTHLY_INST.ID);
                            //Map Form Data
                            oModelINST.InjectFrom(poViewModel.MONTHLY_INST);
                            //Set Field Header
                            oModelINST.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
                            //Set DTA_STS : Set in METHOD controller
                            //oModelINST.DTA_STS = this.DTA_STS;
                            //Process CRUD
                            db.Entry(oModelINST).State = EntityState.Modified;
                        } //End if (poViewModel.MONTHLY_INST.DTA_STS == valFLAG.FLAG_DTA_STS_UPDATE)
                        //Update database-SPP
                        db.SaveChanges();
                        DETAIL_INST             = new Installment_in();
                        DETAIL_INST.ID          = oModelINST.ID;
                        DETAIL_INST.INST_TYPEID = oModelINST.INST_TYPEID;
                        LIST_INST.Add(DETAIL_INST);
                    } //End if (poViewModel.MONTHLY_INST_SPP != null)

                    //INST - EKSKUL
                    if (poViewModel.MONTHLY_INST_EKSKUL != null)
                    {
                        poViewModel.MONTHLY_INST = poViewModel.MONTHLY_INST_EKSKUL;
                        //Create
                        if (poViewModel.MONTHLY_INST.DTA_STS == valFLAG.FLAG_DTA_STS_CREATE)
                        {
                            oModelINST = new Installment_in();
                            //Map Form Data
                            oModelINST.InjectFrom(poViewModel.MONTHLY_INST);
                            //Set Field Header
                            oModelINST.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                            //Set DTA_STS : Set in METHOD controller
                            //oModelINST.DTA_STS = this.DTA_STS;
                            //Set TRN_DT
                            oModelINST.INST_DT = this.TRN_DT;
                            //Process CRUD
                            db.Installment_ins.Add(oModelINST);
                        } //End if (poViewModel.MONTHLY_INST.DTA_STS == valFLAG.FLAG_DTA_STS_CREATE)
                        //Update
                        if (poViewModel.MONTHLY_INST.DTA_STS == valFLAG.FLAG_DTA_STS_UPDATE)
                        {
                            oModelINST = db.Installment_ins.AsNoTracking().SingleOrDefault(fld => fld.ID == poViewModel.MONTHLY_INST.ID);
                            //Map Form Data
                            oModelINST.InjectFrom(poViewModel.MONTHLY_INST);
                            //Set Field Header
                            oModelINST.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
                            //Set DTA_STS : Set in METHOD controller
                            //oModelINST.DTA_STS = this.DTA_STS;
                            //Process CRUD
                            db.Entry(oModelINST).State = EntityState.Modified;
                        } //End if (poViewModel.MONTHLY_INST.DTA_STS == valFLAG.FLAG_DTA_STS_UPDATE)
                        //Update database-EKSKUL
                        db.SaveChanges();
                        DETAIL_INST             = new Installment_in();
                        DETAIL_INST.ID          = oModelINST.ID;
                        DETAIL_INST.INST_TYPEID = oModelINST.INST_TYPEID;
                        LIST_INST.Add(DETAIL_INST);
                    } //End if (poViewModel.MONTHLY_INST_EKSKUL != null)

                    //INST - SCLUB
                    if (poViewModel.MONTHLY_INST_SCLUB != null)
                    {
                        poViewModel.MONTHLY_INST = poViewModel.MONTHLY_INST_SCLUB;
                        //Create
                        if (poViewModel.MONTHLY_INST.DTA_STS == valFLAG.FLAG_DTA_STS_CREATE)
                        {
                            oModelINST = new Installment_in();
                            //Map Form Data
                            oModelINST.InjectFrom(poViewModel.MONTHLY_INST);
                            //Set Field Header
                            oModelINST.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                            //Set DTA_STS : Set in METHOD controller
                            //oModelINST.DTA_STS = this.DTA_STS;
                            //Set TRN_DT
                            oModelINST.INST_DT = this.TRN_DT;
                            //Process CRUD
                            db.Installment_ins.Add(oModelINST);
                        } //End if (poViewModel.MONTHLY_INST.DTA_STS == valFLAG.FLAG_DTA_STS_CREATE)
                        //Update
                        if (poViewModel.MONTHLY_INST.DTA_STS == valFLAG.FLAG_DTA_STS_UPDATE)
                        {
                            oModelINST = db.Installment_ins.AsNoTracking().SingleOrDefault(fld => fld.ID == poViewModel.MONTHLY_INST.ID);
                            //Map Form Data
                            oModelINST.InjectFrom(poViewModel.MONTHLY_INST);
                            //Set Field Header
                            oModelINST.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
                            //Set DTA_STS : Set in METHOD controller
                            //oModelINST.DTA_STS = this.DTA_STS;
                            //Process CRUD
                            db.Entry(oModelINST).State = EntityState.Modified;
                        } //End if (poViewModel.MONTHLY_INST.DTA_STS == valFLAG.FLAG_DTA_STS_UPDATE)
                        //Update database-SCLUB
                        db.SaveChanges();
                        DETAIL_INST             = new Installment_in();
                        DETAIL_INST.ID          = oModelINST.ID;
                        DETAIL_INST.INST_TYPEID = oModelINST.INST_TYPEID;
                        LIST_INST.Add(DETAIL_INST);
                    } //End if (poViewModel.MONTHLY_INST_SCLUB != null)

                    //INST - RANDOM
                    if (oViewModel.INSTLIST != null)
                    {
                        foreach (var item in oViewModel.INSTLIST)
                        {
                            poViewModel.INST = item;
                            //Create
                            if (poViewModel.INST.DTA_STS == valFLAG.FLAG_DTA_STS_CREATE)
                            {
                                oModelINST = new Installment_in();
                                //Map Form Data
                                oModelINST.InjectFrom(poViewModel.INST);
                                //Set Field Header
                                oModelINST.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                                //Set DTA_STS : Set in METHOD controller
                                //oModelINST.DTA_STS = this.DTA_STS;
                                //Set TRN_DT
                                oModelINST.INST_DT = this.TRN_DT;
                                //Process CRUD
                                db.Installment_ins.Add(oModelINST);
                            } //End if (poViewModel.MONTHLY_INST.DTA_STS == valFLAG.FLAG_DTA_STS_CREATE)
                            //Update
                            if (poViewModel.INST.DTA_STS == valFLAG.FLAG_DTA_STS_UPDATE)
                            {
                                oModelINST = db.Installment_ins.AsNoTracking().SingleOrDefault(fld => fld.ID == poViewModel.INST.ID);
                                //Map Form Data
                                oModelINST.InjectFrom(poViewModel.INST);
                                //Set Field Header
                                oModelINST.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
                                //Set DTA_STS : Set in METHOD controller
                                //oModelINST.DTA_STS = this.DTA_STS;
                                //Process CRUD
                                db.Entry(oModelINST).State = EntityState.Modified;
                            } //End if (poViewModel.MONTHLY_INST.DTA_STS == valFLAG.FLAG_DTA_STS_UPDATE)

                            //Save data
                            db.SaveChanges();
                            DETAIL_INST             = new Installment_in();
                            DETAIL_INST.ID          = oModelINST.ID;
                            DETAIL_INST.INST_TYPEID = oModelINST.INST_TYPEID;
                            LIST_INST.Add(DETAIL_INST);
                        } //End foreach (var item in oViewModel.INSTLIST)
                    }     //End if (oViewModel.INSTLIST != null)

                    //TRNDetail
                    Transaction_ind oModelTRN_detail = null;
                    foreach (var item in poViewModel.DETAIL)
                    {
                        oModelTRN_detail = new Transaction_ind();
                        item.TRN_ID      = this.ID;
                        //item.INST_ID = this.INST_ID;
                        if (LIST_INST.Count > 0)
                        {
                            var oData_INST = LIST_INST.Where(fld => fld.INST_TYPEID == item.TRINTYPE_ID).SingleOrDefault();
                            if (oData_INST != null)
                            {
                                item.INST_ID = oData_INST.ID;
                            }
                        } //End if (LIST_INST.Count > 0)


                        //Map Form Data
                        oModelTRN_detail.InjectFrom(item);
                        //Set Field Header
                        oModelTRN_detail.setFIELD_HEADER(this.FIELD_HEADER);
                        //Set DTA_STS
                        oModelTRN_detail.DTA_STS = this.DTA_STS;

                        //Process CRUD
                        db.Transaction_inds.Add(oModelTRN_detail);
                    } //End foreach (var item in poViewModel.DETAIL)
                    //Update database
                    db.SaveChanges();
                }                                                                              //End using
            }                                                                                  //End try
            catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Create: " + e.Message; } //End catch
        }                                                                                      //End public void Create_bulk
Exemple #18
0
        } //End private Installment_in setINST(Installment_in oModelINST)

        public void SaveNEW_create_BACKUP(Transaction_indetailVM poViewModel)
        {
            try
            {
                using (var db = new DBMAINContext())
                {
                    //TRN
                    Transaction_in oModelTRN = new Transaction_in();
                    //Map Form Data
                    oModelTRN.InjectFrom(poViewModel);
                    //Set Field Header
                    oModelTRN.setFIELD_HEADER(this.FIELD_HEADER);
                    //Set DTA_STS
                    oModelTRN.DTA_STS = this.DTA_STS;
                    //Process CRUD
                    db.Transaction_ins.Add(oModelTRN);
                    //Update database
                    db.SaveChanges();
                    this.ID     = oModelTRN.ID;
                    this.TRN_DT = oModelTRN.TRN_DT;

                    //INST - SPP
                    Installment_in oModelINST = null;
                    //Create
                    if (poViewModel.MONTHLY_INST.DTA_STS == valFLAG.FLAG_DTA_STS_CREATE)
                    {
                        oModelINST = new Installment_in();
                        //Map Form Data
                        oModelINST.InjectFrom(poViewModel.MONTHLY_INST);
                        //Set Field Header
                        oModelINST.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                        //Set DTA_STS : Set in METHOD controller
                        //oModelINST.DTA_STS = this.DTA_STS;
                        //Set TRN_DT
                        oModelINST.INST_DT = this.TRN_DT;
                        //Process CRUD
                        db.Installment_ins.Add(oModelINST);
                    } //End if (poViewModel.MONTHLY_INST.DTA_STS == valFLAG.FLAG_DTA_STS_CREATE)
                    //Update
                    if (poViewModel.MONTHLY_INST.DTA_STS == valFLAG.FLAG_DTA_STS_UPDATE)
                    {
                        oModelINST = db.Installment_ins.AsNoTracking().SingleOrDefault(fld => fld.ID == poViewModel.ID);
                        //Map Form Data
                        oModelINST.InjectFrom(poViewModel.MONTHLY_INST);
                        //Set Field Header
                        oModelINST.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
                        //Set DTA_STS : Set in METHOD controller
                        //oModelINST.DTA_STS = this.DTA_STS;
                        //Process CRUD
                        db.Entry(oModelINST).State = EntityState.Modified;
                    } //End if (poViewModel.MONTHLY_INST.DTA_STS == valFLAG.FLAG_DTA_STS_UPDATE)

                    //Update database
                    db.SaveChanges();
                    this.INST_ID = oModelINST.ID;

                    //TRNDetail
                    Transaction_ind oModelTRN_detail = null;
                    foreach (var item in poViewModel.DETAIL)
                    {
                        oModelTRN_detail = new Transaction_ind();
                        item.TRN_ID      = this.ID;
                        item.INST_ID     = this.INST_ID;
                        //Map Form Data
                        oModelTRN_detail.InjectFrom(item);
                        //Set Field Header
                        oModelTRN_detail.setFIELD_HEADER(this.FIELD_HEADER);
                        //Set DTA_STS
                        oModelTRN_detail.DTA_STS = this.DTA_STS;

                        //Process CRUD
                        db.Transaction_inds.Add(oModelTRN_detail);
                    } //End foreach (var item in poViewModel.DETAIL)
                    //Update database
                    db.SaveChanges();
                }                                                                              //End using
            }                                                                                  //End try
            catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Create: " + e.Message; } //End catch
        }                                                                                      //End public void Create_bulk
Exemple #19
0
        } //End public void setCPAR_TYPE(string psCPAR_TYPE)

        public void Create(CPAR_DetailVM poViewModel)
        {
            string vsMsgErr = "";

            try
            {
                using (var db = new DBMAINContext())
                {
                    CPAR oModel = new CPAR();
                    //Map Form Data
                    Mapper.CreateMap <CPAR_DetailVM, CPAR>();
                    oModel = Mapper.Map <CPAR_DetailVM, CPAR>(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                    //Set DTA_STS
                    oModel.DTA_STS = valFLAG.FLAG_CRUDOPT_CREATE;
                    //Set CPAR_STS
                    oModel.CPAR_STS = valFLAG.FLAG_CPAR_STS_OPEN;
                    //Set CPAR_TYPE
                    oModel.CPAR_TYPE = this.CPAR_TYPE;
                    //Get Config_cparid
                    //oModel.oVMConfig_cparid = oDSConfig_cparid.getData();
                    //Set FIELD
                    oModel.setFIELD();
                    //Set DEPT_RUID Auditor and Auditee
                    if (oModel.AUDITOR_RUID != null)
                    {
                        oModel.AUDITORDEPT_RUID = oDSEmployee.getData_deptruid(oModel.AUDITOR_RUID);
                    } //End if (AUDITOR_RUID != null)
                    if (oModel.AUDITEE_RUID != null)
                    {
                        oModel.AUDITEEDEPT_RUID = oDSEmployee.getData_deptruid(oModel.AUDITEE_RUID);
                    } //End if (AUDITEE_RUID != null)

                    //Set Config CPAR_ID
                    if (oModel.isNEW_CONFIG)
                    {
                        oCRUDConfig_cparid.Create_prepare(oModel.oVMConfig_cparid);
                        db.Config_cparids.Add(oCRUDConfig_cparid.oModel);
                    } //End if (oModel.isNEW_CONFIG)
                    if (!oModel.isNEW_CONFIG)
                    {
                        oCRUDConfig_cparid.Update_prepare(oModel.oVMConfig_cparid);
                        db.Entry(oCRUDConfig_cparid.oModel).State = EntityState.Modified;
                    } //End if (!oModel.isNEW_CONFIG)

                    //Set CPAR_FINISG_DT base on CPAR_DT
                    //oModel.setFIELD_finishdate(poViewModel);
                    oModel.setFIELD_finishdate();
                    //Set CPAR_RSPNLMT_DT base on CPAR_DT
                    //oModel.setFIELD_responsedate(poViewModel);
                    oModel.setFIELD_responsedate();
                    //Set CPAR_VERLMT_DT base on CPAR_DT
                    //oModel.setFIELD_verifydate(poViewModel);
                    oModel.setFIELD_verifydate();

                    //Process CRUD
                    db.CPARs.Add(oModel);


                    //Set CPAR_stdref
                    oCRUD_Stdref = new CPARStdrefCRUD();
                    if (poViewModel.STDREF_LIST != null)
                    {
                        foreach (var item in poViewModel.STDREF_LIST)
                        {
                            CPARStdref_DetailVM oItem = new CPARStdref_DetailVM();
                            //Map Form Data
                            Mapper.CreateMap <CPARStdref_ListVM, CPARStdref_DetailVM>();
                            oItem           = Mapper.Map <CPARStdref_ListVM, CPARStdref_DetailVM>(item);
                            oItem.CPAR_RUID = oModel.RUID;
                            oCRUD_Stdref.Create_prepare(oItem);

                            db.CPARStdrefs.Add(oCRUD_Stdref.oModel);
                        } //End foreach (var item in poViewModel.STDREF_LIST)
                    }     //End if (poViewModel.STDREF_LIST != null)

                    //Process CRUD
                    db.SaveChanges();
                    this.RUID = oModel.RUID;
                }                                         //End using
            }                                             //End try
            catch (Exception e) { vsMsgErr = e.Message; } //End catch
        }                                                 //End public void Create
        }                         //End public ComplainCRUD()

        public void Create(Complain_DetailVM poViewModel)
        {
            string vsMsgErr = "";

            try
            {
                using (var db = new DBMAINContext())
                {
                    Complain oModel = new Complain();
                    //Map Form Data
                    Mapper.CreateMap <Complain_DetailVM, Complain>();
                    oModel = Mapper.Map <Complain_DetailVM, Complain>(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                    //Set DTA_STS
                    oModel.DTA_STS = valFLAG.FLAG_CRUDOPT_CREATE;
                    //Set CPAR_STS
                    oModel.COMPLAIN_STS = valFLAG.FLAG_CPAR_STS_OPEN;
                    //Set field
                    oModel.setFIELD(valFLAG.FLAG_CRUDOPT_CREATE);

                    //Set outo create CPAR
                    if (oModel.IS_CPAR == valFLAG.FLAG_YES)
                    {
                        EmployeeDS oDSEmployee = new EmployeeDS();
                        CPARCRUD   oCRUD_cpar  = new CPARCRUD();
                        oCRUD_cpar.setCPAR_TYPE(valFLAG.FLAG_CPAR_TYPE_CC);
                        //oCRUD_cpar.Create_prepare();

                        oCRUD_cpar.oModel.AUDITOR_RUID     = null;
                        oCRUD_cpar.oModel.AUDITORDEPT_RUID = null;
                        oCRUD_cpar.oModel.AUDITEE_RUID     = poViewModel.PIC_RUID;
                        oCRUD_cpar.oModel.AUDITEEDEPT_RUID = oDSEmployee.getData_deptruid(oCRUD_cpar.oModel.AUDITEE_RUID);
                        oCRUD_cpar.oModel.CPAR_DT          = poViewModel.ISSUED_DT;
                        oCRUD_cpar.oModel.CPAR_TRGT_DT     = poViewModel.TARGET_DT;
                        oCRUD_cpar.oModel.CPAR_DESC        = poViewModel.DESCRIPTION;
                        oCRUD_cpar.oModel.CPAR_RESOLUTION2 = poViewModel.SOLUTION;
                        oCRUD_cpar.oModel.COMPLAIN_RUID    = oModel.RUID;
                        oCRUD_cpar.Create_prepare();

                        //Update model CPAR
                        db.CPARs.Add(oCRUD_cpar.oModel);
                        //Update model config
                        //db.Entry(oCRUD_cpar.oCRUDConfig_cparid.oModel).State = EntityState.Modified;
                        if (oCRUD_cpar.oModel.isNEW_CONFIG)
                        {
                            db.Config_cparids.Add(oCRUD_cpar.oCRUDConfig_cparid.oModel);
                        } //End if (oModel.isNEW_CONFIG)
                        if (!oCRUD_cpar.oModel.isNEW_CONFIG)
                        {
                            db.Entry(oCRUD_cpar.oCRUDConfig_cparid.oModel).State = EntityState.Modified;
                        } //End if (!oModel.isNEW_CONFIG)
                    }     //End if (this.IS_CPAR == valFLAG.FLAG_YES)

                    //Update model Complain
                    db.Complains.Add(oModel);
                    //Process CRUD
                    db.SaveChanges();
                }                                         //End using
            }                                             //End try
            catch (Exception e) { vsMsgErr = e.Message; } //End catch
        }                                                 //End public void Create
        }                                                 //End public void Create

        public void Update(Employee_DetailVM poViewModel, HttpPostedFileBase poFileimage)
        {
            string vsMsgErr = "";

            try
            {
                using (var db = new DBMAINContext())
                {
                    #region Employee
                    Employee oModel = db.Employees.AsNoTracking().SingleOrDefault(fld => fld.RUID == poViewModel.RUID);
                    //Map Form Data
                    Mapper.CreateMap <Employee_DetailVM, Employee>();
                    oModel = Mapper.Map <Employee_DetailVM, Employee>(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
                    //Set DTA_STS
                    oModel.DTA_STS = oModel.setDTA_STS(hlpFlags_CRUDOption.UPDATE);
                    //Set RES_TYPE
                    oModel.setRES_TYPE();

                    //Set Image file name
                    if (poFileimage != null)
                    {
                        oModel.IMG_SRC = Utility_FileUploadDownload.setImage(oModel.RUID);
                        Utility_FileUploadDownload.saveImage_Employee(poFileimage, oModel.IMG_SRC);
                    }     //End if (poFileimage != null)

                    //Process CRUD
                    db.Entry(oModel).State = EntityState.Modified;
                    db.SaveChanges();
                    #endregion

                    #region Employee_address
                    //Delete old address
                    var oModel_address = db.Employee_addresss.Where(fld => fld.RES_RUID == poViewModel.RUID);
                    foreach (Employee_address item in oModel_address)
                    {
                        db.Employee_addresss.Remove(item);
                    }                                                                                            //End foreach

                    //Set Address DOMISILI
                    Employee_address oModel_addressKTP = new Employee_address();
                    //Set Field Header
                    oModel_addressKTP.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                    //Set DTA_STS
                    oModel_addressKTP.DTA_STS = oModel.setDTA_STS(hlpFlags_CRUDOption.CREATE);
                    //Set Address KTP
                    oModel_addressKTP.DTA_STS = oModel.DTA_STS;
                    //oModel_addressKTP.BP_STS = poViewModel.
                    oModel_addressKTP.RES_RUID   = oModel.RUID;
                    oModel_addressKTP.CNTRY_RUID = poViewModel.CNTRY_RUID_IC;
                    oModel_addressKTP.CITY_RUID  = poViewModel.CITY_RUID_IC;
                    oModel_addressKTP.ZIP        = poViewModel.ZIP_IC;
                    oModel_addressKTP.ADDR_TYP   = oModel.setAddressIC();
                    oModel_addressKTP.ADDR1      = poViewModel.ADDR1_IC;
                    oModel_addressKTP.ADDR2      = poViewModel.ADDR2_IC;
                    oModel_addressKTP.ADDR3      = poViewModel.ADDR3_IC;
                    //oModel_addressKTP.ADDR4 = poViewModel.
                    //oModel_addressKTP.ADDR5 = poViewModel.

                    //Set Address DOMISILI
                    Employee_address oModel_addressDOM = new Employee_address();
                    //Set Field Header
                    oModel_addressDOM.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                    //Set DTA_STS
                    oModel_addressDOM.DTA_STS = oModel.setDTA_STS(hlpFlags_CRUDOption.CREATE);
                    oModel_addressDOM.DTA_STS = oModel.DTA_STS;
                    //oModel_addressDOM.BP_STS = poViewModel.
                    oModel_addressDOM.RES_RUID   = oModel.RUID;
                    oModel_addressDOM.CNTRY_RUID = poViewModel.CNTRY_RUID_DMCL;
                    oModel_addressDOM.CITY_RUID  = poViewModel.CITY_RUID_DMCL;
                    oModel_addressDOM.ZIP        = poViewModel.ZIP_DMCL;
                    oModel_addressDOM.ADDR_TYP   = oModel.setAddressDMCL();
                    oModel_addressDOM.ADDR1      = poViewModel.ADDR1_DMCL;
                    oModel_addressDOM.ADDR2      = poViewModel.ADDR2_DMCL;
                    oModel_addressDOM.ADDR3      = poViewModel.ADDR3_DMCL;
                    //oModel_addressDOM.ADDR4 = poViewModel.
                    //oModel_addressDOM.ADDR5 = poViewModel.

                    //Process CRUD
                    db.Employee_addresss.Add(oModel_addressKTP);
                    db.Employee_addresss.Add(oModel_addressDOM);
                    db.SaveChanges();
                    #endregion
                }                                         //End using
            }                                             //End try
            catch (Exception e) { vsMsgErr = e.Message; } //End catch
        }                                                 //End public void Update