Beispiel #1
0
        }                      //End public AuditCRUD()

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

            try
            {
                using (var db = new DBMAINContext())
                {
                    Audit oModel = new Audit();
                    //Map Form Data
                    Mapper.CreateMap <Audit_DetailVM, Audit>();
                    oModel = Mapper.Map <Audit_DetailVM, Audit>(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                    //Set DTA_STS
                    oModel.DTA_STS = valFLAG.FLAG_DTA_STS_CREATE;
                    //Process CRUD
                    db.Audits.Add(oModel);
                    db.SaveChanges();
                }                                         //End using
            }                                             //End try
            catch (Exception e) { vsMsgErr = e.Message; } //End catch
        }                                                 //End public void Create
Beispiel #2
0
        }                                                 //End public void Create

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

            try
            {
                using (var db = new DBMAINContext())
                {
                    Audit oModel = db.Audits.AsNoTracking().SingleOrDefault(fld => fld.RUID == poViewModel.RUID);
                    //Map Form Data
                    Mapper.CreateMap <Audit_DetailVM, Audit>();
                    oModel = Mapper.Map <Audit_DetailVM, Audit>(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
                    //Set DTA_STS
                    oModel.DTA_STS = valFLAG.FLAG_DTA_STS_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
Beispiel #3
0
 //Constructor
 public Audit_Validation(Audit_DetailVM poViewModel)
 {
     oViewModel = poViewModel;
 } //End public Audit_Validation()