예제 #1
0
        /// <summary>
        /// 得到一个对象实体,包括一级,二级名称
        /// </summary>
        public lgk.Model.tb_goods GetModelAndName(long ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select g.*,t.TypeName typename1,p.TypeName typename2");
            strSql.Append(" from tb_goods as g join dbo.tb_produceType as t on t.ID=g.TypeID join tb_produceType as p on p.ID=g.GoodsType AND g.Goods003 <> 1");
            strSql.Append(" where g.ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.BigInt)
            };
            parameters[0].Value = ID;

            lgk.Model.tb_goods model = new lgk.Model.tb_goods();
            DataSet            ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
예제 #2
0
        protected void ShowInfo()
        {
            lgk.Model.tb_goods model = goodsBLL.GetModel(GetPID());
            txtGoodsCode.Text = model.GoodsCode;
            txtGoodsName.Text = model.GoodsName;

            txtPrice.Text        = model.Price.ToString();
            txtShopPrice.Text    = model.ShopPrice.ToString();
            txtRealityPrice.Text = model.Pic5.ToString();//库存

            //Goods004
            foreach (ListItem li in  checkList.Items)
            {
                if (("," + model.Goods004 + ",").IndexOf("," + li.Value + ",") > -1)
                {
                    li.Selected = true;
                }
            }

            txtCity.Text          = model.City;
            ddlType.SelectedValue = model.TypeID.ToString();
            ListItem item_list = new ListItem();

            item_list.Value = "0";
            item_list.Text  = "请选择";
            this.ddl_secondType.Items.Add(item_list);
            bind_DropDownList(this.ddl_secondType, produceTypeBLL.GetList("ParentID=" + model.TypeID).Tables[0], "ID", "TypeName");
            ddl_secondType.SelectedValue = model.GoodsType.ToString();
            textPubContext.Text          = model.Remarks;

            Image1.ImageUrl = "../../Upload/" + model.Pic1;
        }
예제 #3
0
        public lgk.Model.tb_goods GetModel(string where)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,GoodsCode,GoodsName,Price,RealityPrice,Standard,IsHave,TypeID,GoodsType,Pic1,Pic2,Pic3,Pic4,Pic5,Summary,Remarks,AddTime,Goods001,Goods002,Goods003,Goods004,Goods005,Goods006,Goods007,Goods008,GoodsName_en,Remarks_en,StateType,City,ShopPrice,Inventory,SaleNum from tb_goods ");
            strSql.Append(" where " + where);

            lgk.Model.tb_goods model = new lgk.Model.tb_goods();
            DataSet            ds    = DbHelperSQL.Query(strSql.ToString(), null);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
예제 #4
0
        public void ShowData()
        {
            string gID  = SafeHelper.NoHtml(Request.QueryString["gid"]);
            long   Igid = 0;

            if (long.TryParse(gID, out Igid))
            {
                hdgid.Value = gID;
                hduid.Value = getLoginID().ToString();
                lgk.Model.tb_goods gModel = goodsBLL.GetModel(Igid);
                if (gModel != null)
                {
                    ltGoodsCode.Text = gModel.GoodsCode;
                    ltGoodsName.Text = gModel.GoodsName;
                    ltPrice.Text     = gModel.Price.ToString();
                    ltRPrice.Text    = gModel.RealityPrice.ToString();
                    ltKucun.Text     = gModel.Goods002.ToString();
                    Image0.ImageUrl  = "../../Upload/" + gModel.Pic1;
                    ltRemark.Text    = gModel.Remarks;
                }
            }
        }
예제 #5
0
        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int id = Convert.ToInt32(e.CommandArgument.ToString());

            lgk.Model.tb_goods model = goodsBLL.GetModel(id);
            if (model == null)
            {
                MessageBox.Show(this, "该商品已删除!");
                return;
            }

            if (e.CommandName.Equals("Audit")) //审核商品
            {
                if (model.StateType == 1)
                {
                    model.StateType = 0;
                    if (goodsBLL.Update(model))
                    {
                        MessageBox.Show(this, "审核不通过!");
                    }
                }
                else
                {
                    model.StateType = 1;
                    if (goodsBLL.Update(model))
                    {
                        MessageBox.Show(this, "审核通过!");
                    }
                }
            }
            if (e.CommandName.Equals("edit")) //编辑商品
            {
                Response.Redirect("EditProduct.aspx?pid=" + id);
            }
            if (e.CommandName.Equals("up"))
            {
                model.Goods001 = 1;
                if (goodsBLL.Update(model))
                {
                    MessageBox.Show(this, "上架成功!");
                }
            }
            if (e.CommandName.Equals("down"))
            {
                model.Goods001 = 0;
                if (goodsBLL.Update(model))
                {
                    MessageBox.Show(this, "下架成功!");
                }
            }
            if (e.CommandName.Equals("del")) //商品上架
            {
                if (model.Goods001 > 0)
                {
                    MessageBox.Show(this, "请先下架后再删除!");
                    return;
                }
                if (goodsBLL.Delete1(id))
                {
                    MessageBox.Show(this, "删除成功!");
                }
            }
            BindData();
        }
예제 #6
0
        public bool AddGoodCar(long userid, long goodsid, int buynum, out string msg)
        {
            if (!userBLL.Exists(userid))
            {
                msg = "用户不存在";
            }
            lgk.Model.tb_goods goodsInfo = goodsBLL.GetModel(goodsid);
            if (goodsInfo == null)
            {
                msg = "此商品不存在!";
                return(false);
            }
            lgk.Model.tb_goodsCar goodsCarInfo = new lgk.Model.tb_goodsCar();
            if (goodsInfo.Goods002 <= 0)
            {
                msg = "商品库存不足!";
                return(false);
            }
            if (goodsInfo.Goods002 < buynum)
            {
                msg = "商品库存不足!";
                return(false);
            }
            goodsCarInfo.GoodsID      = goodsInfo.ID;
            goodsCarInfo.GoodsCode    = goodsInfo.GoodsCode;
            goodsCarInfo.GoodsName    = goodsInfo.GoodsName;
            goodsCarInfo.Price        = goodsInfo.Price;
            goodsCarInfo.RealityPrice = goodsInfo.RealityPrice;
            goodsCarInfo.ShopPrice    = goodsInfo.ShopPrice;

            goodsCarInfo.TypeID        = goodsInfo.TypeID;
            goodsCarInfo.TypeIDName    = produceTypeBLL.GetTypeName(goodsInfo.TypeID);
            goodsCarInfo.GoodsType     = goodsInfo.GoodsType;
            goodsCarInfo.GoodsTypeName = produceTypeBLL.GetTypeName(goodsInfo.GoodsType);
            goodsCarInfo.Pic1          = goodsInfo.Pic1;
            goodsCarInfo.Remarks       = goodsInfo.Remarks;
            goodsCarInfo.Goods002      = goodsInfo.Goods002;
            goodsCarInfo.Goods005      = decimal.Parse(goodsInfo.Goods005.ToString());

            goodsCarInfo.Goods006      = buynum;                                            //购买数量
            goodsCarInfo.BuyUser       = userid;                                            //购买者
            goodsCarInfo.TotalMoney    = goodsCarInfo.Goods006 * goodsCarInfo.RealityPrice; //总金
            goodsCarInfo.TotalGoods006 = 0;                                                 //总积分
            goodsCarInfo.AddTime       = DateTime.Now;
            //goodsCarInfo.gColor = hhcolor.Value.Trim();
            //goodsCarInfo.gSize = hhsize.Value.Trim();
            string where = string.Format(" BuyUser ={0} and GoodsID={1}", goodsCarInfo.BuyUser, goodsCarInfo.GoodsID);
            lgk.Model.tb_goodsCar _carModel = new lgk.Model.tb_goodsCar();
            _carModel = goodsCarBLL.GetModel(where);

            DataSet dsCount = goodsCarBLL.GetList("BuyUser="******"购物车商品已经装满!";
                return(false);
            }
            #region
            if (_carModel != null && _carModel.GoodsID > 0 && _carModel.RealityPrice == goodsInfo.RealityPrice && _carModel.Goods002 == goodsInfo.Goods002) //购物车中已经存在
            {
                _carModel.Goods006 += goodsCarInfo.Goods006;                                                                                                //加上原来的数量
                                                                                                                                                            // _carModel.Goods002 += carModel.Goods002;
                _carModel.TotalMoney += goodsCarInfo.TotalMoney;                                                                                            //总金额
                //_carModel.TotalGoods006 += goodsCarInfo.TotalGoods006;
                if (goodsCarBLL.Update(_carModel) == true)
                {
                    msg = "成功加入购物车";
                }
                else
                {
                    msg = "加入购物车失败,请重试!";
                    return(false);
                }
            }
            else
            {
                if (goodsCarBLL.Add(goodsCarInfo) > 0)
                {
                    msg = "成功加入购物车";
                }
                else
                {
                    msg = "加入购物车失败,请重试!";
                    return(false);
                }
            }
            #endregion

            return(true);
        }
