Esempio n. 1
0
 public ActionResult ItemExEdit(ItemEx itemEx)
 {
     try
     {
         if (ModelState.IsValid)
         {
             IList<ItemEx> ItemExList = this.genericMgr.FindAll<ItemEx>("from ItemEx as i where i.Code=?", itemEx.Code);
             if (ItemExList != null && ItemExList.Count > 0)
             {
                 ItemEx ie = ItemExList[0];
                 itemEx.CreateDate = ie.CreateDate;
                 itemEx.CreateUserId = ie.CreateUserId;
                 itemEx.CreateUserName = ie.CreateUserName;
                 this.genericMgr.UpdateWithTrim(itemEx);
             }
             else
             {
                 this.genericMgr.CreateWithTrim(itemEx);
             }
             SaveSuccessMessage(Resources.EXT.ControllerLan.Con_ExtrusionParamUpdatedSuccessfully);
         }
         else
         {
             foreach (var item in ModelState)
             {
                 throw new BusinessException(Resources.EXT.ControllerLan.Con_AgingTimeAgingMathodSpecCanNotBeEmpty);
             }
         }
     }
     catch (BusinessException be)
     {
         SaveErrorMessage(be.GetMessages()[0].GetMessageString());
     }
     TempData["TabIndex"] = 3;
     return new RedirectToRouteResult(new RouteValueDictionary { { "action", "_EditList" }, { "controller", "Item" }, { "id", itemEx.Code } });
 }
Esempio n. 2
0
        public ActionResult ItemExEdit(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return HttpNotFound();
            }
            else
            {
                ItemEx itemEx = new ItemEx();
                IList<ItemEx> ItemExList = this.genericMgr.FindAll<ItemEx>("from ItemEx as i where i.Code=?", id);
                if (ItemExList != null && ItemExList.Count > 0)
                {
                    ViewBag.IsNull = false;
                    itemEx = ItemExList[0];
                }
                else
                {
                    ViewBag.IsNull = true;
                    itemEx.Code = id;
                }
                return PartialView(itemEx);

            }
        }