コード例 #1
0
        public JsonResult Create(StockInType obj)
        {
            try
            {

                IList<WarehouseStockType> list =
                    NSession.CreateQuery(" from WarehouseStockType where WId=:p1 and SKU=:p2").SetInt32("p1", obj.WId).
                        SetString("p2", obj.SKU).List<WarehouseStockType>();
                if (list.Count > 0)
                {
                    obj.IsAudit = 0;
                    obj.CreateBy = CurrentUser.Realname;
                    obj.CreateOn = DateTime.Now;
                    NSession.SaveOrUpdate(obj);
                    NSession.Flush();
                }
                else
                {
                    return Json(new { IsSuccess = false, ErrorMsg = "该产品没有在系统中。请先添加产品!" });
                }

            }
            catch (Exception ee)
            {
                return Json(new { IsSuccess = false, ErrorMsg = "出错了" });
            }
            return Json(new { IsSuccess = true });
        }
コード例 #2
0
        public ActionResult Edit(StockInType obj)
        {

            try
            {
                NSession.Update(obj);
                NSession.Flush();
            }
            catch (Exception ee)
            {
                return Json(new { IsSuccess = false, ErrorMsg = "出错了" });
            }
            return Json(new { IsSuccess = true });

        }