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.HospitalTrackingSystem { public partial class MessagesTracking : LYFZ.Software.UI.HospitalTrackingSystem.MessagesTracking { public MessagesTracking() { this.Load += MessagesTracking_Load; this.Shown += MessagesTracking_Shown; this.bntSelect.Click += bntSelect_Click; this.btnTexting.Click += btnTexting_Click; this.btnSmsRules.Click += btnSmsRules_Click; this.btnExport.Click += btnExport_Click; this.btnClose.Click += btnClose_Click; this.ucPagerEx1.EventPaging += ucPagerEx1_EventPaging; this.dgvTrack.CellDoubleClick += dgvTrack_CellDoubleClick; this.radioButtonEx1.CheckedChanged += radioButtonEx1_CheckedChanged; this.radioButtonEx2.CheckedChanged += radioButtonEx2_CheckedChanged; this.radioButtonEx3.CheckedChanged += radioButtonEx3_CheckedChanged; this.btnTexting.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.HospitalTrackingSystem, CustomAttributes.OperatingAuthority.SMSSend); this.btnExport.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.HospitalTrackingSystem, CustomAttributes.OperatingAuthority.DataExport); } void MessagesTracking_Shown(object sender, EventArgs e) { bool b = LYFZ.Software.MainBusiness.VersionControl.StaticVersion.UIFunctionVersion( VersionControl.VersionFunctionEnum.医院跟踪系统跟踪短信); if (!b) { this.Close(); } List hideControls = new List(); hideControls.Add(btnTexting); LYFZ.Software.MainBusiness.VersionControl.StaticVersion.BindVersionShowHideControl(VersionControl.VersionFunctionEnum.短信管理医院跟踪短信, hideControls, null, null); } /// /// 选择复选框事件 /// /// /// void radioButtonEx3_CheckedChanged(object sender, EventArgs e) { if (this.radioButtonEx3.Checked == true) { this.radioButtonEx3.Checked = true; this.radioButtonEx1.Checked = false; this.radioButtonEx2.Checked = false; } } /// /// 选择复选框事件 /// /// /// void radioButtonEx2_CheckedChanged(object sender, EventArgs e) { if (radioButtonEx2.Checked == true) { this.radioButtonEx2.Checked = true; this.radioButtonEx1.Checked = false; this.radioButtonEx3.Checked = false; } } /// /// 选择复选框事件 /// /// /// void radioButtonEx1_CheckedChanged(object sender, EventArgs e) { if (radioButtonEx1.Checked == true) { this.radioButtonEx1.Checked = true; this.radioButtonEx2.Checked = false; this.radioButtonEx3.Checked = false; } } /// /// 双击事件 /// /// /// void dgvTrack_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (this.dgvTrack.SelectedRows != null && this.dgvTrack.SelectedRows.Count > 0) { IntentionsEntered frm = new IntentionsEntered(); frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual; frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y); frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height); frm.StrOrdNumber = this.dgvTrack.CurrentRow.Cells["来单批号"].Value.ToString(); frm.Owner = this; frm.ShowDialog(); if (frm.IsSaveed) { this.PublicFunctionRows(); } } } /// /// 关闭窗体 /// /// /// void btnClose_Click(object sender, EventArgs e) { if (MessageBoxCustom.Show("你确定要关闭吗?", "关闭提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { this.Close(); } } /// /// 导出按钮 /// /// /// void btnExport_Click(object sender, EventArgs e) { if (this.dgvTrack.Rows.Count > 0) { this.dgvTrack.ExportDataTable(); } } /// /// 短信规则设置按钮 /// /// /// void btnSmsRules_Click(object sender, EventArgs e) { LYFZ.Software.MainBusiness.SMSManagement.frmSMSTemplateSet frm = new LYFZ.Software.MainBusiness.SMSManagement.frmSMSTemplateSet(); frm.Show(); } /// /// 发短信按钮 /// /// /// void btnTexting_Click(object sender, EventArgs e) { LYFZ.Software.UI.SMSManagement.SmsSend.FrmSendSms frm = new UI.SMSManagement.SmsSend.FrmSendSms(); if (dgvTrack.SelectedRows == null || dgvTrack.SelectedRows.Count == 0) { MessageBoxCustom.Show("请选择要发送短信的客人!"); return; } string Sj1 = ""; string User_Telephone = ""; LYFZ.Software.MainBusiness.SMSManagement.SmsSend.FrmSendSms sendSms = new SMSManagement.SmsSend.FrmSendSms(); for (int i = 0; i < dgvTrack.SelectedRows.Count; i++) { User_Telephone = dgvTrack.SelectedRows[i].Cells["本人手机"].Value.ToString(); //检查手机合法性 if (!string.IsNullOrEmpty(User_Telephone)) { string ret = LYFZ.WinAPI.CustomPublicMethod.ValidationPhones(User_Telephone); if (ret.Trim().Length <= 0) { Sj1 += User_Telephone + ","; } else if (dgvTrack.SelectedRows.Count == 1) { MessageBoxCustom.Show("手机号无效:" + ret); return; } } } sendSms.Phone = Sj1.Trim(','); sendSms.ShowDialog(); } /// /// 查询按钮 /// /// /// void bntSelect_Click(object sender, EventArgs e) { this.PublicFunctionRows(); } /// /// 窗体加载时 /// /// /// void MessagesTracking_Load(object sender, EventArgs e) { this.PublicFunctionRows(); } /// /// 创建行 /// private void PublicFunctionRows() { this.UcPagerEx1.PageCurrent = 1; this.UcPagerEx1.PageSize = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPageSize();//3;分页条数 this.UcPagerEx1.Bind(); } /// /// 分页数据 /// /// /// int ucPagerEx1_EventPaging(UCPager.EventPagingArg e) { DataTable dt = new DataTable(); LYFZ.UCPager.PageData pageData = new LYFZ.UCPager.PageData(); pageData.TableName = "View_HospitalContact"; pageData.PageIndex = this.UcPagerEx1.PageCurrent; pageData.PageSize = this.UcPagerEx1.PageSize; pageData.QueryCondition = GetWhereStr(); pageData.QueryFieldName = "ID,来单批号,客户姓名,宝宝姓名,宝宝性别,生日类型,[宝宝生日/预产期],宝宝年龄,宝宝天数,是否农历,怀孕天数,本人手机,老公姓名,老公手机,发送来单短信,喂养方式,客户区域,客户类别,订单客户,业务种类,业务意向,来单医院,门市,备注,录入时间,录入时间查询"; pageData.OrderStr = "ID"; pageData.OrderType = 1; string strHideField = "ID,录入时间查询,订单客户"; LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker) { dt = pageData.QueryDataTable().Tables[0]; }); try { this.dgvTrack.DataSource(dt, strHideField: strHideField); } catch { } try { this.UcPagerEx1.TbDataSource = dt; } catch { } this.dgvTrack.ClearSelection(); return pageData.TotalCount; } /// /// 查询条件 /// /// private string GetWhereStr() { string StrWhere = " 1=1 "; string StrteBind = this.numericUpDown1.Value.ToString(); string StrteEnd = this.numericUpDown2.Value.ToString(); string StrQ = "怀孕天数"; string StrN = "宝宝年龄"; string StrD = "宝宝天数"; if (this.radioButtonEx1.Checked == true) { if (StrteBind != "" && StrteEnd != "") { StrWhere += " and (" + StrD + " between '" + StrteBind + "' and '" + StrteEnd + "' ) "; } } if (this.radioButtonEx2.Checked == true) { if (StrteBind != "" && StrteEnd != "") { StrWhere += " and (" + StrN + " between '" + StrteBind + "' and '" + StrteEnd + "' ) "; } } if (this.radioButtonEx3.Checked == true) { if (StrteBind != "" && StrteEnd != "") { StrWhere += " and (" + StrQ + " between '" + StrteBind + "' and '" + StrteEnd + "' ) "; } } return StrWhere; } } }