Ejemplo n.º 1
0
        private void SaveStockWarnNum()
        {
            if (string.IsNullOrEmpty(txtGoodsName.Text.Trim()))
            {
                MessageBox.Show("请选择商品");
            }
            else
            if (string.IsNullOrEmpty(txtWarnNum.Text.Trim()))
            {
                MessageBox.Show("请选择预警数量");
            }
            else
            if (!string.IsNullOrEmpty(txtWarnNum.Text.Trim()) && Convert.ToInt32(txtWarnNum.Text.Trim()) < 0)
            {
                MessageBox.Show("预警数量必须大于等于0");
            }
            //获取商品
            var model = GoodsDAL.getEntryById <Goods, int>(goodId);

            if (model == null)
            {
                MessageBox.Show("未找到该商品信息");
            }
            else
            {
                model.WarnNum = Convert.ToInt32(txtWarnNum.Text.Trim());
                GoodsDAL.edit(model);
                MessageBox.Show("保存成功");
            }
        }
Ejemplo n.º 2
0
        //添加商品 -编辑
        public ActionResult AddGoods(string formVals = "{}")
        {
            var vmResult = new CommonAjaxResponseModel <bool>();

            try
            {
                t_goods model = formVals.ToModel <t_goods>();

                if (model.id != 0)
                {
                    GoodsDAL.UpdateGoods(model);

                    vmResult.BFlag = CommonResponseBFlag.Success;
                    vmResult.TData = true;
                }
                else
                {
                    //插入
                    model.status = 1;
                    GoodsDAL.AddGoods(model);
                    vmResult.BFlag = CommonResponseBFlag.Success;
                    vmResult.TData = true;
                }
            }
            catch (Exception ex)
            {
                vmResult.BFlag = CommonResponseBFlag.SysError;
                vmResult.Msg   = ex.Message;
            }
            return(Json(vmResult));
        }
Ejemplo n.º 3
0
        public ActionResult DeleteGoods(long id)
        {
            t_goods model    = new t_goods();
            var     vmResult = new CommonAjaxResponseModel <VMGDataGrid <t_goods> >();

            vmResult.TData = new VMGDataGrid <t_goods>();

            try
            {
                //删除
                int t1 = GoodsDAL.DeleteGoods(id);
                vmResult.BFlag           = CommonResponseBFlag.Success;
                vmResult.TData.data      = null;
                vmResult.TData.dataCount = 0;
                vmResult.Msg             = string.Format("删除产品成功。");
                return(Json(vmResult));
            }
            catch (Exception ex)
            {
                vmResult.BFlag           = CommonResponseBFlag.LogicError;
                vmResult.TData.data      = null;
                vmResult.TData.dataCount = 0;
                vmResult.Msg             = "编辑报错" + ex.Message;
            }

            return(Json(vmResult));
        }
Ejemplo n.º 4
0
        private void binddata()
        {
            tv.Nodes.Clear();

            tv.ImageList = this.imglist;
            System.Windows.Forms.TreeNode TN = new System.Windows.Forms.TreeNode("商品名称", 0, 1);

            int          total = 0;
            List <Goods> list  = GoodsDAL.Getlist("", 0, out total);

            if (list != null && list.Count > 0)
            {
                foreach (var item in list)
                {
                    TreeNode tr = new TreeNode();
                    tr.Name               = "";
                    tr.Text               = item.GoodsName.ToString();
                    tr.Tag                = item.GoodsId.ToString() + "," + item.KeyUnitId + "," + item.WarnNum;
                    tr.ImageIndex         = 0;
                    tr.SelectedImageIndex = 1;
                    TN.Nodes.Add(tr);
                }
            }



            tv.Nodes.Add(TN);

            tv.ExpandAll();
        }