예제 #7
0
        public bool GoodsCartPay(long userid, int paytype, long addrid, string strcid, string aa, out string msg)
        {
            string[] arr = strcid.Split(',');
            LogHelper.SaveLog(strcid, "GoodsCartPay");

            if (arr.Length <= 0)
            {
                msg = "传递的ID无数据";
                return(false);
            }

            Random   rand       = new Random();
            string   orderCode  = DateTime.Now.ToString("yyyyMMddhhmmss") + rand.Next(10000, 99999); //订单编号
            string   goodsname  = string.Format("订单号{0},", orderCode);
            decimal  totalMoney = 0;
            int      orderSum   = 0;
            int      insert     = 0;
            DateTime dtime      = DateTime.Now;


            if (!userBLL.Exists(userid))
            {
                msg = "用户不存在";
                return(false);
            }

            if (paytype != 1)
            {
                msg = "支付类型错误";
                return(false);
            }

            lgk.Model.tb_Address addrModel = addressBLL.GetModel(addrid);
            if (addrModel == null)
            {
                msg = "请选择收货地址";
                return(false);
            }

            IList <lgk.Model.tb_goodsCar> listCar = new List <lgk.Model.tb_goodsCar>();

            #region 验证商品
            string errmsg = "";
            foreach (var strID in arr)
            {
                long id = 0;
                long.TryParse(strID, out id);
                lgk.Model.tb_goodsCar carModel = goodsCarBLL.GetModel(id);
                if (carModel != null)
                {
                    lgk.Model.tb_goods goodsModel = goodsBLL.GetModelAndOneName(carModel.GoodsID); //根据发布商品编号找到充值账号密码
                    if (goodsModel.StateType == 0)                                                 //判断是否 审核通过 0未审核
                    {
                        errmsg = "商品" + goodsModel.GoodsName + "审核未通过,请删除该商品!";
                        insert = 0;
                        break;
                    }
                    else if (goodsModel.Goods003 == "1") //判断是否 删除 1已经删除
                    {
                        errmsg = "商品" + goodsModel.GoodsName + "已被删除,请删除该商品!";
                        insert = 0;
                        break;
                    }
                    else if (goodsModel.Goods001 == 0) //判断是否 0下架
                    {
                        errmsg = "商品" + goodsModel.GoodsName + "已经下架,请删除该商品!";
                        insert = 0;
                        break;
                    }
                    else if (goodsModel.Goods002 < carModel.Goods006) //判断库存量
                    {
                        errmsg = "商品" + goodsModel.GoodsName + "库存不足,请重新修改数量!";
                        insert = 0;
                        break;
                    }
                    else if (carModel.BuyUser != userid) //判断库存量
                    {
                        errmsg = "用户不匹配,请刷新购物车再提交!";
                        insert = 0;
                        break;
                    }
                    listCar.Add(carModel);
                    insert += 1;
                }
                else
                {
                    msg = "购物出为空";
                    LogHelper.SaveLog(id.ToString() + "," + errmsg, "GoodsCartPay");
                    return(false);
                }
            }

            if (insert == 0)
            {
                msg = errmsg;
                return(false);
            }
            #endregion

            //总金额
            totalMoney += listCar.Sum(s => s.TotalMoney);
            lgk.Model.tb_user userModel = userBLL.GetModel(userid);
            //支付方式
            string[] aw = aa.Split('-');

            //if (!userBLL.Exists(long.Parse(aw[2])))
            //{
            //    msg = "运营中心不存在";
            //    return false;
            //}
            string sql = "select OrderID from tb_Order where UserID=" + userModel.UserID;
            var    mo  = userBLL.getData_Chaxun(sql, "").Tables[0];

            if (aw[0] == "1")
            {
                //if (mo.Rows.Count > 0)
                //{
                //    msg = "请选择复投产品";
                //    return false;
                //}
                if (aw[1] == "2")
                {
                    if (userModel.StockMoney < totalMoney / 2 || userModel.StockAccount < totalMoney / 2)
                    {
                        msg = "报单积分、电子积分余额不足";
                        return(false);
                    }
                }
                else
                {
                    if (userModel.StockAccount < totalMoney)
                    {
                        msg = "报单积分余额不足";
                        return(false);
                    }
                }
            }
            else if (aw[0] == "2")
            {
                if (userModel.AllBonusAccount < totalMoney)
                {
                    msg = "种子积分余额不足";
                    return(false);
                }
            }
            else if (aw[0] == "3")
            {
                if (userModel.StockMoney < totalMoney / 2 || userModel.StockAccount < totalMoney / 2)
                {
                    msg = "报单积分、电子积分余额不足";
                    return(false);
                }
            }
            else if (aw[0] == "4")
            {
                if (userModel.BonusAccount < totalMoney)
                {
                    msg = "消费积分余额不足";
                    return(false);
                }
            }

            #region 订单处理
            //总订单
            lgk.Model.tb_Order orderModel = new lgk.Model.tb_Order();        //订单
            orderModel.UserID     = userid;                                  //用户
            orderModel.OrderCode  = orderCode;                               //订单编号
            orderModel.OrderSum   = orderSum;                                //订单数--
            orderModel.OrderTotal = totalMoney;                              //购买总金
            orderModel.PVTotal    = totalMoney * getParamAmount("hongbao1"); //
            orderModel.OrderDate  = dtime;
            orderModel.IsSend     = 1;
            orderModel.PayMethod  = 1;                    //--
            orderModel.Order5     = "";                   //运营中心UserID
            orderModel.UserAddr   = addrModel.Address;    //发货地址
            orderModel.Order6     = addrModel.PhoneNum;   //收货电话
            orderModel.Order7     = addrModel.MemberName; //收货姓名
            orderModel.OrderType  = int.Parse(aw[0]);     //1:
            int fenrun = 0;
            foreach (var carModel in listCar)
            {
                lgk.Model.tb_goods       goodsModel       = goodsBLL.GetModelAndOneName(carModel.GoodsID); //根据发布商品编号找到充值账号密码
                lgk.Model.tb_goods       goodsModel1      = goodsBLL.GetModel(carModel.GoodsID);           //插入订单详细表
                lgk.Model.tb_OrderDetail orderDetailModel = new lgk.Model.tb_OrderDetail();
                orderDetailModel.OrderCode   = orderCode;
                orderDetailModel.Price       = carModel.RealityPrice;                     //单价--
                orderDetailModel.OrderSum    = carModel.Goods006;                         //数量--
                orderDetailModel.OrderTotal  = carModel.Goods006 * carModel.RealityPrice; //订单金额
                orderDetailModel.PV          = 0;                                         //
                orderDetailModel.PVTotal     = 0;
                orderDetailModel.ProcudeID   = carModel.GoodsID;                          //产品编号--
                orderDetailModel.ProcudeName = carModel.GoodsName;                        //名称--
                orderDetailModel.gColor      = carModel.gColor;
                orderDetailModel.gSize       = carModel.gSize;
                orderDetailModel.OrderDate   = dtime;                          //
                orderDetailBLL.Add(orderDetailModel);                          //加入订单详情

                fenrun += goodsModel1.IsHave * carModel.Goods006;              //计算分润单位
                //修改库存
                goodsModel.Goods002 = goodsModel.Goods002 - carModel.Goods006; //修改库存
                goodsModel.SaleNum += carModel.Goods006;
                goodsBLL.Update(goodsModel);

                //从购物篮减掉
                goodsCarBLL.Delete(carModel.ID);

                //商品名称 流水表记录用
                goodsname += orderDetailModel.ProcudeName + "|";

                orderSum += carModel.Goods006;
            }
            orderModel.BaodanOrder = fenrun;
            //if (aw[3]=="1")//自提
            //{

            //    orderModel.Order3 = "自提";
            //    orderModel.Order4 = "自提";
            //}
            #endregion
            //if (aw[1]=="2")//种子积分
            //{
            //    orderModel.Order3 = "种子积分购买无发货信息!";
            //    orderModel.Order4= "种子积分购买无发货信息!";
            //    orderModel.IsSend = 3;
            //    long iOrderID = orderBLL.Add(orderModel);//加入订单表
            //}
            //else
            //{
            long iOrderID = orderBLL.Add(orderModel);//加入订单表
            //}



            #region 写入到明细表
            if (aw[0] == "1")
            {
                if (aw[1] == "2")
                {
                    lgk.Model.tb_journal joModel = new lgk.Model.tb_journal();
                    joModel.UserID      = userModel.UserID;
                    joModel.Remark      = goodsname;                                   //名称--;
                    joModel.InAmount    = 0;                                           //收入0;
                    joModel.OutAmount   = totalMoney / 2;                              //购买价(支出金币)
                    joModel.JournalDate = DateTime.Now;
                    joModel.Journal01   = userModel.UserID;                            //
                    joModel.Journal02   = 99;                                          //消费
                    joModel.Journal03   = orderCode;                                   //订单编号
                    if (aw[0] == "2")                                                  //50%电子积分+50%消费积分
                    {
                        joModel.JournalType   = 2;                                     //币种
                        joModel.BalanceAmount = userModel.StockMoney - totalMoney / 2; //余额
                    }
                    journalBLL.Add(joModel);

                    ///---------------------------
                    joModel.UserID      = userModel.UserID;
                    joModel.Remark      = goodsname;                                     //名称--;
                    joModel.InAmount    = 0;                                             //收入0;
                    joModel.OutAmount   = totalMoney / 2;                                //购买价(支出金币)
                    joModel.JournalDate = DateTime.Now;
                    joModel.Journal01   = userModel.UserID;                              //
                    joModel.Journal02   = 99;                                            //消费
                    joModel.Journal03   = orderCode;                                     //订单编号
                    if (aw[0] == "2")                                                    //50%电子积分+50%消费积分
                    {
                        joModel.JournalType   = 5;                                       //币种
                        joModel.BalanceAmount = userModel.StockAccount - totalMoney / 2; //余额
                    }
                    journalBLL.Add(joModel);
                    UpdateAccount("StockMoney", userModel.UserID, totalMoney / 2, 0);
                    UpdateAccount("StockAccount", userModel.UserID, totalMoney / 2, 0);
                }
                else
                {
                    lgk.Model.tb_journal joModel = new lgk.Model.tb_journal();
                    joModel.UserID        = userModel.UserID;
                    joModel.Remark        = goodsname;                           //名称--;
                    joModel.InAmount      = 0;                                   //收入0;
                    joModel.OutAmount     = totalMoney;                          //购买价(支出金币)
                    joModel.JournalDate   = DateTime.Now;
                    joModel.Journal01     = userModel.UserID;                    //
                    joModel.Journal02     = 99;                                  //消费
                    joModel.Journal03     = orderCode;                           //订单编号
                    joModel.JournalType   = 5;                                   //币种
                    joModel.BalanceAmount = userModel.StockAccount - totalMoney; //余额
                    journalBLL.Add(joModel);
                    UpdateAccount("StockAccount", userModel.UserID, totalMoney, 0);
                }
            }
            else if (aw[0] == "2")
            {
                lgk.Model.tb_journal joModel = new lgk.Model.tb_journal();
                joModel.UserID        = userModel.UserID;
                joModel.Remark        = goodsname;                              //名称--;
                joModel.InAmount      = 0;                                      //收入0;
                joModel.OutAmount     = totalMoney;                             //购买价(支出金币)
                joModel.JournalDate   = DateTime.Now;
                joModel.Journal01     = userModel.UserID;                       //
                joModel.Journal02     = 99;                                     //消费
                joModel.Journal03     = orderCode;                              //订单编号
                joModel.JournalType   = 4;                                      //币种
                joModel.BalanceAmount = userModel.AllBonusAccount - totalMoney; //余额
                UpdateAccount("AllBonusAccount", userModel.UserID, totalMoney, 0);
                journalBLL.Add(joModel);
            }
            else if (aw[0] == "3")
            {
                lgk.Model.tb_journal joModel = new lgk.Model.tb_journal();
                joModel.UserID        = userModel.UserID;
                joModel.Remark        = goodsname;                             //名称--;
                joModel.InAmount      = 0;                                     //收入0;
                joModel.OutAmount     = totalMoney / 2;                        //购买价(支出金币)
                joModel.JournalDate   = DateTime.Now;
                joModel.Journal01     = userModel.UserID;                      //
                joModel.Journal02     = 99;                                    //消费
                joModel.Journal03     = orderCode;                             //订单编号
                joModel.JournalType   = 2;                                     //币种子电子积分
                joModel.BalanceAmount = userModel.StockMoney - totalMoney / 2; //余额
                journalBLL.Add(joModel);

                ///---------------------------报单积分扣钱
                joModel.UserID        = userModel.UserID;
                joModel.Remark        = goodsname;                               //名称--;
                joModel.InAmount      = 0;                                       //收入0;
                joModel.OutAmount     = totalMoney / 2;                          //购买价(支出金币)
                joModel.JournalDate   = DateTime.Now;
                joModel.Journal01     = userModel.UserID;                        //
                joModel.Journal02     = 99;                                      //消费
                joModel.Journal03     = orderCode;                               //订单编号
                joModel.JournalType   = 5;                                       //币种
                joModel.BalanceAmount = userModel.StockAccount - totalMoney / 2; //余额
                journalBLL.Add(joModel);
                UpdateAccount("StockMoney", userModel.UserID, totalMoney / 2, 0);
                UpdateAccount("StockAccount", userModel.UserID, totalMoney / 2, 0);
            }
            else if (aw[0] == "4")
            {
                lgk.Model.tb_journal joModel = new lgk.Model.tb_journal();
                joModel.UserID        = userModel.UserID;
                joModel.Remark        = goodsname;                           //名称--;
                joModel.InAmount      = 0;                                   //收入0;
                joModel.OutAmount     = totalMoney;                          //购买价(支出金币)
                joModel.JournalDate   = DateTime.Now;
                joModel.Journal01     = userModel.UserID;                    //
                joModel.Journal02     = 99;                                  //消费
                joModel.Journal03     = orderCode;                           //订单编号
                joModel.JournalType   = 3;                                   //币种
                joModel.BalanceAmount = userModel.BonusAccount - totalMoney; //余额
                UpdateAccount("BonusAccount", userModel.UserID, totalMoney, 0);
                journalBLL.Add(joModel);
            }
            else
            {
                msg = "支付失败,支付方式不正确!";
                return(false);
            }
            //---激活会员
            lgk.Model.tb_user user = userBLL.GetModel(orderModel.UserID);
            if (user.IsOpend != 2)
            {
                string   a  = Luodian(orderModel.UserID);
                string[] ID = a.Split('-');//ID[0]=UserID ID[1]=Location ID[2]=ParentID ID[3]=ParentCode  ID[4]=Layer
                var      l  = userBLL.GetModel(int.Parse(ID[2]));
                //user.RecommendPath = model_1.RecommendPath + "-" + user.UserID.ToString();

                user.ParentID   = 0;  //父节点ID
                user.ParentCode = ""; //父节点編號
                user.UserPath   = "";
                user.Layer      = 0;  //属于多少层
                user.Location   = 0;

                user.ParentID   = int.Parse(ID[2]); //父节点ID
                user.ParentCode = ID[3];            //父节点編號
                user.UserPath   = l.UserPath + "-" + user.UserID;
                user.Layer      = int.Parse(ID[4]); //属于多少层
                user.Location   = int.Parse(ID[1]);
                user.OpenTime   = DateTime.Now;
                user.IsOpend    = 2;
                userBLL.Update(user);
            }
            //开关报单
            MySQL(string.Format(" exec proc_Kaiguan " + orderModel.UserID + "," + orderModel.OrderCode + ""));

            //报单开关
            //---激活会员
            if (aw[0] != "4")
            {
                MySQL(string.Format(" exec proc_YejiUp " + orderModel.UserID + "," + orderModel.OrderTotal + ""));//加业绩
                MySQL(string.Format(" exec proc_Fenxiangjiang " + orderModel.UserID + "," + orderModel.OrderTotal + ""));
                MySQL(string.Format(" exec proc_Xiaocengjiang " + orderModel.UserID + ""));
                MySQL(string.Format(" exec proc_Xiaoliangjiang " + orderModel.UserID + ""));
                MySQL(string.Format(" exec proc_Jiandianjiang " + orderModel.UserID + "," + orderModel.OrderTotal + ",1"));

                //发奖
                #region 报单中心(20套)改为4万元
                if (orderModel.OrderTotal >= getParamInt("Fuwu2"))//报单中心(20套)
                {
                    int t = agentBLL.GetIDByIDUser(orderModel.UserID);
                    if (t == 0)//插入用户
                    {
                        var userModel1           = userBLL.GetModel(orderModel.UserID);
                        lgk.Model.tb_agent model = new lgk.Model.tb_agent();
                        model.UserID    = userModel1.UserID;
                        model.AgentCode = userModel1.UserCode;
                        model.Flag      = 1;
                        model.AgentType = 1;
                        model.Agent003  = userModel1.TrueName;
                        model.AppliTime = DateTime.Now;
                        model.JoinMoney = 0;
                        model.Agent004  = "";
                        model.Agent001  = 0;
                        model.Agent002  = 0;
                        model.PicLink   = "";
                        agentBLL.Add(model);

                        var model1 = userBLL.GetModel(userModel1.UserID);
                        model1.AgentsID = agentBLL.GetIDByIDUser(userModel1.UserID);
                        model1.IsAgent  = 1;
                        userBLL.Update(model1);

                        lgk.Model.tb_journal journalInfo = new lgk.Model.tb_journal();
                        journalInfo.UserID        = userModel1.UserID;
                        journalInfo.Remark        = "一次性购买 " + getParamInt("Fuwu2") + "元的产品,成为服务网点";
                        journalInfo.RemarkEn      = "Cash withdrawal";
                        journalInfo.InAmount      = 0;
                        journalInfo.OutAmount     = 0;
                        journalInfo.BalanceAmount = userBLL.GetMoney(userModel1.UserID, "StockMoney");
                        journalInfo.JournalDate   = DateTime.Now;
                        journalInfo.JournalType   = 2;
                        journalInfo.Journal01     = userModel1.UserID;
                        journalBLL.Add(journalInfo);
                    }
                }
                userid     = orderModel.UserID;
                totalMoney = orderModel.OrderTotal;
                #endregion
                if (getParamInt("Fuwu") == 1)
                {
                    //报单中心奖

                    long    BD_UserID = userBLL.GetUserID(userBLL.GetModel(orderModel.UserID).User006);
                    decimal BD        = getParamAmount("Fuwu1") / 100 * totalMoney;

                    int isLock = userBLL.GetModel(BD_UserID).IsLock;
                    int Ag     = userBLL.GetModel(BD_UserID).IsAgent;
                    if (isLock == 0 && Ag == 1)
                    {
                        decimal shouxufei = BD * getParamAmount("PingTai") / 100;
                        BD -= shouxufei;
                        decimal Gongyi = BD * getParamAmount("PingTai1") / 100;
                        BD -= Gongyi;

                        decimal jiangjin = getParamAmount("JJ");
                        decimal zhongzi  = getParamAmount("ZZ");
                        decimal xiaofei  = getParamAmount("XF");
                        decimal JJ       = BD * jiangjin / 100;
                        decimal ZZ       = BD * zhongzi / 100;
                        decimal XF       = BD * xiaofei / 100;
                        UpdateAccount("Emoney", BD_UserID, JJ, 1);             //奖金
                        UpdateAccount("StockMoney", BD_UserID, ZZ, 1);         //电子

                        UpdateAccount("ShopAccount", BD_UserID, shouxufei, 1); //奖金
                        UpdateAccount("GLmoney", BD_UserID, Gongyi, 1);        //电子
                        if (XF > 0)
                        {
                            UpdateAccount("BonusAccount", BD_UserID, XF, 1);//消费
                            lgk.Model.tb_journal journal1 = new lgk.Model.tb_journal();
                            journal1.UserID        = BD_UserID;
                            journal1.Remark        = "服务网点获得" + (BD + shouxufei + Gongyi) + ",其中扣除平台手续费" + shouxufei + ",扣除公益基金" + Gongyi + " ,剩余" + xiaofei + "%进入消费积分";
                            journal1.RemarkEn      = "";
                            journal1.InAmount      = XF;
                            journal1.OutAmount     = 0;
                            journal1.BalanceAmount = userBLL.GetMoney(BD_UserID, "BonusAccount");;
                            journal1.JournalDate   = DateTime.Now;
                            journal1.JournalType   = 3;
                            journal1.Journal01     = 0;
                            journalBLL.Add(journal1);
                        }

                        lgk.Model.tb_journal journal = new lgk.Model.tb_journal();
                        journal.UserID        = BD_UserID;
                        journal.Remark        = "服务网点获得" + (BD + shouxufei + Gongyi) + ",其中扣除平台手续费" + shouxufei + ",扣除公益基金" + Gongyi + " ,剩余" + jiangjin + "%进入奖金积分";
                        journal.RemarkEn      = "";
                        journal.InAmount      = JJ;
                        journal.OutAmount     = 0;
                        journal.BalanceAmount = userBLL.GetMoney(BD_UserID, "Emoney");;
                        journal.JournalDate   = DateTime.Now;
                        journal.JournalType   = 1;
                        journal.Journal01     = 0;
                        journalBLL.Add(journal);

                        journal.UserID        = BD_UserID;
                        journal.Remark        = "服务网点获得" + (BD + shouxufei + Gongyi) + ",其中扣除平台手续费" + shouxufei + ",扣除公益基金" + Gongyi + " ,剩余" + zhongzi + "%进入电子积分";
                        journal.RemarkEn      = "";
                        journal.InAmount      = ZZ;
                        journal.OutAmount     = 0;
                        journal.BalanceAmount = userBLL.GetMoney(BD_UserID, "StockMoney");;
                        journal.JournalDate   = DateTime.Now;
                        journal.JournalType   = 2;
                        journal.Journal01     = 0;
                        journalBLL.Add(journal);

                        journal.UserID        = BD_UserID;
                        journal.Remark        = "服务网点获得" + (BD + shouxufei + Gongyi) + ",其中扣除平台手续费" + shouxufei + "";
                        journal.RemarkEn      = "";
                        journal.InAmount      = shouxufei;
                        journal.OutAmount     = 0;
                        journal.BalanceAmount = userBLL.GetMoney(BD_UserID, "ShopAccount");;
                        journal.JournalDate   = DateTime.Now;
                        journal.JournalType   = 6;
                        journal.Journal01     = 0;
                        journalBLL.Add(journal);

                        journal.UserID        = BD_UserID;
                        journal.Remark        = "服务网点获得" + (BD + shouxufei + Gongyi) + ",其中扣除公益基金" + Gongyi + "";
                        journal.RemarkEn      = "";
                        journal.InAmount      = Gongyi;
                        journal.OutAmount     = 0;
                        journal.BalanceAmount = userBLL.GetMoney(BD_UserID, "GLmoney");;
                        journal.JournalDate   = DateTime.Now;
                        journal.JournalType   = 7;
                        journal.Journal01     = 0;
                        journalBLL.Add(journal);


                        SqlConnection conn = new SqlConnection(sconn);
                        conn.Open();
                        string sql_Add = "insert into tb_bonus(UserID,TypeID,Amount,Revenue,sf,AddTime,IsSettled,Source,SourceEn,SttleTime,FromUserID,Bonus005,Bonus006)";
                        sql_Add += "values (" + BD_UserID + ",5," + (BD + shouxufei + Gongyi) + "," + shouxufei + "," + BD + ",getdate(),1,'" + journal.Remark + "','',getdate()," + userid + "," + jiangjin + "," + zhongzi + ");";
                        SqlCommand cmd   = new SqlCommand(sql_Add, conn);
                        int        reInt = cmd.ExecuteNonQuery();
                        conn.Close();
                    }
                }
            }
            else
            {
                MySQL(string.Format(" exec proc_Jiandianjiang " + orderModel.UserID + "," + orderModel.OrderTotal + ",2"));
            }
            msg = "支付成功";
            return(true);
        }
