123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.MembershipManage
- {
- public partial class PhotographerConferenceStatisticSmallForm : LYFZ.Software.UI.MembershipManage.PhotographerConferenceStatisticSmallForm
- {
- public PhotographerConferenceStatisticSmallForm()
- {
- this.Resize += PhotographerConferenceStatisticSmallForm_Resize;
- }
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_ErpMemberCard mcbll = new BLL.BLL_ErpMemberCard();
- string StrPointsType;
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void PhotographerConferenceStatisticSmallForm_Shown(object sender, EventArgs e)
- {
- if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.MemberManage, LYFZ.CustomAttributes.OperatingAuthority.SMSSend))
- { this.btnSendSMS.Enabled = false; }
- }
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void PhotographerConferenceStatisticSmallForm_Load(object sender, EventArgs e)
- {
- string sql = "select Sconfig_Value from tb_ErpSystemConfigure where Sconfig_Code = 'MemberPhotographerNeededType'";
- DataSet dtSet = orbll.GetView_Custom(sql);
- DataTable tbl1 = dtSet.Tables["ds"];
- if (tbl1.Rows.Count > 0)
- { StrPointsType = tbl1.Rows[0]["Sconfig_Value"].ToString().Trim(); }
- else { MessageBoxCustom.Show("未设置新摄会所需要积分方案!"); this.Close(); }
- PublicQuery();
- }
- /// <summary>
- /// 查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnQuery_Click(object sender, EventArgs e)
- {
- //int A = LYFZ.Software.MainBusiness.MembershipManage.MemberPublicClass.GetPoints_AgoPeriod(LYFZ.EnumPublic.MemberPointsType.AgoPeriod_RMB, 5000, "201505081446052982");
- //int B = LYFZ.Software.MainBusiness.MembershipManage.MemberPublicClass.GetPoints_AgoPeriod(LYFZ.EnumPublic.MemberPointsType.LatePeriod_RMB, 5000, "201505081446052982");
- //int C = LYFZ.Software.MainBusiness.MembershipManage.MemberPublicClass.GetPoints_AgoPeriod(LYFZ.EnumPublic.MemberPointsType.txtReferral_RMB, 5000, "201505081446052982");
- //MessageBox.Show(A + " " + B + " " + C);
- this.tabPanel.SelectedIndex = 0;
- PublicQuery();
- PublicQueryCount++;
- }
- LYFZ.Software.MainBusiness.MembershipManage.SetSmallForm.PhotographerConditionModel model = null;
- /// <summary>
- /// 条件查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnConditionQuery_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.MembershipManage.SetSmallForm.PhotographerConditionQuerySmallForm frm = new SetSmallForm.PhotographerConditionQuerySmallForm();
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- model = frm.model;
- this.tabPanel.SelectedIndex = 0;
- PublicQuery();
- PublicQueryCount++;
- }
- }
- /// <summary>
- /// 发送短信
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnSendSMS_Click(object sender, EventArgs e)
- {
- string StrMc_Telephone = "";
- string strtmp = "";
- switch (this.tabPanel.TabPages[this.tabPanel.SelectedIndex].Name.Trim())
- {
- case "tb_1":
- if (this.dgvData1.Rows.Count > 0)
- {
- if (this.dgvData1.SelectedRows.Count > 0)
- {
- for (int i = 0; i < this.dgvData1.SelectedRows.Count; i++)
- {
- if (LYFZ.Command.Command_Validate.IsPhone(this.dgvData1.SelectedRows[i].Cells["客户电话"].Value.ToString().Trim()))
- { StrMc_Telephone += this.dgvData1.SelectedRows[i].Cells["客户电话"].Value.ToString().Trim() + ","; }
- else
- { strtmp = this.dgvData1.SelectedRows[i].Cells["客户电话"].Value.ToString().Trim() + ","; }
- }
- }
- }
- break;
- case "tb_2":
- if (this.dgvData2.Rows.Count > 0)
- {
- if (this.dgvData2.SelectedRows.Count > 0)
- {
- for (int i = 0; i < this.dgvData1.SelectedRows.Count; i++)
- {
- if (LYFZ.Command.Command_Validate.IsPhone(this.dgvData2.SelectedRows[i].Cells["客户电话"].Value.ToString().Trim()))
- { StrMc_Telephone += this.dgvData2.SelectedRows[i].Cells["客户电话"].Value.ToString().Trim() + ","; }
- else
- { strtmp = this.dgvData2.SelectedRows[i].Cells["客户电话"].Value.ToString().Trim() + ","; }
- }
- }
- }
- break;
- case "tb_3":
- if (this.dgvData3.Rows.Count > 0)
- {
- if (this.dgvData3.SelectedRows.Count > 0)
- {
- for (int i = 0; i < this.dgvData1.SelectedRows.Count; i++)
- {
- if (LYFZ.Command.Command_Validate.IsPhone(this.dgvData3.SelectedRows[i].Cells["客户电话"].Value.ToString().Trim()))
- { StrMc_Telephone += this.dgvData3.SelectedRows[i].Cells["客户电话"].Value.ToString().Trim() + ","; }
- else
- { strtmp = this.dgvData3.SelectedRows[i].Cells["客户电话"].Value.ToString().Trim() + ","; }
- }
- }
- }
- break;
- case "tb_4":
- if (this.dgvData4.Rows.Count > 0)
- {
- if (this.dgvData4.SelectedRows.Count > 0)
- {
- for (int i = 0; i < this.dgvData1.SelectedRows.Count; i++)
- {
- if (LYFZ.Command.Command_Validate.IsPhone(this.dgvData4.SelectedRows[i].Cells["客户电话"].Value.ToString().Trim()))
- { StrMc_Telephone += this.dgvData4.SelectedRows[i].Cells["客户电话"].Value.ToString().Trim() + ","; }
- else
- { strtmp = this.dgvData4.SelectedRows[i].Cells["客户电话"].Value.ToString().Trim() + ","; }
- }
- }
- }
- break;
- }
- if (strtmp != "")
- { MessageBoxCustom.Show("号码" + strtmp.TrimEnd(',') + "不是正确的电话号码"); }
- if (StrMc_Telephone != "")
- {
- LYFZ.Software.MainBusiness.SMSManagement.SmsSend.FrmSendSms SendSMS = new SMSManagement.SmsSend.FrmSendSms();
- SendSMS.Phone = StrMc_Telephone.TrimEnd(',');
- SendSMS.Show(); return;
- }
- else
- { MessageBoxCustom.Show("请选中您要发送短信的新摄会会员"); return; }
- }
- /// <summary>
- /// 关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnColse_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- private int tb1Count = 0;
- private int tb2Count = 0;
- private int tb3Count = 0;
- private int tb4Count = 0;
- /// <summary>
- /// 选项卡选择
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void tabPanel_SelectedIndexChanged(object sender, EventArgs e)
- {
- switch (this.tabPanel.TabPages[this.tabPanel.SelectedIndex].Name.Trim())
- {
- case "tb_1":
- if (this.tb1Count < this.PublicQueryCount)
- {
- this.GetStatusData(this.dgvData1, "全部");
- this.tb1Count = this.PublicQueryCount;
- this.dgvData1.FillLastColumn(true);
- }
- break;
- case "tb_2":
- if (this.tb2Count < this.PublicQueryCount)
- {
- this.GetStatusData(this.dgvData2, "已返");
- this.tb2Count = this.PublicQueryCount;
- this.dgvData2.FillLastColumn(true);
- }
- break;
- case "tb_3":
- if (this.tb3Count < this.PublicQueryCount)
- {
- this.GetStatusData(this.dgvData3, "未返");
- this.tb3Count = this.PublicQueryCount;
- this.dgvData3.FillLastColumn(true);
- }
- break;
- case "tb_4":
- if (this.tb4Count < this.PublicQueryCount)
- {
- this.GetStatusData(this.dgvData4, "未达条件");
- this.tb4Count = this.PublicQueryCount;
- this.dgvData4.FillLastColumn(true);
- }
- break;
- }
- }
- /// <summary>
- /// 行添加时发生改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void dgvData1_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
- {
- if (this.dgvData1.Rows.Count > 0)
- {
- decimal OpenCradAoumnt = 0;
- decimal NotBackAoumnt = 0;
- decimal OKBackAoumnt = 0;
- decimal NotReachedAoumnt = 0;
- for (int i = 0; i < this.dgvData1.Rows.Count; i++)
- {
- if (this.dgvData1.Rows[i].Cells["所需开卡金"].Value.ToString().Trim() != "")
- { OpenCradAoumnt += Convert.ToDecimal(this.dgvData1.Rows[i].Cells["所需开卡金"].Value); }
- if (this.dgvData1.Rows[i].Cells["返还状态"].Value.ToString().Trim() == "未返")
- { NotBackAoumnt += Convert.ToDecimal(this.dgvData1.Rows[i].Cells["返还开卡金"].Value); }
- else if (this.dgvData1.Rows[i].Cells["返还状态"].Value.ToString().Trim() == "已返")
- { OKBackAoumnt += Convert.ToDecimal(this.dgvData1.Rows[i].Cells["返还开卡金"].Value); }
- else if (this.dgvData1.Rows[i].Cells["返还状态"].Value.ToString().Trim() == "未达条件")
- { NotReachedAoumnt += Convert.ToDecimal(this.dgvData1.Rows[i].Cells["返还开卡金"].Value); }
- }
- this.labelEx1.Text = "总开卡金:" + OpenCradAoumnt + " ;已返:" + OKBackAoumnt + ";未返:" + NotBackAoumnt + ";未达条件:" + NotReachedAoumnt;
- }
- }
- LYFZ.Software.MainBusiness.MembershipManage.SetSmallForm.MyPhotographerConferenceSmallForm frm = null;
- /// <summary>
- /// 全部双击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void dgvData1_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- if (e.Location.Y > this.dgvData1.ColumnHeadersHeight)
- {
- if (this.dgvData1.Rows.Count > 0)
- {
- if (this.dgvData1.CurrentRow.Index >= 0 && this.dgvData1.CurrentCell.ColumnIndex >= 0)
- {
- if (frm != null)
- { frm.Close(); }
- frm = new SetSmallForm.MyPhotographerConferenceSmallForm();
- frm.StrNumber = this.dgvData1.CurrentRow.Cells["会员编号"].Value.ToString().Trim();
- frm.Show();
- }
- }
- }
- }
- /// <summary>
- /// 已达未返双击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void dgvData3_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- if (e.Location.Y > this.dgvData3.ColumnHeadersHeight)
- {
- if (this.dgvData3.Rows.Count > 0)
- {
- if (this.dgvData3.CurrentRow.Index >= 0 && this.dgvData3.CurrentCell.ColumnIndex >= 0)
- {
- if (frm != null)
- { frm.Close(); }
- frm = new SetSmallForm.MyPhotographerConferenceSmallForm();
- frm.StrNumber = this.dgvData3.CurrentRow.Cells["会员编号"].Value.ToString().Trim();
- frm.Show();
- }
- }
- }
- }
- /// <summary>
- /// 查询框回车键
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void txtQuery_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- { this.btnQuery_Click(this, null); }
- }
- /// <summary>
- /// 窗体大小发生变化
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void PhotographerConferenceStatisticSmallForm_Resize(object sender, EventArgs e)
- {
- }
- /// <summary>
- /// 总查询次数
- /// </summary>
- private int PublicQueryCount = 0;
- DataTable dt = new DataTable();
- /// <summary>
- /// 公共查询
- /// </summary>
- private void PublicQuery()
- {
- string StrWhere = " 会员卡号 is not null and 1 = 1 ";
- if (this.model != null)
- {
- if (this.model.MemberType != "")
- { StrWhere += " and 类型 = '" + this.model.MemberType + "'"; }
- if (this.model.IsPoints)
- {
- if (StrPointsType == "AvailablePoints")
- { StrWhere += " and (Mcps_AvailablePoints between " + this.model.StrPointStart + " and " + this.model.StrPointEnd + ")"; }
- else if (StrPointsType == "HistoricalPoints")
- { StrWhere += " and (Mcps_TotalPoints between " + this.model.MemberType + " and " + this.model.StrPointEnd + ")"; }
- }
- if (this.model.IsDate)
- { StrWhere += " and (Mcpm_CreateDatetime between '" + this.model.StrDateStart + "' and '" + this.model.StrDateEnd + "')"; }
- if (this.model.IsBack)
- { StrWhere += " and (Mcpm_BackDatetime between '" + this.model.StrBackDateStart + "' and '" + this.model.StrBackDateEnd + "')"; }
- if (this.model.StrStatusTag != null)
- { StrWhere += " and Mcpm_BackStatus = '" + this.model.StrStatusTag + "'"; }
- }
- string StrText = this.txtQuery.Text.Trim();
- if (StrText != "")
- {
- if (LYFZ.Command.Command_Validate.IsNumber(StrText))
- { StrWhere += " and (电话 like '%" + StrText + "%' or 会员卡号 like '%" + StrText + "%')"; }
- else if (LYFZ.Command.Command_Validate.IsEnglish(StrText))
- { StrWhere += " and (姓名 like '%" + StrText + "%' or 会员卡号 like '%" + StrText + "%' or 姓名拼音 like '" + StrText + "%')"; }
- else if (LYFZ.Command.Command_Validate.IsChinese(StrText))
- { StrWhere += " and 姓名 like '%" + StrText + "%' "; }
- else
- { StrWhere += " and (姓名 like '%" + StrText + "%' or 会员卡号 like '%" + StrText + "%' or 电话 like '%" + StrText + "%')"; }
- }
- string sql = "select * from (select Mcpm_Number,Mcpm_UpgradeAoumnt,Mcpm_BackAoumnt,Mcpm_UpgradePoints,Mcpm_BackStatus,Mcpm_BackDatetime,dbo.fn_CheckUserIDGetUserName(Mcpm_CreateName) AS Mcpm_CreateName,Mcpm_CreateDatetime," +
- "会员卡号,姓名,dbo.fn_ChineseToSpell(姓名) AS 姓名拼音,类型,积分,电话,Mcps_TotalPoints,Mcps_AvailablePoints from tb_ErpMemberCardPhotographerMain Left join (select Mc_Number,会员卡号,姓名,类型,积分,电话,Mcps_TotalPoints," +
- "Mcps_AvailablePoints from BView_MemberMain_GoldMember left join tb_ErpMemberCardPoints on Mc_Number = Mcps_Number) as tb on Mcpm_Number = Mc_Number) AS tb2 where " + StrWhere + ";";
- DataSet dtSet = orbll.GetView_Custom(sql);
- DataTable tbl1 = dtSet.Tables["ds"];
- if (this.dt.Columns.Count <= 0)
- {
- string[] StrColumns = ("会员编号,会员卡号,客户姓名,客户电话,会员类型,所需开卡金,返还开卡金,返还所需积分,返还状态,返还时间,录入人").Split(',');
- for (int i = 0; i < StrColumns.Length; i++)
- {
- DataColumn dc = new DataColumn(StrColumns[i].Trim());
- dt.Columns.Add(dc);
- }
- }
- this.dt.Rows.Clear();
- for (int i = 0; i < tbl1.Rows.Count; i++)
- {
- DataRow dr = dt.NewRow();
- int CurrentPoints = 0;
- if (StrPointsType == "AvailablePoints")
- {
- if (!string.IsNullOrEmpty(tbl1.Rows[i]["Mcps_AvailablePoints"].ToString()))
- { CurrentPoints = Convert.ToInt32(tbl1.Rows[i]["Mcps_AvailablePoints"]); }
- }
- else if (StrPointsType == "HistoricalPoints")
- {
- if (!string.IsNullOrEmpty(tbl1.Rows[i]["Mcps_TotalPoints"].ToString()))
- { CurrentPoints = Convert.ToInt32(tbl1.Rows[i]["Mcps_TotalPoints"]); }
- }
- dr["会员编号"] = Convert.ToString(tbl1.Rows[i]["Mcpm_Number"].ToString());
- dr["会员卡号"] = Convert.ToString(tbl1.Rows[i]["会员卡号"].ToString());
- dr["客户姓名"] = Convert.ToString(tbl1.Rows[i]["姓名"].ToString());
- dr["客户电话"] = Convert.ToString(tbl1.Rows[i]["电话"].ToString());
- dr["会员类型"] = Convert.ToString(tbl1.Rows[i]["类型"].ToString());
- dr["所需开卡金"] = Convert.ToString(tbl1.Rows[i]["Mcpm_UpgradeAoumnt"].ToString());
- dr["返还开卡金"] = Convert.ToString(tbl1.Rows[i]["Mcpm_BackAoumnt"].ToString());
- dr["返还所需积分"] = Convert.ToString(CurrentPoints + "/" + tbl1.Rows[i]["Mcpm_UpgradePoints"].ToString());
- string strBackStatus = "未达条件";
- if (CurrentPoints >= Convert.ToInt32(tbl1.Rows[i]["Mcpm_UpgradePoints"]))
- {
- if (tbl1.Rows[i]["Mcpm_BackStatus"].ToString() == "0")
- { strBackStatus = "未返"; }
- else
- { strBackStatus = "已返"; }
- }
- dr["返还状态"] = Convert.ToString(strBackStatus);
- dr["返还时间"] = Convert.ToString(LYFZ.Command.Command_Validate.DateTimeToString(tbl1.Rows[i]["Mcpm_BackDatetime"].ToString()));
- dr["录入人"] = Convert.ToString(tbl1.Rows[i]["Mcpm_CreateName"].ToString());
- dt.Rows.Add(dr);
- }
- this.dgvData1.DataSource(dt, strHideField: "会员编号");
- PublicQueryCount++;
- this.model = null;
- }
- /// <summary>
- /// 获取状态数据
- /// </summary>
- /// <param name="dgvData"></param>
- /// <param name="StrStatus"></param>
- private void GetStatusData(LYFZ.ComponentLibrary.DataGridViewEc dgvData, string StrStatus)
- {
- DataTable tbl = new DataTable();
- for (int i = 0; i < dt.Columns.Count; i++)
- {
- DataColumn dc = new DataColumn(dt.Columns[i].ToString().Trim());
- tbl.Columns.Add(dc);
- }
- if (dt.Rows.Count > 0)
- {
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- if (dt.Rows[i]["返还状态"].ToString().Trim() == StrStatus || StrStatus == "全部")
- {
- DataRow dr = tbl.NewRow();
- for (int j = 0; j < dt.Columns.Count; j++)
- {
- dr[j] = Convert.ToString(dt.Rows[i][j].ToString().Trim());
- }
- tbl.Rows.Add(dr);
- }
- }
- }
- dgvData.DataSource(tbl, strHideField: "");
- }
- }
- }
|