Exemplo n.º 1
0
        }                                                 //End public void Create

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

            try
            {
                using (var db = new DBMAINContext())
                {
                    CPARStdref oModel = db.CPARStdrefs.AsNoTracking().SingleOrDefault(fld => fld.RUID == poViewModel.RUID);
                    //Map Form Data
                    Mapper.CreateMap <CPARStdref_DetailVM, CPARStdref>();
                    oModel = Mapper.Map <CPARStdref_DetailVM, CPARStdref>(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.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
Exemplo n.º 2
0
        }                                                 //End public void Delete

        public void Create_prepare(CPARStdref_DetailVM poViewModel)
        {
            string vsMsgErr = "";

            try
            {
                using (var db = new DBMAINContext())
                {
                    CPARStdref oModel = new CPARStdref();
                    //Map Form Data
                    Mapper.CreateMap <CPARStdref_DetailVM, CPARStdref>();
                    oModel = Mapper.Map <CPARStdref_DetailVM, CPARStdref>(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                    //Set DTA_STS
                    oModel.DTA_STS = valFLAG.FLAG_CRUDOPT_CREATE;
                    this.oModel    = oModel;
                }                                         //End using
            }                                             //End try
            catch (Exception e) { vsMsgErr = e.Message; } //End catch
        }                                                 //End public void Create_prepare(CPARStdref_DetailVM poViewModel)
Exemplo n.º 3
0
        }                           //End public CPARStdrefCRUD()

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

            try
            {
                using (var db = new DBMAINContext())
                {
                    CPARStdref oModel = new CPARStdref();
                    //Map Form Data
                    Mapper.CreateMap <CPARStdref_DetailVM, CPARStdref>();
                    oModel = Mapper.Map <CPARStdref_DetailVM, CPARStdref>(poViewModel);
                    //Set Field Header
                    oModel.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE);
                    //Process CRUD
                    db.CPARStdrefs.Add(oModel);
                    db.SaveChanges();
                }                                         //End using
            }                                             //End try
            catch (Exception e) { vsMsgErr = e.Message; } //End catch
        }                                                 //End public void Create