예제 #8
0
        protected void lbtnSubmit_Click(object sender, EventArgs e)
        {
            if (this.ddl_secondType.SelectedValue == "0")
            {
                MessageBox.Show(this, "请选择商品类别");
                return;
            }
            if (this.txtGoodsCode.Text.Trim() == "")
            {
                MessageBox.Show(this, "请输入商品编号");
                return;
            }
            if (this.txtGoodsName.Text.Trim() == "")
            {
                MessageBox.Show(this, "请输入商品名称");
                return;
            }

            if (this.txtRealityPrice.Text.Trim() == "")
            {
                MessageBox.Show(this, "请输入库存");
                return;
            }
            if (this.txtPrice.Text.Trim() == "")
            {
                MessageBox.Show(this, "请输入市场价");
                return;
            }
            if (this.txtShopPrice.Text.Trim() == "")
            {
                MessageBox.Show(this, "请输入本站价");
                return;
            }

            try
            {
                decimal lsj   = Convert.ToDecimal(txtPrice.Text);
                decimal lsj2  = Convert.ToDecimal(txtShopPrice.Text);
                decimal kucun = Convert.ToDecimal(txtRealityPrice.Text);
            }
            catch (Exception)
            {
                MessageBox.Show(this, "库存、市场价、积分必须是数字");
                return;
            }

            if (GetPID() == 0)
            {
                if (goodsBLL.GetModel(" GoodsCode='" + this.txtGoodsCode.Text.Trim() + "'") != null)
                {
                    MessageBox.Show(this, "商品编号已存在,请重新输入");
                    return;
                }
                string strUpload = "";
                if (ViewState["urlname1"] != null)
                {
                    strUpload = ViewState["urlname1"].ToString();
                }
                if (strUpload == "")
                {
                    MessageBox.Show(this, "请上传商品图片");
                    return;
                }
                //  upload1 = upload1.Substring(upload1.LastIndexOf("/") + 1, upload1.Length - upload1.LastIndexOf("/") - 1);

                if (this.textPubContext.Text.Trim() == "")
                {
                    MessageBox.Show(this, "请输入商品详情");
                    return;
                }

                lgk.Model.tb_goods model = new lgk.Model.tb_goods();
                model.Goods001     = 1;
                model.Goods002     = 0;//积分
                model.AddTime      = DateTime.Now;
                model.GoodsCode    = txtGoodsCode.Text.Trim();
                model.GoodsName    = txtGoodsName.Text.Trim();
                model.UploadUser   = 0;//上传者ID
                model.City         = txtCity.Text.Trim();
                model.Pic1         = strUpload;
                model.Price        = Convert.ToDecimal(txtPrice.Text.Trim());
                model.ShopPrice    = Convert.ToDecimal(txtShopPrice.Text.Trim());
                model.Pic5         = txtRealityPrice.Text.Trim(); //库存
                model.RealityPrice = 0;                           //--折扣价
                model.Remarks      = textPubContext.Text;
                model.UserCode     = "";

                model.Goods003 = "0";//1:隐藏
                string chkSelect = "";
                for (int i = 0; i < checkList.Items.Count; i++)
                {
                    if (checkList.Items[i].Selected == true)
                    {
                        chkSelect += checkList.Items[i].Value + ",";
                    }
                }
                if (chkSelect != "")
                {
                    chkSelect = chkSelect.Substring(0, chkSelect.Length - 1);
                }
                else
                {
                    chkSelect = "0";
                }
                model.Goods004     = chkSelect;
                model.Goods005     = 0;                                             //折扣
                model.TypeID       = Convert.ToInt32(ddlType.SelectedValue);        //一级分类
                model.GoodsType    = Convert.ToInt32(ddl_secondType.SelectedValue); //二级分类
                model.Goods006     = Convert.ToDecimal(dd_sanType.SelectedValue);   //三级分类
                model.Remarks_en   = "";
                model.GoodsName_en = "";

                if (goodsBLL.Add(model) > 0)
                {
                    MessageBox.ShowAndRedirect(this, "添加成功", "ProductList.aspx");
                }
                else
                {
                    MessageBox.Show(this, "添加失败");
                }
            }
            else
            {
                lgk.Model.tb_goods model   = goodsBLL.GetModel(GetPID());
                string             upload1 = "";
                if (ViewState["urlname1"] != null)
                {
                    upload1 = ViewState["urlname1"].ToString();
                }
                if (upload1 != "")
                {
                    upload1    = upload1.Substring(upload1.LastIndexOf("/") + 1, upload1.Length - upload1.LastIndexOf("/") - 1);
                    model.Pic1 = upload1;
                }
                model.GoodsCode    = txtGoodsCode.Text.Trim();
                model.GoodsName    = txtGoodsName.Text.Trim();
                model.City         = txtCity.Text.Trim();
                model.Price        = Convert.ToDecimal(txtPrice.Text.Trim());
                model.ShopPrice    = Convert.ToDecimal(txtShopPrice.Text.Trim());
                model.Pic5         = txtRealityPrice.Text.Trim();
                model.RealityPrice = 0;
                model.Remarks      = textPubContext.Text;
                model.Goods002     = 0; //积分
                model.Goods005     = 0; //打折
                model.UserCode     = "";

                string chkSelect = "";
                for (int i = 0; i < checkList.Items.Count; i++)
                {
                    if (checkList.Items[i].Selected == true)
                    {
                        chkSelect += checkList.Items[i].Value + ",";
                    }
                }
                if (chkSelect != "")
                {
                    chkSelect = chkSelect.Substring(0, chkSelect.Length - 1);
                }
                else
                {
                    chkSelect = "0";
                }
                model.Goods004 = chkSelect;


                model.TypeID    = Convert.ToInt32(ddlType.SelectedValue);
                model.GoodsType = Convert.ToInt32(ddl_secondType.SelectedValue);
                model.Goods006  = Convert.ToDecimal(dd_sanType.SelectedValue); //三级分类

                model.StateType = 0;                                           //审核
                if (goodsBLL.Update(model))
                {
                    MessageBox.ShowAndRedirect(this, "更新成功", "ProductList.aspx");
                }
                else
                {
                    MessageBox.Show(this, "更新失败");
                }
            }
        }
