Example #1
0
        }                                                                                    //End public void Update

        public void Delete(int?id)
        {
            try
            {
                this.oModel = this.db.Jobtitles.Find(id);
                this.db.Jobtitles.Remove(this.oModel);
                //this.db.SaveChanges();
                //this.ID = this.oModel.ID;
            }                                                                                //End try
            catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Delete" + e.Message; } //End catch
        }                                                                                    //End public void Delete
Example #2
0
        }                                                                                    //End public void Update

        public void Delete(int?id)
        {
            try
            {
                using (var db = new DBMAINContext())
                {
                    Jobtitle oModel = db.Jobtitles.Find(id);
                    db.Jobtitles.Remove(oModel);
                    db.SaveChanges();
                    this.ID = oModel.ID;
                }                                                                            //End using
            }                                                                                //End try
            catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Delete" + e.Message; } //End catch
        }                                                                                    //End public void Delete
Example #3
0
        }                                                                                      //End public void Create

        public void Update(JobtitleVM poViewModel)
        {
            try
            {
                this.oModel = this.db.Jobtitles.AsNoTracking().SingleOrDefault(fld => fld.ID == poViewModel.ID);
                //Map Form Data
                this.oModel.InjectFrom(poViewModel);
                //Set Field Header
                this.oModel.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE);
                //Set DTA_STS
                this.oModel.DTA_STS = valFLAG.FLAG_DTA_STS_UPDATE;
                //Process CRUD
                this.db.Entry(this.oModel).State = EntityState.Modified;
                //this.db.SaveChanges();
                //this.ID = this.oModel.ID;
            }                                                                                //End try
            catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Update" + e.Message; } //End catch
        }                                                                                    //End public void Update
Example #4
0
        }                   //End public JobtitleCRUD()

        public void Create(JobtitleVM poViewModel)
        {
            try
            {
                this.oModel = new Jobtitle();
                //Map Form Data
                this.oModel.InjectFrom(poViewModel);
                //Set Field Header
                this.oModel.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                //Set DTA_STS
                this.oModel.DTA_STS = valFLAG.FLAG_DTA_STS_CREATE;
                //Process CRUD
                this.db.Jobtitles.Add(this.oModel);
                //this.db.SaveChanges();
                //this.ID = this.oModel.ID;
            }                                                                                  //End try
            catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Create: " + e.Message; } //End catch
        }                                                                                      //End public void Create
Example #5
0
        }                                                                                      //End public void Create

        public void Update(JobtitledetailVM poViewModel)
        {
            try
            {
                using (var db = new DBMAINContext())
                {
                    Jobtitle oModel = db.Jobtitles.AsNoTracking().SingleOrDefault(fld => fld.ID == poViewModel.ID);
                    //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;
                }                                                                            //End using
            }                                                                                //End try
            catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Update" + e.Message; } //End catch
        }                                                                                    //End public void Update
Example #6
0
        }                         //End public JobtitleCRUD()

        public void Create(JobtitledetailVM poViewModel)
        {
            try
            {
                using (var db = new DBMAINContext())
                {
                    Jobtitle oModel = new Jobtitle();
                    //Map Form Data
                    oModel.InjectFrom(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                    //Process CRUD
                    db.Jobtitles.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