Ejemplo n.º 5
0
        public void BinddgvData()
        {
            int          total     = 0;
            List <Goods> goodslist = GoodsDAL.Getlist("", 0, out total);

            if (goodslist.Count > 0)
            {
                dicIdlist = goodslist.ToDictionary(x => x.GoodsId);
            }
            if (goodslist != null && goodslist.Count > 0)
            {
                dgvlist.RowCount = goodslist.Count;
                for (int i = 0; i < goodslist.Count; i++)
                {
                    dgvlist[0, i].Value = goodslist[i].GoodsId;
                    dgvlist[1, i].Value = dicIdlist[goodslist[i].GoodsId].GoodsName;
                    dgvlist[2, i].Value = diclist.ContainsKey(goodslist[i].KeyBrandId) ? diclist[goodslist[i].KeyBrandId].KeyName.ToString() : "";
                    dgvlist[3, i].Value = diclist.ContainsKey(goodslist[i].KeyTypeId) ? diclist[goodslist[i].KeyTypeId].KeyType.ToString() : "";
                    dgvlist[4, i].Value = diclist.ContainsKey(goodslist[i].KeyUnitId) ? diclist[goodslist[i].KeyUnitId].KeyName.ToString() : "";
                    dgvlist[5, i].Value = suplierIdlist.ContainsKey(goodslist[i].SupplierId) ? suplierIdlist[goodslist[i].SupplierId].Name.ToString() : "";
                    dgvlist[6, i].Value = goodslist[i].WarnNum;
                }
            }
            else
            {
                dgvlist.Rows.Clear();
            }
        }
Ejemplo n.º 6
0
        public ActionResult GoodsList(int pageIndex, int pageSize, string type, string goodsName, string minPrice, string maxPrice)
        {
            int            total    = 0;
            List <t_goods> list     = new List <t_goods>();
            var            vmResult = new CommonAjaxResponseModel <VMGDataGrid <t_goods> >();

            vmResult.TData = new VMGDataGrid <t_goods>();
            try
            {
                list                       = GoodsDAL.GetGoodsList(pageIndex, pageSize, type, goodsName, minPrice, maxPrice, ref total);
                vmResult.BFlag             = CommonResponseBFlag.Success;
                vmResult.TData.data        = list;
                vmResult.TData.dataCount   = total;
                vmResult.TData.currentPage = pageIndex;
            }
            catch (Exception ex)
            {
                vmResult.BFlag           = CommonResponseBFlag.SysError;
                vmResult.TData.data      = null;
                vmResult.TData.dataCount = 0;
                vmResult.Msg             = ex.Message;
            }


            return(Json(vmResult));
        }
Ejemplo n.º 7
0
        private void BindDrop()
        {
            int total = 0;

            List <Employee> list = EmployeeDAL.Getlist("销售部", 3, out total);

            if (list != null && list.Count > 0)
            {
                cbxemployee.DataSource    = list;
                cbxemployee.DisplayMember = "EmpName";
                cbxemployee.ValueMember   = "EmpId";
            }
            List <Goods> goodslist = GoodsDAL.Getlist("", 0, out total);

            if (goodslist.Count > 0)
            {
                diclist = goodslist.ToDictionary(x => x.GoodsId);
            }
            List <Dic> dickeylist = DicDAL.Getlist("", 0, out total);

            if (dickeylist != null && dickeylist.Count > 0)
            {
                dickeys = dickeylist.ToDictionary(x => x.KeyId);
            }
        }
Ejemplo n.º 8
0
        public JsonResult select(string name = "")
        {
            List <ModelCount> list = GoodsDAL.select(name);
            JsonResult        json = new JsonResult();

            json.Data = new { Data = list };
            return(json);
        }