예제 #9
0
        /// <summary>
        /// 得到一个对象实体,包括一级,二级名称
        /// </summary>
        public lgk.Model.tb_goods GetModelAndName(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select g.*,t.TypeName typename1,p.TypeName typename2");
            strSql.Append(" from tb_goods as g join dbo.tb_produceType as t on t.ID=g.TypeID join tb_produceType as p on p.ID=g.GoodsType AND g.Goods003 <> 1");
            strSql.Append(" where g.ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            lgk.Model.tb_goods model = new lgk.Model.tb_goods();
            DataSet            ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ID"] != null && ds.Tables[0].Rows[0]["ID"].ToString() != "")
                {
                    model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["GoodsCode"] != null && ds.Tables[0].Rows[0]["GoodsCode"].ToString() != "")
                {
                    model.GoodsCode = ds.Tables[0].Rows[0]["GoodsCode"].ToString();
                }
                if (ds.Tables[0].Rows[0]["GoodsName"] != null && ds.Tables[0].Rows[0]["GoodsName"].ToString() != "")
                {
                    model.GoodsName = ds.Tables[0].Rows[0]["GoodsName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["GoodsName_en"] != null && ds.Tables[0].Rows[0]["GoodsName_en"].ToString() != "")
                {
                    model.GoodsName_en = ds.Tables[0].Rows[0]["GoodsName_en"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Price"] != null && ds.Tables[0].Rows[0]["Price"].ToString() != "")
                {
                    model.Price = decimal.Parse(ds.Tables[0].Rows[0]["Price"].ToString());
                }
                if (ds.Tables[0].Rows[0]["RealityPrice"] != null && ds.Tables[0].Rows[0]["RealityPrice"].ToString() != "")
                {
                    model.RealityPrice = decimal.Parse(ds.Tables[0].Rows[0]["RealityPrice"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Standard"] != null && ds.Tables[0].Rows[0]["Standard"].ToString() != "")
                {
                    model.Standard = ds.Tables[0].Rows[0]["Standard"].ToString();
                }
                if (ds.Tables[0].Rows[0]["IsHave"] != null && ds.Tables[0].Rows[0]["IsHave"].ToString() != "")
                {
                    model.IsHave = int.Parse(ds.Tables[0].Rows[0]["IsHave"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TypeID"] != null && ds.Tables[0].Rows[0]["TypeID"].ToString() != "")
                {
                    model.TypeID = int.Parse(ds.Tables[0].Rows[0]["TypeID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["GoodsType"] != null && ds.Tables[0].Rows[0]["GoodsType"].ToString() != "")
                {
                    model.GoodsType = int.Parse(ds.Tables[0].Rows[0]["GoodsType"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Pic1"] != null && ds.Tables[0].Rows[0]["Pic1"].ToString() != "")
                {
                    model.Pic1 = ds.Tables[0].Rows[0]["Pic1"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Pic2"] != null && ds.Tables[0].Rows[0]["Pic2"].ToString() != "")
                {
                    model.Pic2 = ds.Tables[0].Rows[0]["Pic2"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Pic3"] != null && ds.Tables[0].Rows[0]["Pic3"].ToString() != "")
                {
                    model.Pic3 = ds.Tables[0].Rows[0]["Pic3"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Pic4"] != null && ds.Tables[0].Rows[0]["Pic4"].ToString() != "")
                {
                    model.Pic4 = ds.Tables[0].Rows[0]["Pic4"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Pic5"] != null && ds.Tables[0].Rows[0]["Pic5"].ToString() != "")
                {
                    model.Pic5 = ds.Tables[0].Rows[0]["Pic5"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Summary"] != null && ds.Tables[0].Rows[0]["Summary"].ToString() != "")
                {
                    model.Summary = ds.Tables[0].Rows[0]["Summary"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Remarks"] != null && ds.Tables[0].Rows[0]["Remarks"].ToString() != "")
                {
                    model.Remarks = ds.Tables[0].Rows[0]["Remarks"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Remarks_en"] != null && ds.Tables[0].Rows[0]["Remarks_en"].ToString() != "")
                {
                    model.Remarks_en = ds.Tables[0].Rows[0]["Remarks_en"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AddTime"] != null && ds.Tables[0].Rows[0]["AddTime"].ToString() != "")
                {
                    model.AddTime = DateTime.Parse(ds.Tables[0].Rows[0]["AddTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Goods001"] != null && ds.Tables[0].Rows[0]["Goods001"].ToString() != "")
                {
                    model.Goods001 = int.Parse(ds.Tables[0].Rows[0]["Goods001"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Goods002"] != null && ds.Tables[0].Rows[0]["Goods002"].ToString() != "")
                {
                    model.Goods002 = int.Parse(ds.Tables[0].Rows[0]["Goods002"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Goods003"] != null && ds.Tables[0].Rows[0]["Goods003"].ToString() != "")
                {
                    model.Goods003 = ds.Tables[0].Rows[0]["Goods003"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Goods004"] != null && ds.Tables[0].Rows[0]["Goods004"].ToString() != "")
                {
                    model.Goods004 = ds.Tables[0].Rows[0]["Goods004"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Goods005"] != null && ds.Tables[0].Rows[0]["Goods005"].ToString() != "")
                {
                    model.Goods005 = decimal.Parse(ds.Tables[0].Rows[0]["Goods005"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Goods006"] != null && ds.Tables[0].Rows[0]["Goods006"].ToString() != "")
                {
                    model.Goods006 = decimal.Parse(ds.Tables[0].Rows[0]["Goods006"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Goods007"] != null && ds.Tables[0].Rows[0]["Goods007"].ToString() != "")
                {
                    model.Goods007 = DateTime.Parse(ds.Tables[0].Rows[0]["Goods007"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Goods008"] != null && ds.Tables[0].Rows[0]["Goods008"].ToString() != "")
                {
                    model.Goods008 = DateTime.Parse(ds.Tables[0].Rows[0]["Goods008"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
예제 #10
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(lgk.Model.tb_goods model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_goods(");
            strSql.Append("GoodsCode,GoodsName,GoodsName_en,Price,RealityPrice,Standard,IsHave,TypeID,GoodsType,Pic1,Pic2,Pic3,Pic4,Pic5,Summary,Remarks,Remarks_en,AddTime,Goods001,Goods002,Goods003,Goods004,Goods005,Goods006,Goods007,Goods008)");
            strSql.Append(" values (");
            strSql.Append("@GoodsCode,@GoodsName,@GoodsName_en,@Price,@RealityPrice,@Standard,@IsHave,@TypeID,@GoodsType,@Pic1,@Pic2,@Pic3,@Pic4,@Pic5,@Summary,@Remarks,@Remarks_en,@AddTime,@Goods001,@Goods002,@Goods003,@Goods004,@Goods005,@Goods006,@Goods007,@Goods008)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@GoodsCode",    SqlDbType.VarChar,   100),
                new SqlParameter("@GoodsName",    SqlDbType.VarChar,   100),
                new SqlParameter("@Price",        SqlDbType.Decimal,     9),
                new SqlParameter("@RealityPrice", SqlDbType.Decimal,     9),
                new SqlParameter("@Standard",     SqlDbType.VarChar,   100),
                new SqlParameter("@IsHave",       SqlDbType.Int,         4),
                new SqlParameter("@TypeID",       SqlDbType.Int,         4),
                new SqlParameter("@GoodsType",    SqlDbType.Int,         4),
                new SqlParameter("@Pic1",         SqlDbType.VarChar,   100),
                new SqlParameter("@Pic2",         SqlDbType.VarChar,   100),
                new SqlParameter("@Pic3",         SqlDbType.VarChar,   100),
                new SqlParameter("@Pic4",         SqlDbType.VarChar,   100),
                new SqlParameter("@Pic5",         SqlDbType.VarChar,   100),
                new SqlParameter("@Summary",      SqlDbType.VarChar),
                new SqlParameter("@Remarks",      SqlDbType.Text),
                new SqlParameter("@AddTime",      SqlDbType.DateTime),
                new SqlParameter("@Goods001",     SqlDbType.Int,         4),
                new SqlParameter("@Goods002",     SqlDbType.Int,         4),
                new SqlParameter("@Goods003",     SqlDbType.VarChar,   100),
                new SqlParameter("@Goods004",     SqlDbType.VarChar,   100),
                new SqlParameter("@Goods005",     SqlDbType.Decimal,     9),
                new SqlParameter("@Goods006",     SqlDbType.Decimal,     9),
                new SqlParameter("@Goods007",     SqlDbType.DateTime),
                new SqlParameter("@Goods008",     SqlDbType.DateTime),
                new SqlParameter("@GoodsName_en", SqlDbType.VarChar,   100),
                new SqlParameter("@Remarks_en",   SqlDbType.Text)
            };
            parameters[0].Value  = model.GoodsCode;
            parameters[1].Value  = model.GoodsName;
            parameters[2].Value  = model.Price;
            parameters[3].Value  = model.RealityPrice;
            parameters[4].Value  = model.Standard;
            parameters[5].Value  = model.IsHave;
            parameters[6].Value  = model.TypeID;
            parameters[7].Value  = model.GoodsType;
            parameters[8].Value  = model.Pic1;
            parameters[9].Value  = model.Pic2;
            parameters[10].Value = model.Pic3;
            parameters[11].Value = model.Pic4;
            parameters[12].Value = model.Pic5;
            parameters[13].Value = model.Summary;
            parameters[14].Value = model.Remarks;
            parameters[15].Value = model.AddTime;
            parameters[16].Value = model.Goods001;
            parameters[17].Value = model.Goods002;
            parameters[18].Value = model.Goods003;
            parameters[19].Value = model.Goods004;
            parameters[20].Value = model.Goods005;
            parameters[21].Value = model.Goods006;
            parameters[22].Value = model.Goods007;
            parameters[23].Value = model.Goods008;
            parameters[24].Value = model.GoodsName_en;
            parameters[25].Value = model.Remarks_en;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
예제 #11
0
        public lgk.Model.tb_goods GetModel(string where)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,GoodsCode,GoodsName,GoodsName_en,Price,RealityPrice,Standard,IsHave,TypeID,GoodsType,Pic1,Pic2,Pic3,Pic4,Pic5,Summary,Remarks,Remarks_en,AddTime,Goods001,Goods002,Goods003,Goods004,Goods005,Goods006,Goods007,Goods008 from tb_goods ");
            strSql.Append(" where " + where);

            lgk.Model.tb_goods model = new lgk.Model.tb_goods();
            DataSet            ds    = DbHelperSQL.Query(strSql.ToString(), null);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ID"] != null && ds.Tables[0].Rows[0]["ID"].ToString() != "")
                {
                    model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["GoodsCode"] != null && ds.Tables[0].Rows[0]["GoodsCode"].ToString() != "")
                {
                    model.GoodsCode = ds.Tables[0].Rows[0]["GoodsCode"].ToString();
                }
                if (ds.Tables[0].Rows[0]["GoodsName"] != null && ds.Tables[0].Rows[0]["GoodsName"].ToString() != "")
                {
                    model.GoodsName = ds.Tables[0].Rows[0]["GoodsName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["GoodsName_en"] != null && ds.Tables[0].Rows[0]["GoodsName_en"].ToString() != "")
                {
                    model.GoodsName_en = ds.Tables[0].Rows[0]["GoodsName_en"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Price"] != null && ds.Tables[0].Rows[0]["Price"].ToString() != "")
                {
                    model.Price = decimal.Parse(ds.Tables[0].Rows[0]["Price"].ToString());
                }
                if (ds.Tables[0].Rows[0]["RealityPrice"] != null && ds.Tables[0].Rows[0]["RealityPrice"].ToString() != "")
                {
                    model.RealityPrice = decimal.Parse(ds.Tables[0].Rows[0]["RealityPrice"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Standard"] != null && ds.Tables[0].Rows[0]["Standard"].ToString() != "")
                {
                    model.Standard = ds.Tables[0].Rows[0]["Standard"].ToString();
                }
                if (ds.Tables[0].Rows[0]["IsHave"] != null && ds.Tables[0].Rows[0]["IsHave"].ToString() != "")
                {
                    model.IsHave = int.Parse(ds.Tables[0].Rows[0]["IsHave"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TypeID"] != null && ds.Tables[0].Rows[0]["TypeID"].ToString() != "")
                {
                    model.TypeID = int.Parse(ds.Tables[0].Rows[0]["TypeID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["GoodsType"] != null && ds.Tables[0].Rows[0]["GoodsType"].ToString() != "")
                {
                    model.GoodsType = int.Parse(ds.Tables[0].Rows[0]["GoodsType"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Pic1"] != null && ds.Tables[0].Rows[0]["Pic1"].ToString() != "")
                {
                    model.Pic1 = ds.Tables[0].Rows[0]["Pic1"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Pic2"] != null && ds.Tables[0].Rows[0]["Pic2"].ToString() != "")
                {
                    model.Pic2 = ds.Tables[0].Rows[0]["Pic2"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Pic3"] != null && ds.Tables[0].Rows[0]["Pic3"].ToString() != "")
                {
                    model.Pic3 = ds.Tables[0].Rows[0]["Pic3"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Pic4"] != null && ds.Tables[0].Rows[0]["Pic4"].ToString() != "")
                {
                    model.Pic4 = ds.Tables[0].Rows[0]["Pic4"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Pic5"] != null && ds.Tables[0].Rows[0]["Pic5"].ToString() != "")
                {
                    model.Pic5 = ds.Tables[0].Rows[0]["Pic5"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Summary"] != null && ds.Tables[0].Rows[0]["Summary"].ToString() != "")
                {
                    model.Summary = ds.Tables[0].Rows[0]["Summary"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Remarks"] != null && ds.Tables[0].Rows[0]["Remarks"].ToString() != "")
                {
                    model.Remarks = ds.Tables[0].Rows[0]["Remarks"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Remarks_en"] != null && ds.Tables[0].Rows[0]["Remarks_en"].ToString() != "")
                {
                    model.Remarks_en = ds.Tables[0].Rows[0]["Remarks_en"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AddTime"] != null && ds.Tables[0].Rows[0]["AddTime"].ToString() != "")
                {
                    model.AddTime = DateTime.Parse(ds.Tables[0].Rows[0]["AddTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Goods001"] != null && ds.Tables[0].Rows[0]["Goods001"].ToString() != "")
                {
                    model.Goods001 = int.Parse(ds.Tables[0].Rows[0]["Goods001"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Goods002"] != null && ds.Tables[0].Rows[0]["Goods002"].ToString() != "")
                {
                    model.Goods002 = int.Parse(ds.Tables[0].Rows[0]["Goods002"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Goods003"] != null && ds.Tables[0].Rows[0]["Goods003"].ToString() != "")
                {
                    model.Goods003 = ds.Tables[0].Rows[0]["Goods003"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Goods004"] != null && ds.Tables[0].Rows[0]["Goods004"].ToString() != "")
                {
                    model.Goods004 = ds.Tables[0].Rows[0]["Goods004"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Goods005"] != null && ds.Tables[0].Rows[0]["Goods005"].ToString() != "")
                {
                    model.Goods005 = decimal.Parse(ds.Tables[0].Rows[0]["Goods005"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Goods006"] != null && ds.Tables[0].Rows[0]["Goods006"].ToString() != "")
                {
                    model.Goods006 = decimal.Parse(ds.Tables[0].Rows[0]["Goods006"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Goods007"] != null && ds.Tables[0].Rows[0]["Goods007"].ToString() != "")
                {
                    model.Goods007 = DateTime.Parse(ds.Tables[0].Rows[0]["Goods007"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Goods008"] != null && ds.Tables[0].Rows[0]["Goods008"].ToString() != "")
                {
                    model.Goods008 = DateTime.Parse(ds.Tables[0].Rows[0]["Goods008"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
예제 #12
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(lgk.Model.tb_goods model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_goods set ");
            strSql.Append("GoodsCode=@GoodsCode,");
            strSql.Append("GoodsName=@GoodsName,");
            strSql.Append("GoodsName_en=@GoodsName_en,");
            strSql.Append("Price=@Price,");
            strSql.Append("RealityPrice=@RealityPrice,");
            strSql.Append("Standard=@Standard,");
            strSql.Append("IsHave=@IsHave,");
            strSql.Append("TypeID=@TypeID,");
            strSql.Append("GoodsType=@GoodsType,");
            strSql.Append("Pic1=@Pic1,");
            strSql.Append("Pic2=@Pic2,");
            strSql.Append("Pic3=@Pic3,");
            strSql.Append("Pic4=@Pic4,");
            strSql.Append("Pic5=@Pic5,");
            strSql.Append("Summary=@Summary,");
            strSql.Append("Remarks=@Remarks,");
            strSql.Append("Remarks_en=@Remarks_en,");
            strSql.Append("AddTime=@AddTime,");
            strSql.Append("Goods001=@Goods001,");
            strSql.Append("Goods002=@Goods002,");
            strSql.Append("Goods003=@Goods003,");
            strSql.Append("Goods004=@Goods004,");
            strSql.Append("Goods005=@Goods005,");
            strSql.Append("Goods006=@Goods006,");
            strSql.Append("Goods007=@Goods007,");
            strSql.Append("Goods008=@Goods008,");
            strSql.Append("StateType=@StateType");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@GoodsCode",    SqlDbType.VarChar,   100),
                new SqlParameter("@GoodsName",    SqlDbType.VarChar,   100),
                new SqlParameter("@Price",        SqlDbType.Decimal,     9),
                new SqlParameter("@RealityPrice", SqlDbType.Decimal,     9),
                new SqlParameter("@Standard",     SqlDbType.VarChar,   100),
                new SqlParameter("@IsHave",       SqlDbType.Int,         4),
                new SqlParameter("@TypeID",       SqlDbType.Int,         4),
                new SqlParameter("@GoodsType",    SqlDbType.Int,         4),
                new SqlParameter("@Pic1",         SqlDbType.VarChar,   100),
                new SqlParameter("@Pic2",         SqlDbType.VarChar,   100),
                new SqlParameter("@Pic3",         SqlDbType.VarChar,   100),
                new SqlParameter("@Pic4",         SqlDbType.VarChar,   100),
                new SqlParameter("@Pic5",         SqlDbType.VarChar,   100),
                new SqlParameter("@Summary",      SqlDbType.VarChar),
                new SqlParameter("@Remarks",      SqlDbType.Text),
                new SqlParameter("@AddTime",      SqlDbType.DateTime),
                new SqlParameter("@Goods001",     SqlDbType.Int,         4),
                new SqlParameter("@Goods002",     SqlDbType.Int,         4),
                new SqlParameter("@Goods003",     SqlDbType.VarChar,   100),
                new SqlParameter("@Goods004",     SqlDbType.VarChar,   100),
                new SqlParameter("@Goods005",     SqlDbType.Decimal,     9),
                new SqlParameter("@Goods006",     SqlDbType.Decimal,     9),
                new SqlParameter("@Goods007",     SqlDbType.DateTime),
                new SqlParameter("@Goods008",     SqlDbType.DateTime),
                new SqlParameter("@StateType",    SqlDbType.Int,         4),
                new SqlParameter("@ID",           SqlDbType.Int,         4),
                new SqlParameter("@GoodsName_en", SqlDbType.VarChar,   100),
                new SqlParameter("@Remarks_en",   SqlDbType.Text)
            };
            parameters[0].Value  = model.GoodsCode;
            parameters[1].Value  = model.GoodsName;
            parameters[2].Value  = model.Price;
            parameters[3].Value  = model.RealityPrice;
            parameters[4].Value  = model.Standard;
            parameters[5].Value  = model.IsHave;
            parameters[6].Value  = model.TypeID;
            parameters[7].Value  = model.GoodsType;
            parameters[8].Value  = model.Pic1;
            parameters[9].Value  = model.Pic2;
            parameters[10].Value = model.Pic3;
            parameters[11].Value = model.Pic4;
            parameters[12].Value = model.Pic5;
            parameters[13].Value = model.Summary;
            parameters[14].Value = model.Remarks;
            parameters[15].Value = model.AddTime;
            parameters[16].Value = model.Goods001;
            parameters[17].Value = model.Goods002;
            parameters[18].Value = model.Goods003;
            parameters[19].Value = model.Goods004;
            parameters[20].Value = model.Goods005;
            parameters[21].Value = model.Goods006;
            parameters[22].Value = model.Goods007;
            parameters[23].Value = model.Goods008;
            parameters[24].Value = model.StateType;
            parameters[25].Value = model.ID;
            parameters[26].Value = model.GoodsName_en;
            parameters[27].Value = model.Remarks_en;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #13
0
        public bool GoodsCartPay(long userid, int paytype, long addrid, string strcid, int shtype, out string msg)
        {
            if (paytype != 4)
            {
                msg = "请选择正确的支付方式";
                return(false);
            }
            if (shtype <= 0)
            {
                msg = "请选择正确的收货方式";
                return(false);
            }
            if (!userBLL.Exists(userid))
            {
                msg = "请重新登录再支付";
                return(false);
            }
            JavaScriptSerializer js = new JavaScriptSerializer();

            var list = js.Deserialize <List <GetGoods> >(strcid);

            LogHelper.SaveLog(strcid, "GoodsCartPay");

            if (list.Count <= 0)
            {
                msg = "请选择购物车中的商品";
                return(false);
            }

            Random   rand       = new Random();
            string   orderCode  = DateTime.Now.ToString("yyyyMMddhhmmss") + rand.Next(10000, 99999); //订单编号
            string   goodsname  = string.Format("订单号{0},", orderCode);
            decimal  totalMoney = 0;
            int      orderSum   = 0;
            int      insert     = 0;
            DateTime dtime      = DateTime.Now;


            if (!userBLL.Exists(userid))
            {
                msg = "用户不存在";
            }

            //if (addrid!=1)
            //{

            //    lgk.Model.tb_Address addrModel = addressBLL.GetModel(addrid);
            //    if(addrModel == null)
            //    {
            //        msg = "请选择收货地址";
            //        return false;
            //    }
            //}
            IList <lgk.Model.tb_goodsCar> listCar = new List <lgk.Model.tb_goodsCar>();

            #region 验证商品
            string errmsg = "";
            foreach (GetGoods g in list)
            {
                lgk.Model.tb_goodsCar carModel = goodsCarBLL.GetModel(g.ID);
                if (carModel != null)
                {
                    lgk.Model.tb_goods goodsModel = goodsBLL.GetModelAndOneName(carModel.GoodsID);//根据发布商品编号找到充值账号密码
                    if (goodsModel == null)
                    {
                        errmsg = "商品" + goodsModel.GoodsName + "不存在!";
                        insert = 0;
                        break;
                    }
                    if (g.num <= 0)
                    {
                        errmsg = "商品" + goodsModel.GoodsName + "的购买数量必须大于0!";
                        insert = 0;
                        break;
                    }
                    if (goodsModel.StateType == 0) //判断是否 审核通过 0未审核
                    {
                        errmsg = "商品" + goodsModel.GoodsName + "审核未通过,请删除该商品!";
                        insert = 0;
                        break;
                    }
                    else if (goodsModel.Goods003 == "1") //判断是否 删除 1已经删除
                    {
                        errmsg = "商品" + goodsModel.GoodsName + "已被删除,请删除该商品!";
                        insert = 0;
                        break;
                    }
                    else if (goodsModel.Goods001 == 0) //判断是否 0下架
                    {
                        errmsg = "商品" + goodsModel.GoodsName + "已经下架,请删除该商品!";
                        insert = 0;
                        break;
                    }
                    else if (goodsModel.Goods002 < g.num) //判断库存量
                    {
                        errmsg = "商品" + goodsModel.GoodsName + "库存不足,请重新修改数量!";
                        insert = 0;
                        break;
                    }
                    else if (carModel.BuyUser != userid) //
                    {
                        errmsg = "用户不匹配,请刷新购物车再提交!";
                        insert = 0;
                        break;
                    }
                    carModel.Goods006 = g.num;//以最中传输的数量为准
                    listCar.Add(carModel);
                    insert += 1;
                }
                else
                {
                    msg = "购物出为空";
                    LogHelper.SaveLog(g.ID.ToString() + "," + errmsg, "GoodsCartPay");
                    return(false);
                }
            }

            if (insert == 0)
            {
                msg = errmsg;
                return(false);
            }
            #endregion

            //总金额
            totalMoney += listCar.Sum(s => s.TotalMoney);
            orderSum   += listCar.Sum(s => s.Goods006);
            lgk.Model.tb_user userModel = userBLL.GetModel(userid);
            //var dt = orderBLL.GetList(" UserID=" + userid ).Tables[0];
            //if (pay == 1 && dt.Rows.Count>0)
            //{

            //}  sss
            //else if (pay == 2 && dt.Rows.Count == 0)
            //{

            //}

            if (paytype == 4 && userModel.GLmoney < totalMoney)
            {
                msg = "购物分余额不足";
                return(false);
            }


            #region 订单处理
            //总订单
            lgk.Model.tb_Order orderModel = new lgk.Model.tb_Order(); //订单
            orderModel.UserID      = userid;                          //用户
            orderModel.OrderCode   = orderCode;                       //订单编号
            orderModel.OrderSum    = orderSum;                        //订单数--
            orderModel.OrderTotal  = totalMoney;                      //购买总金
            orderModel.PVTotal     = 0;                               //
            orderModel.OrderDate   = dtime;
            orderModel.IsSend      = 1;
            orderModel.PayMethod   = 3;                  //--2、复投 1注册激活,3购物分
            orderModel.Order5      = "";                 //备用电话
            orderModel.UserAddr    = userModel.Address;  //addrModel.Address;//发货地址
            orderModel.Order6      = userModel.PhoneNum; //addrModel.PhoneNum;//收货电话
            orderModel.Order7      = userModel.NiceName; //addrModel.MemberName;//收货姓名
            orderModel.OrderType   = paytype;            //购物分
            orderModel.ReceiveType = shtype;
            long iOrderID = orderBLL.Add(orderModel);    //加入订单表

            foreach (var carModel in listCar)
            {
                lgk.Model.tb_goods goodsModel = goodsBLL.GetModelAndOneName(carModel.GoodsID);//根据发布商品编号找到充值账号密码
                //插入订单详细表
                lgk.Model.tb_OrderDetail orderDetailModel = new lgk.Model.tb_OrderDetail();
                orderDetailModel.OrderCode   = orderCode;
                orderDetailModel.Price       = carModel.RealityPrice;                     //单价--
                orderDetailModel.OrderSum    = carModel.Goods006;                         //数量--
                orderDetailModel.OrderTotal  = carModel.Goods006 * carModel.RealityPrice; //订单金额
                orderDetailModel.PV          = 0;                                         //
                orderDetailModel.PVTotal     = 0;
                orderDetailModel.ProcudeID   = carModel.GoodsID;                          //产品编号--
                orderDetailModel.ProcudeName = carModel.GoodsName;                        //名称--
                orderDetailModel.gColor      = carModel.gColor;
                orderDetailModel.gSize       = carModel.gSize;
                orderDetailModel.OrderDate   = dtime; //
                orderDetailBLL.Add(orderDetailModel); //加入订单详情

                //修改库存
                goodsModel.Goods002 = goodsModel.Goods002 - carModel.Goods006;//修改库存
                goodsModel.SaleNum += carModel.Goods006;
                goodsBLL.Update(goodsModel);

                //从购物篮减掉
                goodsCarBLL.Delete(carModel.ID);

                //商品名称 流水表记录用
                goodsname += orderDetailModel.ProcudeName + "|";

                orderSum += carModel.Goods006;
            }
            #endregion

            #region 写入到明细表

            lgk.Model.tb_journal joModel = new lgk.Model.tb_journal();
            joModel.UserID      = userModel.UserID;
            joModel.Remark      = goodsname;                            //名称--;
            joModel.InAmount    = 0;                                    //收入0;
            joModel.OutAmount   = totalMoney;                           //购买价(支出金币)
            joModel.JournalDate = DateTime.Now;
            joModel.Journal01   = userModel.UserID;                     //
            joModel.Journal02   = 99;                                   //消费
            joModel.Journal03   = orderCode;                            //订单编号
            if (paytype == 4)                                           //购物分
            {
                joModel.JournalType   = 5;                              //币种
                joModel.BalanceAmount = userModel.GLmoney - totalMoney; //余额
                journalBLL.Add(joModel);
                UpdateAccount("GLmoney", userModel.UserID, totalMoney, 0);
            }

            //用户账户更新

            #endregion

            //购物积分购买不给分红点
            //执行存储过程
            //string procmsg = string.Empty;
            //procmsg = proc_BuyOrder(userid, orderModel.OrderSum, orderCode, 4, totalMoney);
            //LogHelper.SaveLog("procmsg:" + procmsg, "proc_BuyOrder");

            msg = "支付成功";
            return(true);
        }
예제 #14
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public lgk.Model.tb_goods DataRowToModel(DataRow row)
 {
     lgk.Model.tb_goods model = new lgk.Model.tb_goods();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = long.Parse(row["ID"].ToString());
         }
         if (row["GoodsCode"] != null)
         {
             model.GoodsCode = row["GoodsCode"].ToString();
         }
         if (row["GoodsName"] != null)
         {
             model.GoodsName = row["GoodsName"].ToString();
         }
         if (row["Price"] != null && row["Price"].ToString() != "")
         {
             model.Price = decimal.Parse(row["Price"].ToString());
         }
         if (row["RealityPrice"] != null && row["RealityPrice"].ToString() != "")
         {
             model.RealityPrice = decimal.Parse(row["RealityPrice"].ToString());
         }
         if (row["Standard"] != null)
         {
             model.Standard = row["Standard"].ToString();
         }
         if (row["IsHave"] != null && row["IsHave"].ToString() != "")
         {
             model.IsHave = int.Parse(row["IsHave"].ToString());
         }
         if (row["TypeID"] != null && row["TypeID"].ToString() != "")
         {
             model.TypeID = int.Parse(row["TypeID"].ToString());
         }
         if (row["GoodsType"] != null && row["GoodsType"].ToString() != "")
         {
             model.GoodsType = int.Parse(row["GoodsType"].ToString());
         }
         if (row["Pic1"] != null)
         {
             model.Pic1 = row["Pic1"].ToString();
         }
         if (row["Pic2"] != null)
         {
             model.Pic2 = row["Pic2"].ToString();
         }
         if (row["Pic3"] != null)
         {
             model.Pic3 = row["Pic3"].ToString();
         }
         if (row["Pic4"] != null)
         {
             model.Pic4 = row["Pic4"].ToString();
         }
         if (row["Pic5"] != null)
         {
             model.Pic5 = row["Pic5"].ToString();
         }
         if (row["Summary"] != null)
         {
             model.Summary = row["Summary"].ToString();
         }
         if (row["Remarks"] != null)
         {
             model.Remarks = row["Remarks"].ToString();
         }
         if (row["AddTime"] != null && row["AddTime"].ToString() != "")
         {
             model.AddTime = DateTime.Parse(row["AddTime"].ToString());
         }
         if (row["Goods001"] != null && row["Goods001"].ToString() != "")
         {
             model.Goods001 = int.Parse(row["Goods001"].ToString());
         }
         if (row["Goods002"] != null && row["Goods002"].ToString() != "")
         {
             model.Goods002 = int.Parse(row["Goods002"].ToString());
         }
         if (row["Goods003"] != null)
         {
             model.Goods003 = row["Goods003"].ToString();
         }
         if (row["Goods004"] != null)
         {
             model.Goods004 = row["Goods004"].ToString();
         }
         if (row["Goods005"] != null && row["Goods005"].ToString() != "")
         {
             model.Goods005 = decimal.Parse(row["Goods005"].ToString());
         }
         if (row["Goods006"] != null && row["Goods006"].ToString() != "")
         {
             model.Goods006 = decimal.Parse(row["Goods006"].ToString());
         }
         if (row["Goods007"] != null && row["Goods007"].ToString() != "")
         {
             model.Goods007 = DateTime.Parse(row["Goods007"].ToString());
         }
         if (row["Goods008"] != null && row["Goods008"].ToString() != "")
         {
             model.Goods008 = DateTime.Parse(row["Goods008"].ToString());
         }
         if (row["GoodsName_en"] != null)
         {
             model.GoodsName_en = row["GoodsName_en"].ToString();
         }
         if (row["Remarks_en"] != null)
         {
             model.Remarks_en = row["Remarks_en"].ToString();
         }
         if (row["StateType"] != null && row["StateType"].ToString() != "")
         {
             model.StateType = int.Parse(row["StateType"].ToString());
         }
         if (row["City"] != null)
         {
             model.City = row["City"].ToString();
         }
         if (row["ShopPrice"] != null && row["ShopPrice"].ToString() != "")
         {
             model.ShopPrice = decimal.Parse(row["ShopPrice"].ToString());
         }
         if (row["Inventory"] != null && row["Inventory"].ToString() != "")
         {
             model.Inventory = int.Parse(row["Inventory"].ToString());
         }
         if (row["SaleNum"] != null && row["SaleNum"].ToString() != "")
         {
             model.SaleNum = int.Parse(row["SaleNum"].ToString());
         }
     }
     return(model);
 }