Exemplo n.º 1
0
        /// <summary>
        /// 添加商品
        /// </summary>
        /// <returns></returns>
        public CommodityAddResponse CommodityAdd(CommodityAddRequest request)
        {
            CommodityAddResponse response = new CommodityAddResponse();
            CommodityInfo        info     = new CommodityInfo()
            {
                CommodName       = request.CommodName,
                SystematicId     = request.SystematicId,
                CommodityImg     = request.CommodityImg,
                CommodityPrice   = request.CommodityPrice,
                CommodityDetalis = request.CommodityDetalis,
                RegisterDate     = request.RegisterDate,
                PutNumber        = request.PutNumber,
                CountNumber      = request.CountNumber,
            };
            var res = dal.CommodityAdd(info);

            if (res > 0)
            {
                response.CommoditySuccess = true;
            }
            else
            {
                response.CommoditySuccess = false;
            }
            return(response);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 编辑商品
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public CommodityUpdateRes UpdateCommodityInfo(CommodityUpdateReq request)
        {
            CommodityUpdateRes response = new CommodityUpdateRes();
            CommodityInfo      info     = new CommodityInfo()
            {
                CommodName       = request.CommodName,
                SystematicId     = request.SystematicId,
                CommodityImg     = request.CommodityImg,
                CommodityPrice   = request.CommodityPrice,
                CommodityDetalis = request.CommodityDetalis,
                RegisterDate     = request.RegisterDate,
                PutNumber        = request.PutNumber,
                CountNumber      = request.CountNumber,
            };
            var res = dal.UpdateCommodityInfo(info);

            if (res > 0)
            {
                response.CommodityUpdate = true;
                response.Message         = "添加成功";
            }
            else
            {
                response.CommodityUpdate = false;
                response.Message         = "注册失败";
            }
            return(response);
        }
Exemplo n.º 3
0
 public void RefreshItem(CommodityInfo commodityInfo)
 {
     if (UIManagerControl.Instance.IsOpen("ShoppingUI") && this.mGuildMarketInformation != null)
     {
         ShoppingUIViewModel.Instance.RefreshItem(this.mGuildMarketInformation.shopInfo, commodityInfo);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// index_1的更新数据
        /// </summary>
        /// <returns></returns>
        public ActionResult Index_1_flush(CommodityInfo Cinfo)
        {
            shopDBEntities shop = new shopDBEntities();

            Cinfo.CI_NowPrice = (Convert.ToDouble(Cinfo.CI_Discount) * Convert.ToInt32(Cinfo.CI_Price)).ToString();

            var update = shop.Entry(Cinfo);

            update.State = System.Data.EntityState.Unchanged;

            update.Property("CI_Name").IsModified     = true;
            update.Property("CI_CTI_ID").IsModified   = true;
            update.Property("CI_Num").IsModified      = true;
            update.Property("CI_Discount").IsModified = true;
            update.Property("CI_Price").IsModified    = true;
            update.Property("CI_NowPrice").IsModified = true;
            update.Property("CI_Is").IsModified       = true;
            update.Property("CI_SI_ID").IsModified    = true;

            int count = shop.SaveChanges();

            if (count > 0)
            {
                return(RedirectToAction("Index_1", "Mindex"));
            }
            else
            {
                Response.Write("<script>alert('抱歉更新失败了')</script>");
                return(RedirectToAction("Index_1", "Mindex"));
            }
        }
        private void btnModify_Click(object sender, EventArgs e)
        {
            if (!InputValidate())
            {
                return;
            }
            if (!HasCommodityNoValidator(this.txtBoxCommodityNo.Text, true))
            {
                return;
            }
            string errText;
            var    commodityInfo = new CommodityInfo()
            {
                CommodityId = _currentId, CommodityNo = this.txtBoxCommodityNo.Text, CommodityName = this.txtBoxCommodityName.Text,
                TypeId      = _currentTypeId, Size = this.cmboxSize.Text, Color = this.cmboxColor.Text, Remark = this.txtBoxRemark.Text,
                Unit        = this.txtBoxUnit.Text
            };

            commodityInfo.Discount  = float.Parse(this.txtBoxDiscount.Text);
            commodityInfo.UnitPrice = Convert.ToDecimal(this.txtBoxUnitPrice.Text);
            var i = _commodityInfoService.UpdateEntity(out errText, commodityInfo);

            if (i == 0)
            {
                MessageBox.Show(errText);
                return;
            }
            MessageBox.Show("修改成功!");
            ClearPage();
            InitCommodityData();
        }
Exemplo n.º 6
0
 /// <summary>
 /// 修改商品列表
 /// </summary>
 /// <param name="errText"></param>
 /// <param name="CommodityInfo"></param>
 /// <returns></returns>
 public int UpdateEntity(out string errText, CommodityInfo commodityInfo)
 {
     errText = "";
     try {
         using (SqlConnection conn = new SqlConnection(SQL_CON)) {
             conn.Open();
             var        sql = "update CommodityInfo set CommodityName=@CommodityName,TypeId=@TypeId,CommodityNo=@CommodityNo,Size=@Size,Color=@Color,UnitPrice=@UnitPrice,Discount=@Discount,Unit=@Unit,Remark=@Remark where CommodityId=@CommodityId";
             SqlCommand cmd = new SqlCommand(sql, conn);
             cmd.Parameters.AddWithValue("@CommodityId", commodityInfo.CommodityId);
             cmd.Parameters.AddWithValue("@CommodityName", commodityInfo.CommodityName);
             cmd.Parameters.AddWithValue("@TypeId", commodityInfo.TypeId);
             cmd.Parameters.AddWithValue("@CommodityNo", commodityInfo.CommodityNo);
             cmd.Parameters.AddWithValue("@Size", commodityInfo.Size);
             cmd.Parameters.AddWithValue("@Color", commodityInfo.Color);
             cmd.Parameters.AddWithValue("@UnitPrice", commodityInfo.UnitPrice);
             cmd.Parameters.AddWithValue("@Discount", commodityInfo.Discount);
             cmd.Parameters.AddWithValue("@Unit", commodityInfo.Unit);
             cmd.Parameters.AddWithValue("@Remark", commodityInfo.Remark);
             var i = cmd.ExecuteNonQuery();
             conn.Close();
             return(i);
         }
     } catch (Exception ex) {
         errText = ex.Message;
         return(0);
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// 新增一条商品信息
 /// </summary>
 /// <param name="errText"></param>
 /// <param name="commodityInfo"></param>
 /// <returns></returns>
 public int InsertEntity(out string errText, CommodityInfo commodityInfo)
 {
     errText = "";
     try {
         using (SqlConnection conn = new SqlConnection(SQL_CON)) {
             var sql = "insert into CommodityInfo (CommodityName,TypeId,CommodityNo,Size,Color,UnitPrice,Discount,Unit,Remark)"
                       + " values(@CommodityName,@TypeId,@CommodityNo,@Size,@Color,@UnitPrice,@Discount,@Unit,@Remark)";
             conn.Open();
             SqlCommand cmd = new SqlCommand(sql, conn);
             cmd.Parameters.AddWithValue("@CommodityId", commodityInfo.CommodityId);
             cmd.Parameters.AddWithValue("@CommodityName", commodityInfo.CommodityName);
             cmd.Parameters.AddWithValue("@TypeId", commodityInfo.TypeId);
             cmd.Parameters.AddWithValue("@CommodityNo", commodityInfo.CommodityNo);
             cmd.Parameters.AddWithValue("@Size", commodityInfo.Size);
             cmd.Parameters.AddWithValue("@Color", commodityInfo.Color);
             cmd.Parameters.AddWithValue("@UnitPrice", commodityInfo.UnitPrice);
             cmd.Parameters.AddWithValue("@Discount", commodityInfo.Discount);
             cmd.Parameters.AddWithValue("@Unit", commodityInfo.Unit);
             cmd.Parameters.AddWithValue("@Remark", commodityInfo.Remark);
             var i = cmd.ExecuteNonQuery();
             conn.Close();
             return(i);
         }
     } catch (Exception ex) {
         errText = ex.Message;
         return(0);
     }
 }
Exemplo n.º 8
0
    private void SetShoppingUnit1(OOShoppingUnit gridData, CommodityInfo commodityInfo)
    {
        int itemId      = commodityInfo.itemId;
        int commodityId = commodityInfo.commodityId;

        gridData.iId = commodityId;
        if (commodityInfo.sell)
        {
            gridData.EnableBtnBuy   = false;
            gridData.ItemFlagIconBg = true;
            gridData.ItemFlagIcon   = ResourceManager.GetIconSprite("font_yishouwan");
        }
        else
        {
            gridData.EnableBtnBuy   = true;
            gridData.ItemFlagIconBg = false;
            gridData.ItemFlagIcon   = ResourceManagerBase.GetNullSprite();
        }
        int num = commodityInfo.unitPrice * commodityInfo.itemNum;

        if ((long)num > MoneyType.GetNum(commodityInfo.moneyType))
        {
            gridData.PriceNow = "x" + num;
        }
        else
        {
            gridData.PriceNow = "x" + num;
        }
        gridData.ItemFrame = GameDataUtils.GetItemFrame(itemId);
        gridData.ItemIcon  = GameDataUtils.GetItemIcon(itemId);
        gridData.ItemName  = GameDataUtils.GetEquipItemNameAndLV(itemId, false);
        gridData.ItemNum   = string.Empty + commodityInfo.itemNum;
        gridData.CoinIcon  = MoneyType.GetIcon(commodityInfo.moneyType);
        gridData.PriceOld  = string.Empty;
    }
Exemplo n.º 9
0
    private OOShoppingUnit GetShoppingUnit1(CommodityInfo commodityInfo)
    {
        OOShoppingUnit oOShoppingUnit = new OOShoppingUnit();

        this.SetShoppingUnit1(oOShoppingUnit, commodityInfo);
        return(oOShoppingUnit);
    }
Exemplo n.º 10
0
 public void RefreshItem(QueryGuildShopInfoRes shop, CommodityInfo commodityInfo)
 {
     if (BaseMarketManager.mMarketClass != MarketClass.GuildMarketManager)
     {
         return;
     }
     if (shop == null)
     {
         return;
     }
     this.RefreshInfo(shop.remainingRefreshTime, GuildMarketManager.Instance.GetRemainRefreshTimes());
     if (commodityInfo == null)
     {
         return;
     }
     for (int i = 0; i < this.ItemList1.Count; i++)
     {
         OOShoppingPage oOShoppingPage = this.ItemList1[i];
         for (int j = 0; j < oOShoppingPage.Items.Count; j++)
         {
             if (oOShoppingPage.Items[j].iId == commodityInfo.commodityId)
             {
                 this.SetShoppingUnit1(oOShoppingPage.Items[j], commodityInfo);
                 return;
             }
         }
     }
 }
        public async Task GetCorpPriceTest()
        {
            #region not in use
            //UserCredential credential = null;
            //using (var stream = new FileStream("client_id.json", FileMode.Open, FileAccess.Read))
            //{
            //    // The file token.json stores the user's access and refresh tokens, and is created
            //    // automatically when the authorization flow completes for the first time.
            //    string credPath = "token.json";
            //    credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
            //        GoogleClientSecrets.Load(stream).Secrets,
            //        Scopes,
            //        "user",
            //        CancellationToken.None,
            //        new FileDataStore(credPath, true)).Result;
            //    Console.WriteLine("Credential file saved to: " + credPath);

            //    await credential.RefreshTokenAsync(CancellationToken.None);
            //}
            #endregion

            var ds = new GoogleSheetsProxy()
            {
                ApiKey = apiKey
            };
            CommodityInfo info = await ds.GetCorpCommodityInfoAsync("H2O");

            Assert.Equal("H2O", info.Ticker);
        }
Exemplo n.º 12
0
    private OOShoppingUnit2 GetShoppingUnit2(CommodityInfo commodityInfo)
    {
        int             itemId         = commodityInfo.itemId;
        int             commodityId    = commodityInfo.commodityId;
        OOShoppingUnit2 oOShoppingUnit = new OOShoppingUnit2();

        oOShoppingUnit.iId = commodityId;
        if (commodityInfo.sell)
        {
            oOShoppingUnit.EnableBtnBuy   = false;
            oOShoppingUnit.ItemFlagIconBg = true;
            oOShoppingUnit.ItemFlagIcon   = ResourceManager.GetIconSprite("font_yishouwan");
        }
        else
        {
            oOShoppingUnit.EnableBtnBuy   = true;
            oOShoppingUnit.ItemFlagIconBg = false;
            oOShoppingUnit.ItemFlagIcon   = ResourceManagerBase.GetNullSprite();
        }
        int num = commodityInfo.unitPrice * commodityInfo.itemNum;

        if ((long)num > MoneyType.GetNum(commodityInfo.moneyType))
        {
            oOShoppingUnit.PriceNow = "x" + num;
        }
        else
        {
            oOShoppingUnit.PriceNow = "x" + num;
        }
        oOShoppingUnit.ItemFrame = GameDataUtils.GetItemFrame(itemId);
        oOShoppingUnit.ItemIcon  = GameDataUtils.GetItemIcon(itemId);
        oOShoppingUnit.ItemName  = GameDataUtils.GetEquipItemNameAndLV(itemId, false);
        oOShoppingUnit.ItemNum   = string.Empty + commodityInfo.itemNum;
        oOShoppingUnit.CoinIcon  = MoneyType.GetIcon(commodityInfo.moneyType);
        oOShoppingUnit.PriceOld  = string.Empty;
        ShangPinBiao shangPinBiao = DataReader <ShangPinBiao> .Get(commodityInfo.commodityId);

        if (shangPinBiao != null)
        {
            if (shangPinBiao.pvpLevel > 0)
            {
                oOShoppingUnit.PVPIcon = ResourceManager.GetIconSprite(PVPManager.Instance.GetGetIntegralByLevel(shangPinBiao.pvpLevel, false));
                JingJiChangFenDuan jingJiChangFenDuan = DataReader <JingJiChangFenDuan> .Get(shangPinBiao.pvpLevel);

                if (jingJiChangFenDuan != null)
                {
                    oOShoppingUnit.PVPName = GameDataUtils.GetChineseContent(jingJiChangFenDuan.name, false);
                }
                oOShoppingUnit.TipShow = (shangPinBiao.pvpLevel > PVPManager.Instance.GetIntegralLevel().id);
            }
            else
            {
                oOShoppingUnit.PVPIcon = ResourceManagerBase.GetNullSprite();
                oOShoppingUnit.PVPName = string.Empty;
                oOShoppingUnit.TipShow = false;
            }
        }
        return(oOShoppingUnit);
    }
Exemplo n.º 13
0
 public GoodObject(int index, CommodityInfo GDSName, string number, string barcode, string cropId, string pestId)
 {
     _index   = index;
     _GDSName = GDSName;
     _number  = number;
     _barcode = barcode;
     _cropId  = cropId;
     _pestId  = pestId;
 }
Exemplo n.º 14
0
    public override void Buy(int commodityId, int count)
    {
        CommodityInfo commodityInfo = this.GetCommodityInfo(commodityId);

        if (commodityInfo != null)
        {
            this.SendBuyShopCommodity(this.CurrentShopID, commodityId);
        }
    }
Exemplo n.º 15
0
    private void BuySuccess(int commodityId)
    {
        CommodityInfo commodityInfo = this.GetCommodityInfo(commodityId);

        if (commodityInfo != null)
        {
            commodityInfo.sell = true;
        }
    }
Exemplo n.º 16
0
    public override void Buy(int commodityId, int count)
    {
        CommodityInfo commodityInfo = this.GetCommodityInfo(commodityId);

        if (commodityInfo != null)
        {
            this.SendBuy(commodityId);
        }
    }
Exemplo n.º 17
0
        /// <summary>
        /// 已下架商品展示
        /// </summary>
        /// <param name="data"></param>
        /// <param name="paging"></param>
        /// <param name="name"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public UnitedReturn SelOutCommodity(object data)
        {
            try
            {
                CommodityInfo orderforms = new CommodityInfo();
                //object初始值是System.object 所以判断一下
                if (data.ToString() != "System.object" && data.ToString() != "1")
                {
                    orderforms = JsonConvert.DeserializeObject <CommodityInfo>(data.ToString());
                }
                string sql = string.Format($"select c.CommodityId,s.ShopName,c.CommodityName,c.ComndityImg,t.TypeName,c.CommditySum,c.Price  from CommodityInfo as c join ShopInfo as s on c.ShopId = s.ShopId join TypeInfo as t on t.TypeId = c.TypeId where c.CommodityState = 0");

                if (orderforms.TypeId > 0)
                {
                    sql += $"and c.TypeId={orderforms.TypeId}";
                }
                if (orderforms.ShopId > 0)
                {
                    sql += $"and c.ShopId={orderforms.ShopId}";
                }
                sql += "ORDER BY c.CommodityId DESC";
                var datas = DBHelper.GetToList <CommodityInfo>(sql);
                if (!string.IsNullOrEmpty(orderforms.CommodityName))
                {
                    datas = datas.Where(s => s.CommodityName.Contains(orderforms.CommodityName)).ToList();
                }
                UnitedReturn unitedReturn = new UnitedReturn();
                if (datas.Count > 0 && datas != null)
                {
                    unitedReturn.data = datas;
                    unitedReturn.res  = 1;
                    unitedReturn.msg  = "获取信息成功";
                }
                else
                {
                    unitedReturn.data = null;
                    unitedReturn.res  = 0;
                    unitedReturn.msg  = "获取信息失败";
                }
                return(unitedReturn);
            }
            catch (Exception ex)
            {
                //错误日志 log4net
                //1请求接口
                //2请求参数
                //3错误信息
                //4请求时间

                return(new UnitedReturn()
                {
                    data = ex.InnerException.Message, res = -1, msg = ex.Message
                });
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// 获取单条数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public CommodityInfo OneCommosity(int id = 0)
        {
            CommodityInfo info = new CommodityInfo();

            using (IDbConnection connection = new SqlConnection(Conn))
            {
                var sql = "select * from CommodityInfo where CommodityId='{id}'";
                info = connection.Query <CommodityInfo>(sql).FirstOrDefault();
            }
            return(info);
        }
Exemplo n.º 19
0
        /// <summary>
        /// 添加商品
        /// </summary>
        /// <returns></returns>
        public int CommodityAdd(CommodityInfo Info)
        {
            int res = 0;

            using (IDbConnection connection = new SqlConnection(Conn))
            {
                var sql = $"insert into CommodityInfo(CommodName,SystematicId,CommodityImg,CommodityPrice,CommodityDetalis,RegisterDate,PutNumber,CountNumber) values ('{Info.CommodName}','{Info.SystematicId}','{Info.CommodityImg}','{Info.CommodityPrice}','{Info.CommodityDetalis}',1,'{Info.PutNumber}','{Info.CountNumber}')";
                res = connection.Execute(sql);
            }
            return(res);
        }
Exemplo n.º 20
0
        /// <summary>
        /// 店主添加商品处理
        /// </summary>
        /// <param name="commodity"></param>
        /// <returns></returns>
        public ActionResult Index_2_Insert(CommodityInfo commodity)
        {
            //int number = Request.Files.Count;

            //处理文件

            string name = Request.Files[0].FileName;

            if (string.IsNullOrEmpty(name))
            {
                name = "default.png";
            }

            //截取后缀

            int index = name.LastIndexOf(".");

            string houz = name.Substring(index + 1);

            //判断
            if (houz.ToLower() != "png" && houz.ToLower() != "jpg" && houz.ToLower() != "ico" && houz.ToLower() != "gif")
            {
                Response.Write("<script>alert('文件格式不是图片格式')</script>");
                return(RedirectToAction("Index_2", "Mindex"));
            }
            //让用户在指定的文件夹里面选择图片,不需要再重新分配地址

            commodity.CI_Url = "IMG/" + name;

            commodity.CI_SalesNum = 0;

            commodity.CI_NowPrice = (Convert.ToDouble(commodity.CI_Discount) * Convert.ToInt32(commodity.CI_Price)).ToString();

            shopDBEntities shop = new shopDBEntities();

            var insert = shop.Entry(commodity);

            insert.State = System.Data.EntityState.Added;

            int count = shop.SaveChanges();

            if (count > 0)
            {
                return(RedirectToAction("Index_1", "Mindex"));
            }
            else
            {
                Response.Write("<script>alert('抱歉新添商品失败')</script>");
                return(RedirectToAction("Index_2", "Mindex"));
            }
        }
Exemplo n.º 21
0
 /// <summary>
 /// 编辑方法
 /// </summary>
 /// <param name="info"></param>
 /// <param name="id"></param>
 /// <returns></returns>
 public int UpdateCommodityInfo(CommodityInfo info)
 {
     using (IDbConnection connection = new SqlConnection(Conn))
     {
         return(connection.Execute(string.Format($@"update CommodityInfo set CommodName='{info.CommodName}',
                                                     SystematicId={info.SystematicId},
                                                     CommodityImg='{info.CommodityImg}',
                                                     CommodityPrice='{info.CommodityPrice}',
                                                     CommodityDetalis='{info.CommodityDetalis}',
                                                     RegisterDate='{info.RegisterDate}',
                                                     PutNumber='{info.PutNumber}',
                                                     CountNumber='{info.CountNumber}' where CommodityId={info.CommodityId}")));
     }
 }
Exemplo n.º 22
0
    public static bool IsEnoughIntergral(int commodityId)
    {
        CommodityInfo commodityInfo = MarketManager.Instance.GetCommodityInfo(commodityId);

        if (commodityInfo != null)
        {
            ShangPinBiao shangPinBiao = DataReader <ShangPinBiao> .Get(commodityInfo.commodityId);

            if (shangPinBiao != null && shangPinBiao.pvpLevel > 0)
            {
                return(PVPManager.Instance.GetIntegralLevel().id >= shangPinBiao.pvpLevel);
            }
        }
        return(true);
    }
Exemplo n.º 23
0
    private void DoOK()
    {
        CommodityInfo commodityInfo = MarketManager.Instance.GetCommodityInfo(this.iId);

        if (commodityInfo != null)
        {
            if (!MarketTools.IsEnoughIntergral(this.iId))
            {
                UIManagerControl.Instance.ShowToastText("段位不足");
                return;
            }
            if (!MarketTools.IsEnoughMoney(BaseMarketManager.CurrentManagerInstance.GetCommodityPrice(this.iId, 1), BaseMarketManager.CurrentManagerInstance.GetCommodityMoneyType(this.iId)))
            {
                UIManagerControl.Instance.OpenSourceReferenceUI(MoneyType.GetItemId(commodityInfo.moneyType), null);
                return;
            }
            MarketManager.Instance.SendBuyShopCommodity(MarketManager.Instance.CurrentShopID, this.iId);
        }
    }
Exemplo n.º 24
0
    private static int CommoditySortCompare(CommodityInfo cInfo1, CommodityInfo cInfo2)
    {
        int result = 0;

        if (cInfo1.commodityId == cInfo2.commodityId)
        {
            result = 0;
        }
        else if (MarketManager.IsHighPriority2PVPLevel(cInfo1.commodityId, cInfo2.commodityId))
        {
            result = -1;
        }
        else if (MarketManager.IsHighPriority2PVPLevel(cInfo2.commodityId, cInfo1.commodityId))
        {
            result = 1;
        }
        else if (MarketManager.IsHighPriority2Pool(cInfo1.commodityId, cInfo2.commodityId))
        {
            result = -1;
        }
        else if (MarketManager.IsHighPriority2Pool(cInfo2.commodityId, cInfo1.commodityId))
        {
            result = 1;
        }
        else if (MarketManager.IsHighPriority2Weight(cInfo1.commodityId, cInfo2.commodityId))
        {
            result = -1;
        }
        else if (MarketManager.IsHighPriority2Weight(cInfo2.commodityId, cInfo1.commodityId))
        {
            result = 1;
        }
        else if (cInfo1.commodityId < cInfo2.commodityId)
        {
            result = -1;
        }
        else if (cInfo1.commodityId > cInfo2.commodityId)
        {
            return(1);
        }
        return(result);
    }
Exemplo n.º 25
0
 public GoodObjectWithMoney(int index, CommodityInfo GDSName, string setprice, string sellingprice, string number, string subtotal, string discount, string sum, string barcode, string cropId, string pestId, string specialPrice1, string specialPrice2, string openPrice, string subsidyFertilizer, string subsidyMoney, string ISWS, string CLA1NO)
 {
     _index             = index;
     _GDSName           = GDSName;
     _setprice          = setprice;
     _sellingprice      = sellingprice;
     _number            = number;
     _subtotal          = subtotal;
     _discount          = discount;
     _sum               = sum;
     _barcode           = barcode;
     _cropId            = cropId;
     _pestId            = pestId;
     _specialPrice1     = specialPrice1;
     _specialPrice2     = specialPrice2;
     _openPrice         = openPrice;
     _subsidyFertilizer = subsidyFertilizer;
     _subsidyMoney      = subsidyMoney;
     _ISWS              = ISWS;
     _CLA1NO            = CLA1NO;
 }
Exemplo n.º 26
0
        /// <summary>
        /// 修改上架状态
        /// </summary>
        /// <returns></returns>
        public CommodityUptResponse CommodityUpt(CommodityUptRequest request)
        {
            CommodityUptResponse response = new CommodityUptResponse();
            CommodityInfo        info     = new CommodityInfo()
            {
                CommodityId = request.Id,
            };
            var res = dal.CommodityUpt(info.CommodityId);

            if (res > 0)
            {
                response.Status  = true;
                response.Message = "上架";
            }
            else
            {
                response.Status  = false;
                response.Message = "下架";
            }
            return(response);
        }
Exemplo n.º 27
0
        /// <summary>
        /// 添加商品
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public UnitedReturn Commodity(object data)
        {
            try
            {
                CommodityInfo commodity = new CommodityInfo();
                if (data.ToString() != "System.object" && data.ToString() != "1")
                {
                    commodity = JsonConvert.DeserializeObject <CommodityInfo>(data.ToString());
                }
                var          sql    = String.Format($"insert into CommodityInfo (CommodityName,TypeId,ComndityImg,Price,CommditySum,CommodityState,Descride,CommditySize,Testuer,PutawayTime,ShopId) values('{commodity.CommodityName}','{commodity.TypeId}','{commodity.ComndityImg}','{commodity.Price}','{commodity.CommditySum}',1,'{commodity.Descride}','{commodity.CommditySize}','{commodity.Testuer}',GETDATE(),'{commodity.ShopId}')");
                var          res    = DBHelper.ExecuteNonQuery(sql);
                UnitedReturn united = new UnitedReturn();
                if (res > 0)
                {
                    united.data = res;
                    united.msg  = "添加成功!";
                    united.res  = 1;
                }
                else
                {
                    united.data = null;
                    united.msg  = "添加失败!";
                    united.res  = 0;
                }
                return(united);
            }
            catch (Exception ex)
            {
                //错误日志 log4net
                //1请求接口
                //2请求参数
                //3错误信息
                //4请求时间

                return(new UnitedReturn()
                {
                    data = ex.InnerException.Message, res = -1, msg = ex.Message
                });
            }
        }
Exemplo n.º 28
0
        /// <summary>
        /// 删除数据
        /// </summary>
        /// <param name="goodsid">商品编号</param>
        /// <returns>首页路径</returns>
        public ActionResult Index_1_delete(string goodsid)
        {
            CommodityInfo commodity = new CommodityInfo();

            commodity.CI_ID = Convert.ToInt32(goodsid);

            shopDBEntities shop = new shopDBEntities();

            //shop.CommodityInfo.Remove(commodity);

            shop.Entry(commodity).State = System.Data.EntityState.Deleted;

            int count = shop.SaveChanges();

            if (count > 0)
            {
                return(RedirectToAction("Index_1", "Mindex"));
            }
            else
            {
                Response.Write("<script>alert('删除失败,请再次选择!!')</script>");
                return(RedirectToAction("Index_1", "Mindex"));
            }
        }
Exemplo n.º 29
0
 /// <summary>
 /// 新增商品
 /// </summary>
 /// <param name="errText"></param>
 /// <param name="commodityInfo"></param>
 /// <returns></returns>
 public int InsertEntity(out string errText, CommodityInfo commodityInfo)
 {
     return(dal.InsertEntity(out errText, commodityInfo));
 }
Exemplo n.º 30
0
 /// <summary>
 /// 修改商品
 /// </summary>
 /// <param name="errText"></param>
 /// <param name="CommodityInfo"></param>
 /// <returns></returns>
 public int UpdateEntity(out string errText, CommodityInfo commodityInfo)
 {
     return(dal.UpdateEntity(out errText, commodityInfo));
 }