123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- 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<Control> hideControls = new List<Control>();
- hideControls.Add(btnTexting);
- LYFZ.Software.MainBusiness.VersionControl.StaticVersion.BindVersionShowHideControl(VersionControl.VersionFunctionEnum.短信管理医院跟踪短信, hideControls, null, null);
- }
- /// <summary>
- /// 选择复选框事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void radioButtonEx3_CheckedChanged(object sender, EventArgs e)
- {
- if (this.radioButtonEx3.Checked == true)
- {
- this.radioButtonEx3.Checked = true;
- this.radioButtonEx1.Checked = false;
- this.radioButtonEx2.Checked = false;
- }
- }
- /// <summary>
- /// 选择复选框事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void radioButtonEx2_CheckedChanged(object sender, EventArgs e)
- {
- if (radioButtonEx2.Checked == true)
- {
- this.radioButtonEx2.Checked = true;
- this.radioButtonEx1.Checked = false;
- this.radioButtonEx3.Checked = false;
- }
- }
- /// <summary>
- /// 选择复选框事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void radioButtonEx1_CheckedChanged(object sender, EventArgs e)
- {
- if (radioButtonEx1.Checked == true)
- {
- this.radioButtonEx1.Checked = true;
- this.radioButtonEx2.Checked = false;
- this.radioButtonEx3.Checked = false;
- }
- }
- /// <summary>
- /// 双击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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(); }
- }
- }
- /// <summary>
- /// 关闭窗体
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnClose_Click(object sender, EventArgs e)
- {
- if (MessageBoxCustom.Show("你确定要关闭吗?", "关闭提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- { this.Close(); }
- }
- /// <summary>
- /// 导出按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnExport_Click(object sender, EventArgs e)
- {
- if (this.dgvTrack.Rows.Count > 0)
- { this.dgvTrack.ExportDataTable(); }
- }
- /// <summary>
- /// 短信规则设置按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnSmsRules_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.SMSManagement.frmSMSTemplateSet frm = new LYFZ.Software.MainBusiness.SMSManagement.frmSMSTemplateSet();
- frm.Show();
- }
- /// <summary>
- /// 发短信按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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();
- }
- /// <summary>
- /// 查询按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void bntSelect_Click(object sender, EventArgs e)
- { this.PublicFunctionRows(); }
- /// <summary>
- /// 窗体加载时
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void MessagesTracking_Load(object sender, EventArgs e)
- { this.PublicFunctionRows(); }
- /// <summary>
- /// 创建行
- /// </summary>
- private void PublicFunctionRows()
- {
- this.UcPagerEx1.PageCurrent = 1;
- this.UcPagerEx1.PageSize = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPageSize();//3;分页条数
- this.UcPagerEx1.Bind();
- }
- /// <summary>
- /// 分页数据
- /// </summary>
- /// <param name="e"></param>
- /// <returns></returns>
- 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;
- }
- /// <summary>
- /// 查询条件
- /// </summary>
- /// <returns></returns>
- 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;
- }
- }
- }
|