Exemple #1
0
        private void Get_ParameterList(string strSql)
        {
            string strStartTime = this.txtStartTime.Value;
            string strEntTime   = this.txtEndTime.Value;

            if (strStartTime != "")
            {
                strSql = strSql + " and  OrderCreateTime>='" + strStartTime + "'";
            }
            if (strEntTime != "")
            {
                strSql = strSql + " and OrderCreateTime<'" + PubFunction.TimeEndDay(strEntTime) + "'";
            }
            strSql += " AND  OrderLog.OrderType != 4 AND OrderLog.OrderType != 5 ";
            Chain.BLL.Goods bllGoods = new Chain.BLL.Goods();
            int             Counts   = this.NetPagerParameter.RecordCount;

            strSql = PubFunction.GetShopAuthority(this._UserShopID, "OrderLog.OrderShopID", strSql);
            DataTable dt = bllGoods.GetGoodsExpense(this.NetPagerParameter.PageSize, this.NetPagerParameter.CurrentPageIndex, out Counts, new string[]
            {
                strSql
            }).Tables[0];

            this.NetPagerParameter.RecordCount    = Counts;
            this.NetPagerParameter.CustomInfoHTML = string.Format("<div class=\"results\"><span>当前第{0}/{1}页 共{2}条记录 每页{3}条</span></div>", new object[]
            {
                this.NetPagerParameter.CurrentPageIndex,
                this.NetPagerParameter.PageCount,
                this.NetPagerParameter.RecordCount,
                this.NetPagerParameter.PageSize
            });
            this.rptGoods.DataSource = dt;
            this.rptGoods.DataBind();
            PageBase.BindSerialRepeater(this.rptGoods, this.NetPagerParameter.PageSize * (this.NetPagerParameter.CurrentPageIndex - 1));
        }
Exemple #2
0
        private void GetSysRemind()
        {
            int count = 5;

            Chain.BLL.Mem bllMem     = new Chain.BLL.Mem();
            DataTable     dtBirhtday = bllMem.GetBirthdayList(0, this.shopID, count).Tables[0];

            this.gvMemBirthday.DataSource = dtBirhtday;
            this.gvMemBirthday.DataBind();
            StartPage.RepeaterBindSerial(this.gvMemBirthday, 0);
            DataTable dtMemPastTime = bllMem.GetMemPastTime(" and DATEDIFF(day,getdate(),MemPastTime) = 0 ", this.shopID, count).Tables[0];

            this.gvMemPastTime.DataSource = dtMemPastTime;
            this.gvMemPastTime.DataBind();
            StartPage.RepeaterBindSerial(this.gvMemPastTime, 0);
            DataTable dtMemPointRest = bllMem.GetMemPointReset(string.Format("MemPoint>0 and DATEDIFF(day,isnull(MemConsumeLastTime,MemCreateTime),getdate()) >= '{0}' and MemShopID = '{1}' ", PubFunction.curParameter.intPointPeriod, this.shopID), 0, count).Tables[0];

            this.gvdMemPontReset.DataSource = dtMemPointRest;
            this.gvdMemPontReset.DataBind();
            StartPage.RepeaterBindSerial(this.gvdMemPontReset, 0);
            DataTable dtGoods = new Chain.BLL.Goods().GetStockRemind(string.Format("Number < = '{0}' and GoodsType = '0' and ShopID = '{1}'", PubFunction.curParameter.intStockCount, this.shopID), count).Tables[0];

            this.gvGoods.DataSource = dtGoods;
            this.gvGoods.DataBind();
            StartPage.RepeaterBindSerial(this.gvGoods, 0);
            DataTable dtCustomRemind = new Chain.BLL.SysCustomRemind().GetList("CustomReminder like '%" + PubFunction.UserIDTOName(this.userid) + "%' and DATEDIFF(day,CustomRemindTime,getdate())<=0 ", count).Tables[0];

            this.gvCustomRemind.DataSource = dtCustomRemind;
            this.gvCustomRemind.DataBind();
            StartPage.RepeaterBindSerial(this.gvCustomRemind, 0);
        }
Exemple #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         this.txtCode.Value = DateTime.Now.ToString("yyMMddHHmmss");
         PubFunction.BindGoodsClass(this.sltGoodsClass, this._UserShopID);
         this.sltGoodsClass.Value = "1";
         if (!string.IsNullOrEmpty(this.curParameter.strUnitList))
         {
             string[] strdwlist = this.curParameter.strUnitList.Split(new char[]
             {
                 '|'
             });
             string[] array = strdwlist;
             for (int i = 0; i < array.Length; i++)
             {
                 string strdw = array[i];
                 this.sltjldw.Items.Add(new ListItem(strdw, strdw));
             }
         }
         else
         {
             this.sltjldw.Items.Add(new ListItem("个", "个"));
         }
         if (base.Request.QueryString["GoodsID"] != null)
         {
             this.GetGoodsInfo(int.Parse(base.Request.QueryString["GoodsID"]));
             this.GetGoodsNumber(int.Parse(base.Request.QueryString["GoodsID"]), int.Parse(base.Request.QueryString["ShopID"]));
             this.ltlTitle.Text = "主页   >   商品管理   >   编辑商品 ";
         }
         else
         {
             PubFunction.BindAddCustomFields(this.tbCustomField, "goods");
         }
         if (base.Request.QueryString["GoodsID"] != null)
         {
             Chain.Model.Goods goods = new Chain.BLL.Goods().GetModel(int.Parse(base.Request.QueryString["GoodsID"]));
             PubFunction.BindShopSelect(this._UserShopID, this.sltShopList, goods.CreateShopID, true);
             this.txtShopID.Value = goods.CreateShopID.ToString();
         }
         else
         {
             PubFunction.BindShopSelect(this._UserShopID, this.sltShopList, this._UserShopID, true);
             this.txtShopID.Value = this._UserShopID.ToString();
             this.hdShopID.Value  = this._UserShopID.ToString();
         }
         this.bindSyncShopList();
         if (PubFunction.curParameter.bolStaff)
         {
             this.trCommission.Attributes.Add("style", "");
         }
         else
         {
             this.trCommission.Attributes.Add("style", "display:none");
         }
     }
 }
Exemple #4
0
        private void GetGoodsList(string strSql)
        {
            Chain.BLL.Goods bllGoods = new Chain.BLL.Goods();
            int             Counts   = this.NetPagerParameter.RecordCount;

            strSql = strSql + " and Goods.GoodsClassID = GoodsClass.ClassID and Goods.GoodsID = GoodsNumber.GoodsID and GoodsNumber.ShopID=" + this.sltShop.Value;
            DataTable dtGoods = bllGoods.GetListSP(this.NetPagerParameter.PageSize, this.NetPagerParameter.CurrentPageIndex, out Counts, new string[]
            {
                strSql
            }).Tables[0];

            this.NetPagerParameter.RecordCount    = Counts;
            this.NetPagerParameter.CustomInfoHTML = string.Format("<div class=\"results\"><span>当前第{0}/{1}页 共{2}条记录 每页{3}条</span></div>", new object[]
            {
                this.NetPagerParameter.CurrentPageIndex,
                this.NetPagerParameter.PageCount,
                this.NetPagerParameter.RecordCount,
                this.NetPagerParameter.PageSize
            });
            this.gvGoodsList.DataSource = dtGoods;
            this.gvGoodsList.DataBind();
            PageBase.BindSerialRepeater(this.gvGoodsList, this.NetPagerParameter.PageSize * (this.NetPagerParameter.CurrentPageIndex - 1));
            Chain.BLL.MemCustomField          bllCustom = new Chain.BLL.MemCustomField();
            List <Chain.Model.MemCustomField> fieldlist = bllCustom.GetModelList("CustomType=2 and CustomFieldIsShow=1");

            if (fieldlist.Count > 0)
            {
                StringBuilder strHeader = new StringBuilder();
                StringBuilder strHtml   = new StringBuilder();
                for (int i = 0; i < this.gvGoodsList.Items.Count; i++)
                {
                    Literal   ltlGoodsID = (Literal)this.gvGoodsList.Items[i].FindControl("ltlGoodsID");
                    Literal   ltlHtml    = (Literal)this.gvGoodsList.Items[i].FindControl("ltlHtml");
                    int       GoodsID    = Convert.ToInt32(ltlGoodsID.Text);
                    DataRow[] drGoods    = dtGoods.Select(string.Format(" GoodsID = {0}", GoodsID));
                    strHtml.Length = 0;
                    foreach (Chain.Model.MemCustomField mdCustomField in fieldlist)
                    {
                        if (i == 0)
                        {
                            strHeader.AppendFormat("<th>{0}</th>", mdCustomField.CustomFieldName);
                        }
                        strHtml.AppendFormat("<td>{0}</td>", drGoods[0][mdCustomField.CustomField]);
                    }
                    ltlHtml.Text = strHtml.ToString();
                }
                this.ltlHeader.Text = strHeader.ToString();
            }
        }
Exemple #5
0
        protected void btnOut_Click(object sender, EventArgs e)
        {
            Chain.BLL.Goods bllGoods = new Chain.BLL.Goods();
            int             Counts   = this.NetPagerParameter.RecordCount;
            string          strSql   = this.QueryCondition();

            strSql += " and Goods.GoodsClassID = GoodsClass.ClassID and Goods.GoodsID = GoodsNumber.GoodsID";
            strSql  = PubFunction.GetShopAuthority(this._UserShopID, "ShopID", strSql);
            DataTable dtGoods = bllGoods.GetListSP(100000, 1, out Counts, new string[]
            {
                strSql
            }).Tables[0];

            DataExcelInfo.GoodsListExcel(dtGoods, this._UserName);
        }
Exemple #6
0
        protected void btnGoodsExpenseExcel_Click(object sender, EventArgs e)
        {
            int    Counts       = this.NetPagerParameter.RecordCount;
            string strSql       = this.QueryCondition();
            string strWhere     = " and " + this.QueryCondition();
            string strStartTime = this.txtStartTime.Value;
            string strEntTime   = this.txtEndTime.Value;

            if (strStartTime != "")
            {
                strSql   = strSql + " and  OrderCreateTime>='" + strStartTime + "'";
                strWhere = strWhere + " and  OrderCreateTime>='" + strEntTime + "'";
            }
            if (strEntTime != "")
            {
                DateTime strEntTimes = Convert.ToDateTime(strEntTime).AddDays(1.0);
                object   obj         = strSql;
                strSql = string.Concat(new object[]
                {
                    obj,
                    " and OrderCreateTime<'",
                    strEntTimes,
                    "'"
                });
                obj      = strWhere;
                strWhere = string.Concat(new object[]
                {
                    obj,
                    " and OrderCreateTime<'",
                    strEntTimes,
                    "'"
                });
            }
            strSql += " and OrderLog.OrderType != 4 AND OrderLog.OrderType != 5 AND OrderLog.OrderType != 3";
            strSql  = PubFunction.GetShopAuthority(this._UserShopID, "OrderLog.OrderShopID", strSql);
            Chain.BLL.Goods bllGoods = new Chain.BLL.Goods();
            DataTable       dt       = bllGoods.GetGoodsExpense(10000000, 1, out Counts, new string[]
            {
                strSql
            }).Tables[0];

            DataExcelInfo.GoodsExpensExcel(dt, this._UserName, strWhere);
        }
Exemple #7
0
        private int GetSysRemind(int shopID, int userid)
        {
            int sumCount = 0;
            int count    = 100000;

            Chain.BLL.Mem bllMem     = new Chain.BLL.Mem();
            DataTable     dtBirhtday = bllMem.GetBirthdayList(0, shopID, count).Tables[0];

            sumCount += dtBirhtday.Rows.Count;
            DataTable dtMemPastTime = bllMem.GetMemPastTime(" and DATEDIFF(day,getdate(),MemPastTime) = 0 ", shopID, count).Tables[0];

            sumCount += dtMemPastTime.Rows.Count;
            DataTable dtMemPointRest = bllMem.GetMemPointReset(string.Format("MemPoint>0 and DATEDIFF(day,isnull(MemConsumeLastTime,MemCreateTime),getdate()) >= '{0}' and MemShopID = '{1}' ", PubFunction.curParameter.intPointPeriod, shopID), 0, count).Tables[0];

            sumCount += dtMemPointRest.Rows.Count;
            DataTable dtGoods = new Chain.BLL.Goods().GetStockRemind(string.Format("Number < = '{0}' and GoodsType = '0' and ShopID = '{1}'", PubFunction.curParameter.intStockCount, shopID), count).Tables[0];

            sumCount += dtGoods.Rows.Count;
            DataTable dtCustomRemind = new Chain.BLL.SysCustomRemind().GetList("CustomReminder like '%" + PubFunction.UserIDTOName(userid) + "%' and DATEDIFF(day,CustomRemindTime,getdate())<=0 ", count).Tables[0];

            return(sumCount + dtCustomRemind.Rows.Count);
        }
