Esempio n. 1
0
        private void DgBind()
        {
            Hashtable htPara     = new Hashtable();
            string    strBesFlag = cmbFlag.Text.Trim();

            if (cmbFlag.Text == "全部" || cmbFlag.Text.Trim() == "")
            {
                strBesFlag = "";
            }
            else if (cmbFlag.Text == "已下订")
            {
                strBesFlag = "0";
            }
            else if (cmbFlag.Text == "已完成")
            {
                strBesFlag = "2";
            }
            else if (cmbFlag.Text == "已取消")
            {
                strBesFlag = "1";
            }
//			else
//			{
//				strBesFlag=this.GetColEn(strBesFlag,"BF");
//			}
            htPara.Add("strBesFlag", strBesFlag);
            string strBegin = dtpBegin.Value.ToShortDateString() + " 00:00:00";

            htPara.Add("strBegin", strBegin);
            string strEnd = dtpEnd.Value.ToShortDateString() + " 23:59:59";

            htPara.Add("strEnd", strEnd);

            Exception err = null;
            DataTable dt  = new DataTable();

            dt = cs.GetBespeaksQuery(htPara, out err);
            if (dt != null && dt.Rows.Count >= 0)
            {
                this.DataTableConvert(dt, "vcDeptID", "MD", "vcCommCode", "vcCommName");

                this.dataGrid1.CaptionText = "订购日志";
                this.dataGrid1.SetDataBinding(dt, "");
                this.EnToCh("流水号,会员卡号,订购人,联系电话,订购内容,数量,下订日期,送货日期,操作员,操作员门店,订购状态,完成日期", "50,50,80,100,150,50,80,80,80,80,80,80", dt, this.dataGrid1);
                if (dt.Rows.Count > 0)
                {
                    this.sbtnExcel.Enabled = true;
                }
                else
                {
                    this.sbtnExcel.Enabled = false;
                }
            }
            else
            {
                MessageBox.Show("查询出错,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (err != null)
                {
                    clog.WriteLine(err);
                }
            }
        }