protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string strCardId = Request["vcCardId"]; this.lblCardId.Text = strCardId; string strAssState = Request["OperFlag"]; Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; busiq = new BusiComm.BusiQuery(strcons); DataTable dt = busiq.GetAssInfo(strCardId, strAssState); if (dt == null || dt.Rows.Count == 0) { switch (strAssState) { case "0": this.Popup("未找到会员资料或者此会员不在正常在用状态"); break; case "1": this.Popup("未找到会员资料或者此会员不在挂失状态"); break; } this.RedirectPage("wfmAssInfo.aspx"); return; } this.lblAssName.Text = dt.Rows[0]["vcAssName"].ToString(); this.lblLinkPhone.Text = dt.Rows[0]["vcLinkPhone"].ToString(); this.lblLinkAddress.Text = dt.Rows[0]["vcLinkAddress"].ToString(); this.lblAssState.Text = dt.Rows[0]["vcAssState"].ToString(); this.lblCharge.Text = dt.Rows[0]["nCharge"].ToString(); this.lblCreateDate.Text = dt.Rows[0]["dtCreateDate"].ToString(); this.lblOperDate.Text = dt.Rows[0]["dtOperDate"].ToString(); this.lblDept.Text = dt.Rows[0]["vcDeptName"].ToString(); this.hfAssId.Value = dt.Rows[0]["iAssId"].ToString(); this.hfAssState.Value = strAssState; switch (strAssState) { case "0": this.Button1.Text = "挂失"; break; case "1": this.Button1.Text = "解挂"; break; } } }
protected void btQuery_Click(object sender, System.EventArgs e) { Session.Remove("QUERY"); Session.Remove("toExcel"); strBeginDate = Request.Form["txtBegin"].ToString(); strEndDate = Request.Form["txtEnd"].ToString(); if (strBeginDate == "" || strEndDate == "" || strBeginDate == null || strEndDate == null) { this.SetErrorMsgPageBydir("时间不能为空,请重新选择时间!"); return; } Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; busiq = new BusiComm.BusiQuery(strcons); Hashtable htPara = new Hashtable(); string strCardID = txtCardID.Text.Trim(); htPara.Add("strCardID", strCardID); string strAssName = txtAssName.Text.Trim(); htPara.Add("strAssName", strAssName); string strAssType = ddlAssType.SelectedValue; string strAssState = ddlAssState.SelectedValue; string strDeptID = ddlDept.SelectedValue; if (strAssType == "全部") { strAssType = ""; } htPara.Add("strAssType", strAssType); if (strAssState == "全部") { strAssState = ""; } htPara.Add("strAssState", strAssState); if (strDeptID == "全部") { strDeptID = ""; } htPara.Add("strDeptID", strDeptID); htPara.Add("strBeginDate", strBeginDate); htPara.Add("strEndDate", strEndDate); string strLinkPhone = this.txtLinkPhone.Text; htPara.Add("strLinkPhone", strLinkPhone); try { DataTable dtout = busiq.GetAssInfo(htPara); if (dtout == null) { this.SetErrorMsgPageBydir("查询出错,请重试!"); btnExcel.Enabled = false; return; } else { // this.TableConvert(dtout,"会员类型","tbCommCode","vcCommSign='AT'"); this.TableConvert(dtout, "会员状态", "tbCommCode", "vcCommSign='AS'"); this.TableConvert(dtout, "门店", "tbCommCode", "vcCommSign='MD'"); dtout.TableName = "会员资料清单"; DataTable dtexcel = dtout.Copy(); Session["QUERY"] = dtout; for (int i = 0; i < dtexcel.Rows.Count; i++) { if (dtexcel.Rows[i][0].ToString().Substring(0, 1) != "V") { dtexcel.Rows[i][0] = "'" + dtexcel.Rows[i][0].ToString(); } dtexcel.Rows[i][2] = "'" + dtexcel.Rows[i][2].ToString(); // dtexcel.Rows[i][10]="'"+dtexcel.Rows[i][10].ToString(); } Session["toExcel"] = dtexcel; CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"]; if (dtout.Rows.Count <= 0) { btnExcel.Enabled = false; } else { if (ls1.strLimit == "CL001") { btnExcel.Enabled = true; } } } if (this.CheckAuthority()) { dtout.Columns.Add("挂失"); foreach (DataRow dr in dtout.Rows) { if (dr["会员状态"].ToString() == "正常在用") { dr["挂失"] = "<a href='wfmAssInfoDetail.aspx?OperFlag=0&" + "vcCardId=" + dr["会员卡号"].ToString() + "'>挂失</a>"; } else if (dr["会员状态"].ToString() == "挂失") { dr["挂失"] = "<a href='wfmAssInfoDetail.aspx?OperFlag=1&" + "vcCardId=" + dr["会员卡号"].ToString() + "'>解挂</a>"; } } } UcPageView1.MyDataGrid.PageSize = 30; DataView dvOut = new DataView(dtout); this.UcPageView1.MyDataSource = dvOut; this.UcPageView1.BindGrid(); } catch (Exception er) { this.clog.WriteLine(er); this.SetErrorMsgPageBydir("查询错误,请重试!"); return; } }
private void btQuery_Click(object sender, System.EventArgs e) { Session.Remove("QUERY"); Session.Remove("toExcel"); strBeginDate = Request.Form["txtBegin"].ToString(); strEndDate = Request.Form["txtEnd"].ToString(); if (strBeginDate == "" || strEndDate == "" || strBeginDate == null || strEndDate == null) { this.SetErrorMsgPageBydir("时间不能为空,请重新选择时间!"); return; } Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; busiq = new BusiComm.BusiQuery(strcons); Hashtable htPara = new Hashtable(); string strCardID = txtCardID.Text.Trim(); htPara.Add("strCardID", strCardID); string strAssName = txtAssName.Text.Trim(); htPara.Add("strAssName", strAssName); string strPhone = txtPhone.Text.Trim(); htPara.Add("strPhone", strPhone); string strAssType = ddlAssType.SelectedValue; string strAssState = ddlAssState.SelectedValue; string strDeptID = ddlDept.SelectedValue; if (strAssType == "全部") { strAssType = ""; } htPara.Add("strAssType", strAssType); if (strAssState == "全部") { strAssState = ""; } htPara.Add("strAssState", strAssState); if (strDeptID == "全部") { strDeptID = ""; } htPara.Add("strDeptID", strDeptID); htPara.Add("strBeginDate", strBeginDate); htPara.Add("strEndDate", strEndDate); try { double sum_Fee = 0; double sum_IG = 0; DataTable dtout = busiq.GetAssInfo(htPara); if (dtout == null) { this.SetErrorMsgPageBydir("查询出错,请重试!"); btnExcel.Enabled = false; return; } else { this.TableConvert(dtout, "会员类型", "tbCommCode", "vcCommSign='AT'"); this.TableConvert(dtout, "会员状态", "tbCommCode", "vcCommSign='AS'"); this.TableConvert(dtout, "门店", "tbCommCode", "vcCommSign='MD'"); dtout.TableName = "会员资料清单"; DataTable dtexcel = dtout.Copy(); Session["QUERY"] = dtout; for (int i = 0; i < dtexcel.Rows.Count; i++) { if (dtexcel.Rows[i][0].ToString().Substring(0, 1) != "V") { dtexcel.Rows[i][0] = "'" + dtexcel.Rows[i][0].ToString(); } dtexcel.Rows[i][2] = "'" + dtexcel.Rows[i][2].ToString(); dtexcel.Rows[i][10] = "'" + dtexcel.Rows[i][10].ToString(); } Session["toExcel"] = dtexcel; CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"]; if (dtout.Rows.Count <= 0) { btnExcel.Enabled = false; this.lblSumFee.Text = "当前余额汇总:0"; this.lblSumIG.Text = "当前积分汇总:0"; } else { for (int j = 0; j < dtout.Rows.Count; j++) { sum_Fee += Math.Round(double.Parse(dtout.Rows[j]["当前余额"].ToString()), 2); sum_IG += Math.Round(double.Parse(dtout.Rows[j]["当前积分"].ToString()), 2); } } } sum_Fee = Math.Round(sum_Fee, 2); this.lblSumFee.Text = "当前余额汇总:" + sum_Fee.ToString() + "元"; this.lblSumIG.Text = "当前积分汇总:" + sum_IG.ToString(); UcPageView1.MyDataGrid.PageSize = 30; DataView dvOut = new DataView(dtout); this.UcPageView1.MyDataSource = dvOut; this.UcPageView1.BindGrid(); } catch (Exception er) { this.clog.WriteLine(er); this.SetErrorMsgPageBydir("查询错误,请重试!"); return; } }