Exemple #8
0
        protected void GetGoodsInfo(int goodsID)
        {
            Chain.BLL.Goods   bllGoods   = new Chain.BLL.Goods();
            Chain.Model.Goods modelGoods = bllGoods.GetModel(goodsID);
            DataTable         dtGoods    = bllGoods.GetItemAll(goodsID).Tables[0];

            this.txtGoodsID.Value   = modelGoods.GoodsID.ToString();
            this.txtGoodsCode.Value = modelGoods.GoodsCode;
            this.txtCode.Value      = modelGoods.GoodsCode;
            if (modelGoods.GoodsType == 1)
            {
                this.chkService.Checked = true;
            }
            this.txtGoodsName.Value     = modelGoods.Name;
            this.txtGoodsNameCode.Value = modelGoods.NameCode;
            PubFunction.BindGoodsClass(this.sltGoodsClass, modelGoods.CreateShopID);
            this.sltGoodsClass.Value       = modelGoods.GoodsClassID.ToString();
            this.sltjldw.Value             = modelGoods.Unit;
            this.sltCommissionType.Value   = modelGoods.CommissionType.ToString();
            this.txtCommissionNumber.Value = modelGoods.CommissionNumber.ToString();
            this.txtGoodsPrice.Value       = Math.Round(modelGoods.Price, 2).ToString();
            if (modelGoods.Point != -1)
            {
                this.txtGoodsPoint.Value = modelGoods.Point.ToString();
            }
            else
            {
                this.txtGoodsPoint.Value = "";
            }
            this.txtGoodsBidPrice.Value    = Math.Round(modelGoods.GoodsBidPrice, 2).ToString();
            this.txtGoodsMinPercent.Value  = modelGoods.MinPercent.ToString();
            this.txtGoodsRemark.Value      = modelGoods.GoodsRemark;
            this.txtGoodsSalePercent.Value = modelGoods.SalePercet.ToString();
            PubFunction.BindEditCustomFields(this.tbCustomField, "goods", dtGoods.Rows[0]);
            PubFunction.BindShopSelect(this._UserShopID, this.sltShopList, modelGoods.CreateShopID, this._UserShopID != 1);
            this.txtShopID.Value = modelGoods.CreateShopID.ToString();
            this.txtShopID.Value = modelGoods.CreateShopID.ToString();
        }