Ejemplo n.º 9
0
        private void initdata()
        {
            int          total     = 0;
            List <Goods> goodslist = GoodsDAL.Getlist("", 0, out total);

            if (goodslist.Count > 0)
            {
                diclist = goodslist.ToDictionary(x => x.GoodsId);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 根据商品分类获取商品列表
        /// </summary>
        /// <param name="storeID">店铺编号</param>
        /// <param name="categoryID">商品分类ID</param>
        /// <returns></returns>
        public List <GoodsEntity> GetGoodsListByCategoryID(int?storeID, int categoryID)
        {
            var list = GoodsDAL.GetGoodsListByCategoryID(storeID, categoryID);

            if (list != null && list.Any())
            {
                list = list.OrderBy(s => s.RetailPrice).ThenBy(s => s.Name).ToList();
            }
            return(list);
        }
Ejemplo n.º 11
0
        public ActionResult GetGoodsListFromSql(string str)
        {
            StringBuilder  _str = new StringBuilder();
            List <t_goods> list = GoodsDAL.GetGoodsListFromSql(str);
            var            res  = from c in list
                                  select new
            {
                goods_id = c.id,
                value    = c.goodsName + "(" + c.id + ")"
            };

            return(Json(res));
        }
Ejemplo n.º 12
0
        private void save()
        {
            if (txtGoodsName.Text.Trim() == "")
            {
                MessageBox.Show("请输入商品名称");
                return;
            }
            int warnnum = Convert.ToInt32(numericUpDownnum.Value);

            if (warnnum < 0)
            {
                MessageBox.Show("请输入正确的预警数量");
                return;
            }
            model.GoodsName  = txtGoodsName.Text.Trim();
            model.KeyBrandId = Convert.ToInt32(cbxbrand.SelectedValue);
            model.KeyTypeId  = Convert.ToInt32(cbxtype.SelectedValue);
            model.KeyUnitId  = Convert.ToInt32(cbxunit.SelectedValue);
            model.Remark     = txtremark.Text.Trim() == "" ? "" : txtremark.Text.Trim().Length > 150 ? txtremark.Text.Trim().Substring(0, 150).ToString() : txtremark.Text.Trim();
            model.SupplierId = Convert.ToInt32(cbxsuplier.SelectedValue);
            model.WarnNum    = warnnum;
            //进行重复名监测
            if (GoodsDAL.checkloginName(model.GoodsName, GoodsId))
            {
                MessageBox.Show("商品名称已存在");
                return;
            }

            try
            {
                if (GoodsId > 0)
                {
                    GoodsDAL.edit(model);
                }
                else
                {
                    GoodsDAL.add(model);
                }

                MessageBox.Show("保存成功");
            }
            catch (Exception ex)
            {
                MessageBox.Show("保存失败," + ex.Message);
            }
            FrmAllGoods frm = (FrmAllGoods)this.Owner;

            frm.BinddgvData();//刷新
        }
Ejemplo n.º 13
0
        public string GetGoodsByStype(string stype)
        {
            MMessage <ICollection <MGoods> > msg = new MMessage <ICollection <MGoods> >();

            msg.Flag = isValid(soapHeader, out msg.Text);
            if (msg.Flag)
            {
                msg.Flag = GoodsDAL.GetGoodsByStype(stype, out msg.Content, out msg.Text);
            }
            if (!msg.Flag)
            {
                WriteLog("GetGoodsByStype", msg.Flag, msg.Text);
            }
            return(Converter.Serialize(msg));
        }
Ejemplo n.º 14
0
        public object GoodsState(int id)
        {
            int   num   = 0;
            Goods goods = new Goods()
            {
                GoodsId = id
            };
            int result = GoodsDAL.GoodsState(goods);

            if (result > 0)
            {
                num = result;
            }
            return(Json(num));
        }
Ejemplo n.º 15
0
 private void FrmGoodsInsert_Load(object sender, EventArgs e)
 {
     if (GoodsId > 0)
     {
         //类别为修改,绑定数据
         Goods model = GoodsDAL.getEntryById <Goods, long>(GoodsId);
         if (model != null)
         {
             txtGoodsName.Text = model.GoodsName;
             txtremark.Text    = model.Remark;
             cbxbrand.Text     = brandlist[model.KeyBrandId].KeyName;
             cbxunit.Text      = unitlist[model.KeyUnitId].KeyName;
             cbxtype.Text      = goodtypelist[model.KeyTypeId].KeyName;
         }
     }
 }
Ejemplo n.º 16
0
        private void BindDrop()
        {
            int total = 0;


            List <Goods> goodslist = GoodsDAL.Getlist("", 0, out total);

            if (goodslist.Count > 0)
            {
                diclist = goodslist.ToDictionary(x => x.GoodsId);
            }
            List <Dic> dickeylist = DicDAL.Getlist("", 0, out total);

            if (dickeylist != null && dickeylist.Count > 0)
            {
                dickeys = dickeylist.ToDictionary(x => x.KeyId);
            }
        }
Ejemplo n.º 17
0
        public static List <GoodsModel> GetListAll(int playerId, int belongsTo, out bool fromCache)
        {
            fromCache = false;
            string redisKey = RedisKeyHelper.GetRedisKeyName(RedisKeyConfig.Goods, playerId.ToString(), belongsTo.ToString());
            var    list     = redisCacheHelper.StringGet <List <GoodsModel> >(redisKey);

            if (list != null)
            {
                fromCache = true;
                return(list);
            }
            else
            {
                list = GoodsDAL.GetListAll(playerId, belongsTo);
                redisCacheHelper.StringSet(redisKey, list, CommonConfig.DefRedisExpiry);
                return(list);
            }
        }
Ejemplo n.º 18
0
        public JsonResult GoodsInsert(string name, decimal jinjia, decimal shoujia, string img, int Select)
        {
            int   num   = 0;
            Goods goods = new Goods()
            {
                GoodsName   = name,
                EnterPrice  = jinjia,
                SellPrice   = shoujia,
                GoodsImg    = img,
                GoodsTypeId = Select,
            };
            int result = GoodsDAL.GoodsInsert(goods);

            if (result > 0)
            {
                num = result;
            }
            return(Json(num));
        }
Ejemplo n.º 19
0
        public JsonResult GoodsUpdate(string GoodsName, int GoodsTypeId, decimal SellPrice, decimal EnterPrice, string GoodsImg, int GoodsState, int GoodsId)
        {
            int   num   = 0;
            Goods goods = new Goods()
            {
                GoodsName   = GoodsName,
                GoodsTypeId = GoodsTypeId,
                SellPrice   = SellPrice,
                EnterPrice  = EnterPrice,
                GoodsImg    = GoodsImg,
                GoodsState  = GoodsState,
                GoodsId     = GoodsId,
            };
            int result = GoodsDAL.GoodsUpdate(goods);

            if (result > 0)
            {
                num = result;
            }
            return(Json(num));
        }
Ejemplo n.º 20
0
        private void initKeylist()
        {
            List <Dic> dickeylist = DicDAL.Getlist("", 0, out total);

            if (dickeylist != null && dickeylist.Count > 0)
            {
                dickeys = dickeylist.ToDictionary(x => x.KeyId);
            }

            List <Goods> goodslist = GoodsDAL.Getlist("", 0, out total);

            if (goodslist.Count > 0)
            {
                diclist = goodslist.ToDictionary(x => x.GoodsId);
            }

            List <Ware> wlist = WareDAL.Getlist();

            if (wlist.Count > 0)
            {
                warelist = wlist.ToDictionary(x => x.WareId);
            }
        }
Ejemplo n.º 21
0
        private void tsDelete_Click(object sender, EventArgs e)
        {
            int id = getgoodid();

            if (MessageBox.Show("确认删除吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                Goods model = GoodsDAL.getEntryById <Goods, long>(id);
                if (model != null)
                {
                    List <Stock> stocklist = StockDAL.Getlist("", 20, out id);
                    if (stocklist != null && stocklist.Where(x => x.GoodsId == model.GoodsId).Count() > 0)
                    {
                        MessageBox.Show("库存中还有该商品,不能删除");
                        return;
                    }
                    else
                    {
                        GoodsDAL.DeleteEntry <Goods, long>(model.GoodsId);
                        MessageBox.Show("删除成功");
                        BinddgvData();
                    }
                }
            }
        }
Ejemplo n.º 22
0
 public DataTable GetGoodsTableByCodeOrName(string barIDOrName, string storeID = "")
 {
     return(GoodsDAL.GetGoodsTableByCodeOrName(barIDOrName, storeID));
 }
Ejemplo n.º 23
0
 public List <GoodsEntity> GetGoodsList(string storeID = "")
 {
     return(GoodsDAL.GetGoodsList(storeID));
 }
Ejemplo n.º 24
0
 public bool InsertOrUpdateGoods(GoodsEntity entity, OperationType type = OperationType.Insert)
 {
     return(GoodsDAL.InsertOrUpdateGoods(entity));
 }
Ejemplo n.º 25
0
 public int UpdateGoodsStock(GoodsEntity entity)
 {
     return(GoodsDAL.UpdateGoodsStock(entity));
 }
Ejemplo n.º 26
0
 public int SetExchangePricePermission(GoodsGrantExt entity)
 {
     return(GoodsDAL.SetExchangePricePermission(entity));
 }
Ejemplo n.º 27
0
 public int SetDiscountPricePermission(GoodsGrantExt entity)
 {
     return(GoodsDAL.SetDiscountPricePermission(entity));
 }
Ejemplo n.º 28
0
 public DataRow SetGrantGoods(int storeID, string selectIds, string unselectIds)
 {
     return(GoodsDAL.SetGrantGoods(storeID, selectIds, unselectIds));
 }
Ejemplo n.º 29
0
 /// <summary>
 /// 获取有效换购商品
 /// </summary>
 /// <param name="storeID"></param>
 /// <returns></returns>
 public List <GoodsGrantExt> GetValidExchangePrice(int storeID)
 {
     return(GoodsDAL.GetValidExchangePrice(storeID));
 }
Ejemplo n.º 30
0
 public List <GoodsGrantExt> GetGoodsGrantListExt(int storeID, string grantType)
 {
     return(GoodsDAL.GetGoodsGrantListExt(storeID, grantType));
 }