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.StatisticsForm
{
public partial class ServiceItemCountForm : LYFZ.Software.UI.MembershipManage.StatisticsForm.ServiceItemCountForm
{
LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
LYFZ.BLL.BLL_ErpSystemConfigure cgbll = new BLL.BLL_ErpSystemConfigure();
public ServiceItemCountForm()
{
this.Load += ServiceItemCountForm_Load;
this.Shown += ServiceItemCountForm_Shown;
this.btnQuery.Click += btnQuery_Click;
this.btnSet.Click += btnSet_Click;
this.btnClose.Click += btnClose_Click;
this.txtServiceItemCount.KeyPress += txtServiceItemCount_KeyPress;
}
///
/// 窗体加载事件
///
///
///
void ServiceItemCountForm_Load(object sender, EventArgs e)
{
DataTable tbl = cgbll.GetList("Sconfig_Code in ('MemberServiceItemCount')").Tables[0];
if (tbl.Rows.Count > 0)
{
switch (tbl.Rows[0]["Sconfig_Code"].ToString().Trim())
{
case "MemberServiceItemCount":
this.txtServiceItemCount.Text = tbl.Rows[0]["Sconfig_Value"].ToString().Trim();
break;
}
}
else
{ this.txtServiceItemCount.Text = "0"; }
}
///
/// 窗体加载事件
///
///
///
void ServiceItemCountForm_Shown(object sender, EventArgs e)
{
this.btnQuery_Click(this, null);
}
///
/// 查询
///
///
///
void btnQuery_Click(object sender, EventArgs e)
{
string StrTableName = "tb_ErpMemberCardServiceContent Left Join tb_ErpMemberCard on Mc_Number = Mcse_Number Left Join tb_ErpCustomer on Cus_CustomerNumber = Mc_CustomerNumber";
DataTable dt = orbll.GetView_Custom(StrTableName, StrWhere: "Mcse_ServiceCount <= " + this.txtServiceItemCount.Text.Trim() + "", ShowColumnName: "Mcse_Number AS Ord_Number,Mc_CradNumber AS 会员卡号,Cus_Name AS 姓名,Cus_Telephone AS 电话,Mcse_ServiceContent AS 服务项,Mcse_ServiceCount AS 服务次数", filedOrder: "Mcse_Number,Mcse_ServiceContent,Mcse_ServiceCount").Tables[0];
this.dgvData.StrValueNullColumn = "会员卡号,姓名,电话";
this.dgvData.dgvFixedHideColumn = "Ord_Number";
this.dgvData.DataSource(dt);
}
///
/// 设置
///
///
///
void btnSet_Click(object sender, EventArgs e)
{
LYFZ.Software.MainBusiness.MembershipManage.StatisticsForm.ServiceItemCountSetForm frm = new ServiceItemCountSetForm();
frm.ShowDialog();
if (frm.IsSaveed)
{
this.txtServiceItemCount.Text = frm.StrValue;
this.btnQuery_Click(this, null);
}
}
///
/// 关闭
///
///
///
void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
///
/// 输入限制
///
///
///
void txtServiceItemCount_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
{ e.Handled = true; }
}
}
}