예제 #1
0
        public ActionResult Edit(int id)
        {
            NoStockType obj = GetById(id);

            ViewData["id"] = id;
            return(View(obj));
        }
예제 #2
0
 public ActionResult Edit(NoStockType obj)
 {
     try
     {
         NSession.Update(obj);
         NSession.Flush();
         List <NoStockLinkType> list1 = Newtonsoft.Json.JsonConvert.DeserializeObject <List <NoStockLinkType> >(obj.rowse);
         NSession.Delete("from NoStockLinkType where PId='" + obj.Id + "'");
         NSession.Flush();
         NSession.Clear();
         foreach (NoStockLinkType link in list1)
         {
             link.OldSKU   = obj.OldSKU;
             link.SKU      = obj.SKU;
             link.PId      = obj.Id;
             link.CreateBy = CurrentUser.Realname;
             link.CreateOn = DateTime.Now;
             NSession.Save(link);
             NSession.Flush();
         }
     }
     catch (Exception ee)
     {
         return(Json(new { errorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = "true" }));
 }
예제 #3
0
 public JsonResult Create(NoStockType obj)
 {
     try
     {
         obj.Enabled  = 1;
         obj.CreateBy = CurrentUser.Realname;
         obj.CreateOn = DateTime.Now;
         NSession.SaveOrUpdate(obj);
         NSession.Flush();
         List <NoStockLinkType> list1 = Newtonsoft.Json.JsonConvert.DeserializeObject <List <NoStockLinkType> >(obj.rows);
         foreach (NoStockLinkType link in list1)
         {
             link.OldSKU   = obj.OldSKU;
             link.SKU      = obj.SKU;
             link.PId      = obj.Id;
             link.CreateBy = CurrentUser.Realname;
             link.CreateOn = DateTime.Now;
             NSession.Save(link);
             NSession.Flush();
         }
     }
     catch (Exception ee)
     {
         return(Json(new { errorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = "true" }));
 }
예제 #4
0
        public JsonResult IsReceived(int id)
        {
            NoStockType obj = GetById(id);

            obj.Enabled = 0;
            NSession.Update(obj);
            NSession.Flush();
            return(Json(""));
        }
예제 #5
0
        public ViewResult Received(int id)
        {
            NoStockType obj     = GetById(id);
            ProductType product = new ProductType();

            product.OldSKU      = obj.OldSKU;
            product.SKU         = obj.SKU;
            product.ProductName = obj.Name;
            product.Standard    = obj.Standard;
            ViewData["nid"]     = id;
            return(View(product));
        }
예제 #6
0
        /// <summary>
        /// 根据Id获取
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public NoStockType GetById(int Id)
        {
            NoStockType obj = NSession.Get <NoStockType>(Id);

            if (obj == null)
            {
                throw new Exception("返回实体为空");
            }
            else
            {
                return(obj);
            }
        }
예제 #7
0
 public JsonResult DeleteConfirmed(int id)
 {
     try
     {
         NoStockType obj = GetById(id);
         obj.Enabled = 0;
         NSession.Update(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { errorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = "true" }));
 }