}                                                 //End public void Create(Standardreff_DetailVM poViewModel)

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

            try
            {
                using (var db = new DBMAINContext())
                {
                    Standardreff oModel = db.Standardreffs.AsNoTracking().SingleOrDefault(fld => fld.RUID == poViewModel.RUID);
                    //Map Form Data
                    Mapper.CreateMap <Standardreff_DetailVM, Standardreff>();
                    oModel = Mapper.Map <Standardreff_DetailVM, Standardreff>(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
                    //Set DTA_STS
                    oModel.DTA_STS = valFLAG.FLAG_CRUDOPT_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(Standardreff_DetailVM poViewModel)
        }                             //End public StandardreffCRUD()

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

            try
            {
                using (var db = new DBMAINContext())
                {
                    Standardreff oModel = new Standardreff();
                    //Map Form Data
                    Mapper.CreateMap <Standardreff_DetailVM, Standardreff>();
                    oModel = Mapper.Map <Standardreff_DetailVM, Standardreff>(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                    //Set DTA_STS
                    oModel.DTA_STS = valFLAG.FLAG_CRUDOPT_CREATE;
                    //Process CRUD
                    db.Standardreffs.Add(oModel);
                    db.SaveChanges();
                }                                         //End using
            }                                             //End try
            catch (Exception e) { vsMsgErr = e.Message; } //End catch
        }                                                 //End public void Create(Standardreff_DetailVM poViewModel)
Esempio n. 3
0
 //Constructor
 public Standardreff_Validation(Standardreff_DetailVM poViewModel)
 {
     oViewModel = poViewModel;
 } //End public CPARStandardreff_Validation()