示例#1
0
        public ActionResult SaveAjax(string c_title, long?c_brand, string c_code, string c_currency, decimal?c_stock_price, decimal?c_sale_price, int?c_unit)
        {
            EAP.Logic.DictResponse res  = new EAP.Logic.DictResponse();
            Z01Product             data = new Z01Product();

            data.Title        = c_title;
            data.BrandID      = c_brand;
            data.Currency     = c_currency;
            data.PriceStock   = c_stock_price;
            data.PriceList    = c_sale_price;
            data.PriceSelling = c_sale_price;
            data.UnitID       = c_unit;
            data.TenantID     = _tenant.TenantID;
            data.Creator      = _user.UserID;
            data.Code         = c_code.Trim();
            if (c_code.IsNotNullOrEmpty())
            {
                if (db.Exists <Z01Product>("Code=@Code", db.CreateParameter("Code", c_code.Trim())))
                {
                    res._state   = false;
                    res._message = "编号重复,请核对";
                    return(Content(res.ToJson()));
                }
            }
            var bid = db.Insert(data);

            res._state = true;
            res._data.Add("title", c_title);
            res._data.Add("id", bid);
            return(Content(res.ToJson()));
        }
示例#2
0
        public ActionResult SaveAjaxAdmin(long c_id, string c_title, string c_code, long?c_brand, string c_currency, decimal?c_stock_price, decimal?c_sale_price, int?c_unit)
        {
            EAP.Logic.DictResponse res  = new EAP.Logic.DictResponse();
            Z01Product             data = new Z01Product();

            data.ProductID    = c_id;
            data.Title        = c_title;
            data.BrandID      = c_brand;
            data.Currency     = c_currency;
            data.PriceStock   = c_stock_price;
            data.PriceList    = c_sale_price;
            data.PriceSelling = c_sale_price;
            data.UnitID       = c_unit;
            data.Updater      = _user.UserID;
            data.Code         = c_code;
            var bid = db.Update(data);

            //更新库存的进货价格
            if (db.Exists <Z10Cabbage.Entity.Z10OrderItem>("ProductID=@proid", db.CreateParameter("proid", c_id)))
            {
                res._state   = false;
                res._message = "该商品已经进入订单系统,库存价格未修改,请使用其他方法修订。";
            }
            else
            {
                string sql = "update Z10DepotProductDetail set PriceStock=@xprice where ProductID=@proid";
                db.ExecuteNonQuery(sql, db.CreateParameter("xprice", c_stock_price ?? 0), db.CreateParameter("proid", c_id));
                res._state = true;
            }
            return(Content(res.ToJson()));
        }
示例#3
0
        public ActionResult SetStatus(int id, int sts)
        {
            Z01Product data = new Z01Product();

            data.ProductID     = id;
            data.ProductStatus = sts;
            db.Update(data);

            EAP.Logic.DictResponse res = new EAP.Logic.DictResponse();
            res._state = true;
            return(Content(res.ToJson()));
        }
示例#4
0
        public ActionResult SaveAjax(string tt)
        {
            EAP.Logic.DictResponse res = new EAP.Logic.DictResponse();
            Z01Brand brand             = new Z01Brand();

            brand.Title    = tt;
            brand.TenantID = _tenant.TenantID;
            brand.Creator  = _user.UserID;
            var bid = db.Insert(brand);

            res._state = true;
            res._data.Add("title", tt);
            res._data.Add("id", bid);
            return(Content(res.ToJson()));
        }
示例#5
0
        public ActionResult SaveAjax(string c_title, string c_tel1, string c_tel2)
        {
            EAP.Logic.DictResponse res  = new EAP.Logic.DictResponse();
            Z01Customer            data = new Z01Customer();

            data.Title        = c_title;
            data.Tel1         = c_tel1;
            data.Tel2         = c_tel2;
            data.CustomerType = (int)EAP.Logic.Z01.CustomerTyps.Customer;
            data.TenantID     = _tenant.TenantID;
            data.Creator      = _user.UserID;
            var bid = db.Insert(data);

            res._state = true;
            res._data.Add("id", bid);
            return(Content(res.ToJson()));
        }
示例#6
0
        public ActionResult EditAjax(long productID)
        {
            EAP.Logic.DictResponse res = new EAP.Logic.DictResponse();
            var product = db.FindUnique <Z01Product>(productID);

            if (product != null)
            {
                res._state = true;
                res._data.Add("brand", product.BrandID ?? 0);
                res._data.Add("title", product.Title);
                res._data.Add("currency", product.Currency);
                res._data.Add("pricestock", (product.PriceStock ?? 0).ToString("0.##"));
                res._data.Add("pricesale", (product.PriceSelling ?? 0).ToString("0.##"));
                res._data.Add("unit", product.UnitID ?? 0);
                res._data.Add("code", product.Code);
            }
            else
            {
                res._message = "错误的商品";
                res._state   = false;
            }

            return(Content(res.ToJson()));
        }
