Пример #1
0
 public ActionResult Edit(PlacardType obj)
 {
     try
     {
         NSession.Update(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
Пример #2
0
        /// <summary>
        /// 根据Id获取
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public PlacardType GetById(int Id)
        {
            PlacardType obj = NSession.Get <PlacardType>(Id);

            if (obj == null)
            {
                throw new Exception("返回实体为空");
            }
            else
            {
                return(obj);
            }
        }
Пример #3
0
 public JsonResult DeleteConfirmed(int id)
 {
     try
     {
         PlacardType obj = GetById(id);
         NSession.Delete(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { errorMsg = "出错" + ee.Message }));
     }
     return(Json(new { IsSuccess = true }));
 }
Пример #4
0
 public JsonResult Create(PlacardType obj)
 {
     try
     {
         obj.CreateOn = DateTime.Now;
         obj.CreateBy = CurrentUser.Realname;
         NSession.Save(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
Пример #5
0
        public ActionResult EditStatus(string p, string s)
        {
            List <ProductType> products =
                NSession.CreateQuery("from ProductType where Id in(" + p + ")").List <ProductType>().ToList();

            foreach (ProductType productType in products)
            {
                productType.Status = s;
                NSession.Update(productType);
                NSession.Flush();
                LoggerUtil.GetProductRecord(productType, "订单产品属性修改",
                                            "产品:" + productType.SKU + "状态修改为“" + s + "”",
                                            CurrentUser, NSession);
                if (s == "停产")
                {
                    int              count      = 0;
                    string           orderid    = "";
                    List <OrderType> orderTypes =
                        NSession.CreateQuery(
                            "from OrderType where Id in(select OId from OrderProductType where SKU='" + productType.SKU + "') and Status='已处理' and Enabled=1")
                        .List <OrderType>().ToList();
                    foreach (OrderType orderType in orderTypes)
                    {
                        orderType.IsStop = 1;
                        NSession.Update(orderType);
                        NSession.Flush();
                        LoggerUtil.GetOrderRecord(orderType, "订单产品属性修改",
                                                  "产品:" + productType.SKU + "状态修改为“" + s + "”,同时订单属性设置为停售订单", CurrentUser, NSession);
                        orderid += orderType.OrderNo + "  ";
                        count++;
                    }
                    NSession.CreateQuery("update OrderProductType set IsQue=2 where SKU='" + productType.SKU + "'").UniqueResult();
                    PlacardType placard = new PlacardType {
                        CardType = "产品", Title = productType.SKU + " 停产", Content = "相关" + count + "条订单编号: " + orderid, CreateBy = "系统自动", CreateOn = DateTime.Now, IsTop = 1
                    };
                    NSession.Save(placard);
                    NSession.Flush();
                }
            }
            return(Json(new { IsSuccess = true }));
        }
Пример #6
0
        public ActionResult Edit(int id)
        {
            PlacardType obj = GetById(id);

            return(View(obj));
        }
Пример #7
0
        public JsonResult Detail(int id)
        {
            PlacardType obj = GetById(id);

            return(Json(obj, JsonRequestBehavior.AllowGet));
        }