Esempio n. 1
0
        public ActionResult Create2(int[] fieldid, Models.GapJournalCare collection)
        {
            try
            {
                if (fieldid.Count() == 0)
                {
                    throw new Exception("Phải chọn thửa đất");
                }

                var _dataobject2 = new DAL.GapField(Request);

                foreach (var item in fieldid)
                {
                    //_dataobject.MapView2Table();
                    var gapfield = _dataobject2.GetEdit(item);
                    if (gapfield.RefJournalId != null)
                    {
                        collection.JournalId = gapfield.RefJournalId.Value;
                        int outputId = _dataobject.Insert(collection);
                    }
                }
                return(RedirectToAction(this.ActionReturn()));
            }
            catch (Exception ex)
            {
                ViewBag.fieldid = fieldid;
                Services.GlobalErrors.Parse(ModelState, _dataobject.Errors, ex);
                return(PartialView(collection));
            }
        }
Esempio n. 2
0
 public void BeginUpdate(Models.GapJournalCare data)
 {
     if (data.ItemID != null)
     {
         var measurerate = Services.Voucher.GetMeasureRate(data.UOMID, data.ItemID);
         data.Quantity = Decimal.Round((Decimal)data.Quantity0 * (Decimal)measurerate, int.Parse(GlobalVariant.GetSysOption()["RoundQuantity"].ToString()));
     }
     //this._db.SaveChanges();
 }
Esempio n. 3
0
 public ActionResult Create(Models.GapJournalCare collection)
 {
     try
     {
         int outputId = _dataobject.Insert(collection);
         return(RedirectToAction(this.ActionReturn()));
     }
     catch (Exception ex)
     {
         Services.GlobalErrors.Parse(ModelState, _dataobject.Errors, ex);
         return(PartialView(this._updateview, collection));
     }
 }
Esempio n. 4
0
 public int Insert(Models.GapJournalCare data)
 {
     try
     {
         this.Validate(data);
         BeginUpdate(data);
         var _data = new Models.GapJournalCare();
         this.MapView2Table(data, _data);
         this._db.GapJournalCares.Add(_data);
         this._db.SaveChanges();
         EndUpdate(_data.JournalCareId);
         return(_data.JournalCareId);
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 5
0
 public int Update(Models.GapJournalCare data)
 {
     try
     {
         this.Validate(data);
         BeginUpdate(data);
         var _data = this.GetById2(data.JournalCareId);
         this.MapView2Table(data, _data);
         this._db.Entry(_data).State = System.Data.Entity.EntityState.Modified;
         this._db.SaveChanges();
         EndUpdate(_data.JournalCareId);
         return(_data.JournalCareId);
     }
     catch (Exception)
     {
         throw;
     }
 }