示例#7
0
 public ActionResult SaveAjax(string tt)
 {
     EAP.Logic.DictResponse res = new EAP.Logic.DictResponse();
     Z01Brand brand = new Z01Brand();
     brand.Title = tt;
     brand.TenantID = _tenant.TenantID;
     brand.Creator = _user.UserID;
     var bid = db.Insert(brand);
     res._state = true;
     res._data.Add("title", tt);
     res._data.Add("id", bid);
     return Content(res.ToJson());
 }
示例#8
0
 public ActionResult SaveAjax(string c_title, string c_tel1, string c_tel2)
 {
     EAP.Logic.DictResponse res = new EAP.Logic.DictResponse();
     Z01Customer data = new Z01Customer();
     data.Title = c_title;
     data.Tel1 = c_tel1;
     data.Tel2 = c_tel2;
     data.CustomerType = (int)EAP.Logic.Z01.CustomerTyps.Customer;
     data.TenantID = _tenant.TenantID;
     data.Creator = _user.UserID;
     var bid = db.Insert(data);
     res._state = true;
     res._data.Add("id", bid);
     return Content(res.ToJson());
 }
示例#9
0
        public ActionResult SetStatus(int id, int sts)
        {
            Z01Product data = new Z01Product();
            data.ProductID = id;
            data.ProductStatus = sts;
            db.Update(data);

            EAP.Logic.DictResponse res = new EAP.Logic.DictResponse();
            res._state = true;
            return Content(res.ToJson());
        }
示例#10
0
        public ActionResult SaveAjaxAdmin(long c_id, string c_title, string c_code, long? c_brand, string c_currency, decimal? c_stock_price, decimal? c_sale_price, int? c_unit)
        {
            EAP.Logic.DictResponse res = new EAP.Logic.DictResponse();
            Z01Product data = new Z01Product();
            data.ProductID = c_id;
            data.Title = c_title;
            data.BrandID = c_brand;
            data.Currency = c_currency;
            data.PriceStock = c_stock_price;
            data.PriceList = c_sale_price;
            data.PriceSelling = c_sale_price;
            data.UnitID = c_unit;
            data.Updater = _user.UserID;
            data.Code = c_code;
            var bid = db.Update(data);

            //更新库存的进货价格
            if (db.Exists<Z10Cabbage.Entity.Z10OrderItem>("ProductID=@proid", db.CreateParameter("proid", c_id)))
            {
                res._state = false;
                res._message = "该商品已经进入订单系统,库存价格未修改,请使用其他方法修订。";
            }
            else
            {
                string sql = "update Z10DepotProductDetail set PriceStock=@xprice where ProductID=@proid";
                db.ExecuteNonQuery(sql, db.CreateParameter("xprice", c_stock_price ?? 0), db.CreateParameter("proid", c_id));
                res._state = true;
            }
            return Content(res.ToJson());
        }
示例#11
0
 public ActionResult SaveAjax(string c_title, long? c_brand, string c_code, string c_currency, decimal? c_stock_price, decimal? c_sale_price, int? c_unit)
 {
     EAP.Logic.DictResponse res = new EAP.Logic.DictResponse();
     Z01Product data = new Z01Product();
     data.Title = c_title;
     data.BrandID = c_brand;
     data.Currency = c_currency;
     data.PriceStock = c_stock_price;
     data.PriceList = c_sale_price;
     data.PriceSelling = c_sale_price;
     data.UnitID = c_unit;
     data.TenantID = _tenant.TenantID;
     data.Creator = _user.UserID;
     data.Code = c_code.Trim();
     if (c_code.IsNotNullOrEmpty())
     {
         if (db.Exists<Z01Product>("Code=@Code", db.CreateParameter("Code", c_code.Trim())))
         {
             res._state = false;
             res._message = "编号重复,请核对";
             return Content(res.ToJson());
         }
     }
     var bid = db.Insert(data);
     res._state = true;
     res._data.Add("title", c_title);
     res._data.Add("id", bid);
     return Content(res.ToJson());
 }
示例#12
0
        public ActionResult EditAjax(long productID)
        {
            EAP.Logic.DictResponse res = new EAP.Logic.DictResponse();
            var product = db.FindUnique<Z01Product>(productID);
            if (product != null)
            {
                res._state = true;
                res._data.Add("brand", product.BrandID ?? 0);
                res._data.Add("title", product.Title);
                res._data.Add("currency", product.Currency);
                res._data.Add("pricestock", (product.PriceStock ?? 0).ToString("0.##"));
                res._data.Add("pricesale", (product.PriceSelling ?? 0).ToString("0.##"));
                res._data.Add("unit", product.UnitID ?? 0);
                res._data.Add("code", product.Code);

            }
            else
            {
                res._message = "错误的商品";
                res._state = false;
            }

            return Content(res.ToJson());
        }