Exemple #9
0
        private DataTable CheckGoodsNumData(DataTable dtGoods, bool istable, int ThisShopID)
        {
            DataTable dtGoodsCopy = dtGoods.Copy();

            dtGoodsCopy.Clear();
            if (dtGoods.Rows.Count <= 0)
            {
                File.Delete(this.strSavePath);
                base.OutputWarn("检验的Excel表格还没有商品数据,请填写商品数据再检验。");
            }
            else
            {
                DataTable dtspid = new Chain.BLL.GoodsClass().GetAllList().Tables[0];
                for (int i = 0; i < dtGoods.Rows.Count; i++)
                {
                    bool   bolIndex = false;
                    string strError = "";
                    if (dtGoods.Rows[i].IsNull(0) || dtGoods.Rows[i]["GoodsCode"].ToString() == "")
                    {
                        strError += "商品编码不能为空,";
                        bolIndex  = true;
                    }
                    if (dtGoods.Rows[i]["GoodsCode"].ToString().Length < 5 || dtGoods.Rows[i]["GoodsCode"].ToString().Length > 25)
                    {
                        strError += "商品编码必须是5~25位数字,";
                        bolIndex  = true;
                    }
                    Chain.BLL.Goods bllGoods = new Chain.BLL.Goods();
                    if (!bllGoods.Exists(dtGoods.Rows[i][0].ToString()))
                    {
                        strError += "商品编码不存在系统,";
                        bolIndex  = true;
                    }
                    DataRow[] row = dtGoods.Select(" GoodsCode='" + dtGoods.Rows[i][0].ToString() + "'");
                    if (row.Length > 1)
                    {
                        strError += "商品编码在Excel表重复出现,";
                        bolIndex  = true;
                    }
                    if (dtGoods.Rows[i].IsNull(1) || dtGoods.Rows[i]["Name"].ToString() == "")
                    {
                        strError += "商品名称不能为空,";
                        bolIndex  = true;
                    }
                    if (!dtGoods.Rows[i].IsNull(2) && dtGoods.Rows[i]["Number"].ToString() != "")
                    {
                        if (PubFunction.ProductDecimalNum == 0)
                        {
                            int myid;
                            if (!int.TryParse(dtGoods.Rows[i]["Number"].ToString(), out myid))
                            {
                                strError += "商品库存只能是整数,";
                                bolIndex  = true;
                            }
                        }
                        else
                        {
                            string num = dtGoods.Rows[i]["Number"].ToString().Trim();
                            if (Regex.IsMatch(num, "^\\d+\\.$"))
                            {
                                num += "0";
                            }
                            if (num.IndexOf(".") > -1 && !Regex.IsMatch(num, "^\\d+\\.\\d{1," + PubFunction.ProductDecimalNum.ToString() + "}$"))
                            {
                                strError += string.Format("商品库存只能填写0或正整数或大于0的小数位不超{0}位的小数", PubFunction.ProductDecimalNum);
                                bolIndex  = true;
                            }
                        }
                    }
                    if (bolIndex)
                    {
                        if (strError.Substring(strError.Length - 1, 1) == ",")
                        {
                            strError = strError.Remove(strError.Length - 1);
                        }
                        dtGoods.Rows[i]["Error"] = strError;
                        dtGoodsCopy.Rows.Add(dtGoods.Rows[i].ItemArray);
                    }
                    if (istable)
                    {
                        dtGoodsCopy = dtGoods;
                    }
                }
            }
            return(dtGoodsCopy);
        }
