} //End public void Create public void Update(ActivitydetailVM poViewModel) { try { using (var db = new DBMAINContext()) { poViewModel.SHORT_DESC = poViewModel.FULL_DESC; Activity oModel = db.Activitys.AsNoTracking().SingleOrDefault(fld => fld.ID == poViewModel.ID); ActivityhiddenVM oModelhidden = new ActivityhiddenVM(); oModelhidden.InjectFrom(oModel); poViewModel.InjectFrom(oModelhidden); //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; 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 TimelineCRUD() //Constructor 2 public TimelineCRUD(ActivitydetailVM poVM = null) { //Map Form Data if (poVM != null) { this.oVM = new TimelinedetailVM(); this.oVM.InjectFrom(poVM); this.oVM.ID = poVM.TIMELINE_ID; } //End if (poVM != null) } //End public TimelineCRUD()
} //End public ActivityCRUD() public void Create(ActivitydetailVM poViewModel) { try { using (var db = new DBMAINContext()) { poViewModel.SHORT_DESC = poViewModel.FULL_DESC; Activity oModel = new Activity(); //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.Activitys.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 Activity_Validation(ActivitydetailVM poViewModel) { oViewModel = poViewModel; } //End public Activity_Validation()