Beispiel #1
0
        private void DgBind()
        {
            string strAssCode = txtAssCode.Text.ToString();
            string strBegin   = dtpBegin.Value.ToShortDateString() + " 00:00:00";
            string strEnd     = dtpEnd.Value.ToShortDateString() + " 23:59:59";
            string strDeptID  = this.cmbDept.Text.Trim();

            if (strAssCode == "*")
            {
                strAssCode = "";
            }
            if (strDeptID == "全部")
            {
                strDeptID = "";
            }
            else
            {
                strDeptID = this.GetColEn(strDeptID, "MD");
            }
            Hashtable htPara = new Hashtable();

            htPara.Add("strAssCode", strAssCode);
            htPara.Add("strBegin", strBegin);
            htPara.Add("strEnd", strEnd);
            htPara.Add("strDeptID", strDeptID);

            Exception err   = null;
            DataSet   dsout = new DataSet();

            this.txtAssCount.Text   = "0";
            this.txtLCount.Text     = "0";
            this.txtGoodsCount.Text = "0";

            dsout = cs.GetLargQuery(htPara, out err);
            if (dsout.Tables["cons1"] != null && dsout.Tables["cons1"].Rows.Count >= 0)
            {
                this.dataGrid1.CaptionText = "赠送会员消费统计报表";
                this.dataGrid1.SetDataBinding(dsout.Tables["cons1"], "");
                this.DataTableConvert(dsout.Tables["cons1"], "VcGoodsID", "Goods", "VcGoodsID", "vcGoodsName");
                this.DataTableConvert(dsout.Tables["cons1"], "vcDeptID", "MD", "vcCommCode", "vcCommName");
                this.EnToCh("会员姓名,会员卡号,商品名称,数量,赠送日期,操作员,部门", "100,100,100,100,150,100,100", dsout.Tables["cons1"], this.dataGrid1);

                if (dsout.Tables["cons1"].Rows.Count > 0)
                {
                    this.sbtnExcel.Enabled = true;
                }
                else
                {
                    this.sbtnExcel.Enabled = false;
                }

                if (dsout.Tables["cons2"] != null && dsout.Tables["cons2"].Rows.Count >= 0)
                {
                    this.txtAssCount.Text   = dsout.Tables["cons2"].Rows[0]["asscount"].ToString();
                    this.txtLCount.Text     = dsout.Tables["cons1"].Rows.Count.ToString();
                    this.txtGoodsCount.Text = dsout.Tables["cons2"].Rows[0]["goodscount"].ToString();
                }
            }
            else
            {
                MessageBox.Show("赠送会员查询出错,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (err != null)
                {
                    clog.WriteLine(err);
                }
            }
        }