Exemple #10
0
        private DataTable CheckGoodsData(DataTable dtGoods, bool istable)
        {
            DataTable dtGoodsCopy = dtGoods.Copy();

            dtGoodsCopy.Clear();
            if (dtGoods.Rows.Count <= 0)
            {
                File.Delete(this.strSavePath);
                base.OutputWarn("检验的Excel表格还没有商品数据,请填写商品数据再检验。");
            }
            else
            {
                DataTable dtspid = new Chain.BLL.GoodsClass().GetAllList().Tables[0];
                for (int i = 0; i < dtGoods.Rows.Count; i++)
                {
                    bool   bolIndex = false;
                    string strError = "";
                    if (dtGoods.Rows[i].IsNull(0) || dtGoods.Rows[i]["GoodsCode"].ToString() == "")
                    {
                        strError += "商品编码不能为空,";
                        bolIndex  = true;
                    }
                    if (dtGoods.Rows[i]["GoodsCode"].ToString().Length < 5 || dtGoods.Rows[i]["GoodsCode"].ToString().Length > 25)
                    {
                        strError += "商品编码必须是5~25位数字,";
                        bolIndex  = true;
                    }
                    Chain.BLL.Goods bllGoods = new Chain.BLL.Goods();
                    if (bllGoods.Exists(dtGoods.Rows[i][0].ToString(), this._UserShopID))
                    {
                        strError += "商品编码已存在系统,";
                        bolIndex  = true;
                    }
                    for (int j = 0; j < i; j++)
                    {
                        if (dtGoods.Rows[j][0].ToString() == dtGoods.Rows[i][0].ToString())
                        {
                            strError += "商品编码在Excel表重复出现,";
                            bolIndex  = true;
                        }
                    }
                    if (dtGoods.Rows[i].IsNull(1) || dtGoods.Rows[i]["Name"].ToString() == "")
                    {
                        strError += "商品名称不能为空,";
                        bolIndex  = true;
                    }
                    if (dtGoods.Rows[i].IsNull(3) || dtGoods.Rows[i]["GoodsClassID"].ToString() == "")
                    {
                        strError += "商品分类ID不能为空,";
                        bolIndex  = true;
                    }
                    else
                    {
                        int       myid;
                        DataRow[] drGoodsClass;
                        if (int.TryParse(dtGoods.Rows[i]["GoodsClassID"].ToString(), out myid))
                        {
                            drGoodsClass = dtspid.Select(string.Format(" ClassID = '{0}'", dtGoods.Rows[i]["GoodsClassID"].ToString()));
                            if (drGoodsClass.Length <= 0)
                            {
                                drGoodsClass = dtspid.Select(string.Format(" ClassName = '{0}'", dtGoods.Rows[i]["GoodsClassID"].ToString()));
                            }
                        }
                        else
                        {
                            drGoodsClass = dtspid.Select(string.Format(" ClassName = '{0}'", dtGoods.Rows[i]["GoodsClassID"].ToString()));
                        }
                        if (drGoodsClass.Length > 0)
                        {
                            dtGoods.Rows[i]["GoodsClassID"] = drGoodsClass[0]["ClassID"];
                        }
                        else
                        {
                            strError += "商品分类未找到,";
                            bolIndex  = true;
                        }
                    }
                    if (dtGoods.Rows[i].IsNull(4) || dtGoods.Rows[i]["Unit"].ToString() == "")
                    {
                        strError += "计量单位不能为空,";
                        bolIndex  = true;
                    }
                    decimal yzsz;
                    if (!dtGoods.Rows[i].IsNull(5) && dtGoods.Rows[i]["GoodsBidPrice"].ToString() != "")
                    {
                        if (!decimal.TryParse(dtGoods.Rows[i]["GoodsBidPrice"].ToString(), out yzsz))
                        {
                            strError += "参考进价只能是整数或小数,";
                            bolIndex  = true;
                        }
                    }
                    if (dtGoods.Rows[i].IsNull(6) || dtGoods.Rows[i]["Price"].ToString() == "")
                    {
                        strError += "零售单价不能为空,";
                        bolIndex  = true;
                    }
                    else if (!decimal.TryParse(dtGoods.Rows[i]["Price"].ToString(), out yzsz))
                    {
                        strError += "零售单价只能是整数或小数,";
                        bolIndex  = true;
                    }
                    if (!dtGoods.Rows[i].IsNull(7) && dtGoods.Rows[i]["Point"].ToString() != "")
                    {
                        int myid;
                        if (!int.TryParse(dtGoods.Rows[i]["Point"].ToString(), out myid))
                        {
                            strError += "商品积分只能是整数,";
                            bolIndex  = true;
                        }
                    }
                    if (dtGoods.Rows[i].IsNull(8) || dtGoods.Rows[i]["GoodsType"].ToString() == "")
                    {
                        strError += "商品类型不能为空,";
                        bolIndex  = true;
                    }
                    else
                    {
                        string intType = dtGoods.Rows[i]["GoodsType"].ToString();
                        if (intType != "0" && intType != "1" && intType != "普通商品" && intType != "服务项目")
                        {
                            strError += "商品类型只能是0(普通商品)或1(服务项目),";
                            bolIndex  = true;
                        }
                        else if (intType == "普通商品" || intType == "服务项目")
                        {
                            if (intType == "服务项目")
                            {
                                dtGoods.Rows[i]["GoodsType"] = "1";
                            }
                            else
                            {
                                dtGoods.Rows[i]["GoodsType"] = "0";
                            }
                        }
                    }
                    if (!dtGoods.Rows[i].IsNull(9) && dtGoods.Rows[i]["MinPercent"].ToString() != "")
                    {
                        if (!decimal.TryParse(dtGoods.Rows[i]["MinPercent"].ToString(), out yzsz))
                        {
                            strError += "最低折扣只能是0~1的小数,";
                            bolIndex  = true;
                        }
                        else if (decimal.Parse(dtGoods.Rows[i]["MinPercent"].ToString()) > 1m)
                        {
                            strError += "最低折扣只能是0~1的小数,";
                            bolIndex  = true;
                        }
                    }
                    if (!dtGoods.Rows[i].IsNull(10) && dtGoods.Rows[i]["CommissionType"].ToString() != "")
                    {
                        string intType = dtGoods.Rows[i]["CommissionType"].ToString();
                        if (intType != "1" && intType != "2" && intType != "按固定比例提成" && intType != "按固定金额提成")
                        {
                            strError += "提成类型只能是1(按固定比例提成)或2(按固定金额提成),";
                            bolIndex  = true;
                        }
                        else if (intType == "按固定比例提成" || intType == "按固定金额提成")
                        {
                            if (intType == "按固定比例提成")
                            {
                                dtGoods.Rows[i]["CommissionType"] = "1";
                            }
                            else
                            {
                                dtGoods.Rows[i]["CommissionType"] = "2";
                            }
                        }
                    }
                    if (!dtGoods.Rows[i].IsNull(11) && dtGoods.Rows[i]["CommissionNumber"].ToString() != "")
                    {
                        if (!decimal.TryParse(dtGoods.Rows[i]["CommissionNumber"].ToString(), out yzsz))
                        {
                            strError += "提成金额(比例)只能是数字,";
                            bolIndex  = true;
                        }
                        else if (decimal.Parse(dtGoods.Rows[i]["CommissionNumber"].ToString()) < 0m)
                        {
                            strError += "提成金额(比例)只能是大于0的数字,";
                            bolIndex  = true;
                        }
                    }
                    Chain.BLL.MemCustomField bllCustomField = new Chain.BLL.MemCustomField();
                    DataRow[] drCustomField = bllCustomField.GetList("  CustomType=2 ").Tables[0].Select();
                    DataRow[] array         = drCustomField;
                    for (int k = 0; k < array.Length; k++)
                    {
                        DataRow dr             = array[k];
                        string  strCustomField = dr["CustomField"].ToString();
                        string  strItem        = dtGoods.Rows[i][strCustomField].ToString();
                        if (!bool.Parse(dr["CustomFieldIsNull"].ToString()) && strItem == "")
                        {
                            strError = strError + dr["CustomFieldName"].ToString() + "不能为空,";
                            bolIndex = true;
                        }
                    }
                    if (bolIndex)
                    {
                        if (strError.Substring(strError.Length - 1, 1) == ",")
                        {
                            strError = strError.Remove(strError.Length - 1);
                        }
                        dtGoods.Rows[i]["Error"] = strError;
                        dtGoodsCopy.Rows.Add(dtGoods.Rows[i].ItemArray);
                    }
                    if (istable)
                    {
                        dtGoodsCopy = dtGoods;
                    }
                }
            }
            return(dtGoodsCopy);
        }
