}                                                                                      //End public void Create

        public void Update(BasicmaterialdetailVM poViewModel)
        {
            try
            {
                using (var db = new DBMAINContext())
                {
                    Basicmaterial oModel = db.Basicmaterials.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;
                    //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
        }                              //End public BasicmaterialCRUD()

        public void Create(BasicmaterialdetailVM poViewModel)
        {
            try
            {
                using (var db = new DBMAINContext())
                {
                    Basicmaterial oModel = new Basicmaterial();
                    //Map Form Data
                    oModel.InjectFrom(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                    //Set DTA_STS
                    oModel.DTA_STS = valFLAG.FLAG_DTA_STS_CREATE;
                    //Process CRUD
                    db.Basicmaterials.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
 //Constructor
 public Basicmaterial_Validation(BasicmaterialdetailVM poViewModel)
 {
     oViewModel = poViewModel;
 } //End public Basicmaterial_Validation()