Esempio n. 1
0
        }                                                                                      //End public void Create

        public void Update(WarningdetailVM poViewModel)
        {
            try
            {
                using (var db = new DBMAINContext())
                {
                    poViewModel.SHORT_DESC = poViewModel.FULL_DESC;
                    Warning         oModel       = db.Warnings.AsNoTracking().SingleOrDefault(fld => fld.ID == poViewModel.ID);
                    WarninghiddenVM oModelhidden = new WarninghiddenVM();
                    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
Esempio n. 2
0
        }     //End public TimelineCRUD()

        //Constructor 5
        public TimelineCRUD(WarningdetailVM poVM = null)
        {
            if (poVM != null)
            {
                //Map Form Data
                this.oVM = new TimelinedetailVM();
                this.oVM.InjectFrom(poVM);
                this.oVM.ID = poVM.TIMELINE_ID;
            } //End if (poVM != null)
        }     //End public TimelineCRUD()
Esempio n. 3
0
        }                        //End public WarningCRUD()

        public void Create(WarningdetailVM poViewModel)
        {
            try
            {
                using (var db = new DBMAINContext())
                {
                    Warning oModel = new Warning();
                    //Map Form Data
                    oModel.InjectFrom(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                    //Process CRUD
                    db.Warnings.Add(oModel);
                    db.SaveChanges();
                    this.ID = oModel.ID;
                }                                                                              //End using
            }                                                                                  //End try
            catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Create: " + e.Message; } //End catch
        }                                                                                      //End public void Create
Esempio n. 4
0
 //Constructor
 public Warning_Validation(WarningdetailVM poViewModel)
 {
     oViewModel = poViewModel;
 } //End public Warning_Validation()