Exemple #11
0
        protected void btnCopy_Click(object sender, EventArgs e)
        {
            Chain.BLL.SysShop             bllShop = new Chain.BLL.SysShop();
            Chain.BLL.GoodsClassAuthority bllGoodsClassAuthority = new Chain.BLL.GoodsClassAuthority();
            Chain.BLL.GoodsClass          bllGoodsClass          = new Chain.BLL.GoodsClass();
            DataTable dtShop       = bllShop.GetList("ShopID>0 and ShopType=3 and IsMain=0 ").Tables[0];
            DataTable dtGoodsClass = bllGoodsClass.GetList("CreateShopID=" + this._UserShopID).Tables[0];

            for (int i = 0; i < dtShop.Rows.Count; i++)
            {
                int ShopID = int.Parse(dtShop.Rows[i]["ShopID"].ToString());
                for (int j = 0; j < dtGoodsClass.Rows.Count; j++)
                {
                    int ClassID = int.Parse(dtGoodsClass.Rows[j]["ClassID"].ToString());
                    Chain.Model.GoodsClassAuthority modelGoodsClassAuthority = new Chain.Model.GoodsClassAuthority();
                    modelGoodsClassAuthority.ClassID = ClassID;
                    modelGoodsClassAuthority.ShopID  = ShopID;
                    int count = bllGoodsClassAuthority.GetRecordCount(string.Concat(new object[]
                    {
                        "ShopID=",
                        ShopID,
                        " and ClassID=",
                        ClassID
                    }));
                    if (count == 0)
                    {
                        bllGoodsClassAuthority.Add(modelGoodsClassAuthority);
                    }
                }
            }
            Chain.BLL.GoodsClassDiscount bllGoodsClassDiscount = new Chain.BLL.GoodsClassDiscount();
            DataTable dtClassDiscount = bllGoodsClassDiscount.GetList("DiscountShopID=" + this._UserShopID).Tables[0];

            for (int i = 0; i < dtShop.Rows.Count; i++)
            {
                int ShopID = int.Parse(dtShop.Rows[i]["ShopID"].ToString());
                for (int j = 0; j < dtClassDiscount.Rows.Count; j++)
                {
                    Chain.Model.GoodsClassDiscount modelGoodsClassDiscount = new Chain.Model.GoodsClassDiscount();
                    int ClassID    = int.Parse(dtClassDiscount.Rows[j]["GoodsClassID"].ToString());
                    int MemLevelID = int.Parse(dtClassDiscount.Rows[j]["MemLevelID"].ToString());
                    modelGoodsClassDiscount.GoodsClassID         = ClassID;
                    modelGoodsClassDiscount.MemLevelID           = MemLevelID;
                    modelGoodsClassDiscount.DiscountShopID       = ShopID;
                    modelGoodsClassDiscount.ClassDiscountPercent = int.Parse(dtClassDiscount.Rows[j]["ClassDiscountPercent"].ToString());
                    modelGoodsClassDiscount.ClassPointPercent    = int.Parse(dtClassDiscount.Rows[j]["ClassPointPercent"].ToString());
                    DataTable dtShopGoodsClassDiscount = bllGoodsClassDiscount.GetList(string.Concat(new object[]
                    {
                        "MemLevelID=",
                        MemLevelID,
                        " and DiscountShopID=",
                        ShopID,
                        " and GoodsClassID=",
                        ClassID
                    })).Tables[0];
                    if (dtShopGoodsClassDiscount.Rows.Count == 0)
                    {
                        bllGoodsClassDiscount.Add(modelGoodsClassDiscount);
                    }
                    else
                    {
                        modelGoodsClassDiscount.ClassDiscountID = int.Parse(dtShopGoodsClassDiscount.Rows[0]["ClassDiscountID"].ToString());
                        bllGoodsClassDiscount.Update(modelGoodsClassDiscount);
                    }
                }
            }
            Chain.BLL.Goods bllGoods = new Chain.BLL.Goods();
            DataTable       dtGoods  = bllGoods.GetGoodsList("CreateShopID=" + this._UserShopID).Tables[0];

            Chain.BLL.GoodsNumber bllGoodsNumber = new Chain.BLL.GoodsNumber();
            for (int i = 0; i < dtShop.Rows.Count; i++)
            {
                int ShopID = int.Parse(dtShop.Rows[i]["ShopID"].ToString());
                for (int j = 0; j < dtGoods.Rows.Count; j++)
                {
                    int GoodsID = int.Parse(dtGoods.Rows[j]["GoodsID"].ToString());
                    int count   = bllGoodsNumber.GetRecordCount(string.Concat(new object[]
                    {
                        "GoodsID=",
                        GoodsID,
                        " and ShopID=",
                        ShopID
                    }));
                    Chain.Model.GoodsNumber modelGoodsNumber = new Chain.Model.GoodsNumber();
                    modelGoodsNumber.GoodsID = GoodsID;
                    modelGoodsNumber.Number  = 0m;
                    modelGoodsNumber.ShopID  = ShopID;
                    if (count == 0)
                    {
                        bllGoodsNumber.Add(modelGoodsNumber);
                    }
                }
            }
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "message", "<Script Language='JavaScript' defer>art.dialog({title: '系统提示',time: 2,content:'同步成功',close: function () { location.href = 'GoodsList.aspx?PID=62';  }});</script>");
        }