Exemplo n.º 1
0
        public ActionResult Create2(int[] fieldid, Models.GapJournal 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 > 0)
                    {
                        continue;
                    }
                    collection.FieldId = item;
                    int outputId = _dataobject.Insert(collection);


                    gapfield.RefJournalId = outputId;
                    _dataobject2.Update(gapfield);
                }
                return(RedirectToAction(this.ActionReturn()));
            }
            catch (Exception ex)
            {
                ViewBag.fieldid = fieldid;
                Services.GlobalErrors.Parse(ModelState, _dataobject.Errors, ex);
                return(PartialView(collection));
            }
        }
Exemplo n.º 2
0
 public ActionResult Edit(int FieldId, Models.GapField collection)
 {
     try
     {
         int outputId = _dataobject.Update(collection);
         return(RedirectToAction(this.ActionReturn()));
     }
     catch (Exception ex)
     {
         Services.GlobalErrors.Parse(ModelState, _dataobject.Errors, ex);
         return(PartialView(this._updateview, collection));
     }
 }
Exemplo n.º 3
0
        public ActionResult Complete(int[] fieldid)
        {
            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();
                    //collection.FieldId = item;
                    //int outputId = _dataobject.Insert(collection);

                    var gapfield   = _dataobject2.GetEdit(item);
                    var gapjournal = _dataobject.GetById(gapfield.RefJournalId ?? 0);
                    if (gapjournal != null)
                    {
                        //if (gapjournal.GapJournalHarvests.Count==0)
                        //{

                        //}

                        gapjournal.StatusId = 0;
                        _dataobject.Update(gapjournal);
                    }
                    gapfield.RefJournalId = null;
                    _dataobject2.Update(gapfield);
                }
            }
            catch (Exception ex)
            {
                return(Json(new { ketqua = ex.Message }));
            }

            return(Json(new { ketqua = "Đã xong!" }));
        }