private void DgBind() { string strDeptNameTmp = CMSMData.CMSMDataAccess.SysInitial.LocalDeptNameTmp; string strCardID = txtCardID.Text.Trim(); string strCompName = cmbCompName.Text.Trim(); if (strCompName == "全部") { strCompName = ""; } string strType = cmbType.Text.ToString(); string strDeptName = cmbDept.Text.Trim(); string strLicenseTag = txtLicenseTag.Text.Trim(); if (strDeptName == "全部") { strDeptName = strDeptNameTmp; } if (strType == "全部") { strType = ""; } else { strType = this.GetColEn(strType, "MemState"); } Hashtable htpara = new Hashtable(); htpara.Add("strCardID", strCardID); htpara.Add("strCompName", strCompName); htpara.Add("strType", strType); htpara.Add("strDeptName", strDeptName); htpara.Add("strLicenseTag", strLicenseTag); Exception err = null; DataTable dt = new DataTable(); dt = ca.GetAssociator(htpara, out err); if (err != null) { MessageBox.Show("查询错误,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); clog.WriteLine(err); return; } txtCount.Text = dt.Rows.Count.ToString(); if (dt != null) { this.DataTableConvert(dt, "cnvcState", "MemState", "cnvcCommCode", "cnvcCommName"); this.dataGrid1.SetDataBinding(dt, ""); this.EnToCh("会员卡号,单位名称,车牌号,加油名称,油号,指定加油站,会员状态,备注,发卡日期,操作员,操作日期", "60,200,100,80,80,100,80,90,90", dt, this.dataGrid1); } else { MessageBox.Show("查询错误,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } }
private void DgBind() { string strCardID = txtCardID.Text.Trim(); string strAssName = cmbAssName.Text.Trim(); string strType = cmbType.Text.ToString(); string strType1 = ""; string strDeptID = cmbDept.Text.Trim(); string strPhone = txtPhone.Text.Trim(); string strBegin = dtpBegin.Value.ToShortDateString() + " 00:00:00"; string strEnd = dtpEnd.Value.ToShortDateString() + " 23:59:59"; if (strDeptID == "全部") { strDeptID = ""; } else { strDeptID = this.GetColEn(strDeptID, "MD"); } if (strType == "全部") { strType1 = "all"; } if (strType == "正常") { strType1 = "0"; } if (strType == "挂失") { strType1 = "1"; } if (strType == "补卡") { strType1 = "2"; } if (strType == "回收") { strType1 = "3"; } Hashtable htPara = new Hashtable(); htPara.Add("strType1", strType1); htPara.Add("strCardID", strCardID); htPara.Add("strAssName", strAssName); htPara.Add("strPhone", strPhone); htPara.Add("strBegin", strBegin); htPara.Add("strEnd", strEnd); htPara.Add("strDeptID", strDeptID); Exception err = null; DataTable dt = new DataTable(); dt = ca.GetAssociator(htPara, out err); if (err != null) { MessageBox.Show("查询错误,请检查《vpn》是否连接!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); clog.WriteLine(err); return; } if (dt.Rows.Count >= 0) { this.DataTableConvert(dt, "vcAssType", "AT", "vcCommCode", "vcCommName"); this.DataTableConvert(dt, "vcAssState", "AS", "vcCommCode", "vcCommName"); this.DataTableConvert(dt, "vcDeptID", "MD", "vcCommCode", "vcCommName"); } double dcharge = 0; int iIg = 0; for (int i = 0; i < dt.Rows.Count; i++) { dcharge += Math.Round(double.Parse(dt.Rows[i]["nCharge"].ToString()), 2); iIg += int.Parse(dt.Rows[i]["iIgValue"].ToString()); } txtCount.Text = dt.Rows.Count.ToString(); txtFee.Text = Math.Round(dcharge, 2).ToString(); txtIG.Text = iIg.ToString(); if (dt != null) { this.dataGrid1.SetDataBinding(dt, ""); this.EnToCh("会员ID,会员卡号,会员姓名,联系电话,会员类型,会员状态,当前余额,当前积分,门店,创建日期,操作日期,备注,身份证号,联系地址,Email,拼音简码", "60,80,60,100,80,80,80,80,150,140,140,140,90,60,80", dt, this.dataGrid1); } else { MessageBox.Show("查询错误,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } }