123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 |
- 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 TodayReminded : LYFZ.Software.UI.HospitalTrackingSystem.TodayReminded
- {
- string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_ErpHospitalContactRecord ambll = new BLL.BLL_ErpHospitalContactRecord();
- public TodayReminded()
- {
- this.Load += TodayReminded_Load;
- this.Shown += TodayReminded_Shown;
- this.ucPagerEx1.EventPaging += ucPagerEx1_EventPaging;
- this.btnselect.Click += btnselect_Click;
- this.btnRemind.Click += btnRemind_Click;
- this.btnTexting.Click += btnTexting_Click;
- this.btnExport.Click += btnExport_Click;
- this.btnClose.Click += btnClose_Click;
- this.btnWhole.Click += btnWhole_Click;
- this.dgvRemind.CellDoubleClick += dgvRemind_CellDoubleClick;
- this.btnRemind.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.HospitalTrackingSystem, CustomAttributes.OperatingAuthority.CancelRemindedSet);
- 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 TodayReminded_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);
- }
- public TodayReminded(string p)
- : this()
- {
- ShowType = p;
- }
- /// <summary>
- /// 是否弹屏提示:“AutoShow” 为判断
- /// </summary>
- string ShowType = "";
- DataTable dt_RemindSet = new DataTable();
- /// <summary>
- /// 窗体加载时
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void TodayReminded_Load(object sender, EventArgs e)
- {
- if (ShowType == "AutoShow")
- {
- if (this.GetRemindCount() <= 0)
- {
- this.IsShadow = false;
- this.Close();
- return;
- }
- this.IsShowUcNavigationTool = false;
- }
- dt_RemindSet = orbll.GetView_Custom("tb_ErpHospitalRemindSettings", StrWhere: "", ShowColumnName: "Hrs_RemindName,Hrs_RemindDays,Hrs_RemindConditions,Hrs_StartState").Tables[0];
- this.datebing.DateValue = SDateTime.Now.ToString("yyyy-MM-dd");
- this.dateEnd.DateValue = SDateTime.Now.ToString("yyyy-MM-dd");
- this.PublicFunctionRows_Show();
- }
- /// <summary>
- /// 双击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dgvRemind_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
- {
- if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
- {
- if (this.dgvRemind.Rows.Count > 0)
- {
- if (this.dgvRemind.CurrentRow != null)
- {
- if (this.dgvRemind.CurrentRow.Index >= 0 && this.dgvRemind.CurrentCell.ColumnIndex >= 0)
- {
- IntentionsEntered frm = new IntentionsEntered();
- if (this.dgvRemind.SelectedRows != null && this.dgvRemind.SelectedRows.Count > 0)
- {
- frm.StrOrdNumber = this.dgvRemind.CurrentRow.Cells["来单批号"].Value.ToString();
- frm.Owner = this;
- frm.ShowDialog();
- }
- }
- }
- }
- }
- }
- /// <summary>
- /// 查看全部按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnWhole_Click(object sender, EventArgs e)
- {
- this.ucPagerEx1.Visible = false;
- this.PublicFunctionRows_Show();
- }
- /// <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.dgvRemind.Rows.Count > 0)
- { this.dgvRemind.ExportDataTable(); }
- else
- {
- MessageBoxCustom.Show("没有数据可导出");
- return;
- }
- }
- /// <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 (dgvRemind.SelectedRows == null || dgvRemind.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 < dgvRemind.SelectedRows.Count; i++)
- {
- User_Telephone = dgvRemind.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 (dgvRemind.SelectedRows.Count == 1)
- { MessageBoxCustom.Show("手机号无效:" + ret); return; }
- }
- }
- sendSms.Phone = Sj1.Trim(',');
- sendSms.ShowDialog();
- }
- /// <summary>
- /// 取消提醒按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnRemind_Click(object sender, EventArgs e)
- {
- DateTime strTime = SDateTime.Now;
- if (dgvRemind.SelectedRows == null || dgvRemind.SelectedRows.Count == 0)
- { MessageBoxCustom.Show("请选择要取消提醒的数据!"); }
- else
- {
- if(string.IsNullOrEmpty(dgvRemind.CurrentRow.Cells["ID"].Value.ToString()))
- {
- MessageBoxCustom.Show("未添加跟踪记录,请添加跟踪记录并设置下次提醒时间");
- return;
- }
- LYFZ.Model.Model_ErpHospitalContactRecord model = ambll.GetModel(Convert.ToInt32(dgvRemind.CurrentRow.Cells["ID"].Value.ToString()));
- model.Hcr_RemindTime = LYFZ.WinAPI.CustomPublicMethod.GetNullDateTime();
- model.Hcr_UpdateName = strUserID;
- model.Hcr_UpdateDatetime = strTime;
- if (ambll.Update(model))
- {
- MessageBoxCustom.Show("取消提醒成功");
- this.PublicFunctionRows_Show();
- }
- else
- { MessageBoxCustom.Show("取消提醒失败"); }
- }
- }
- /// <summary>
- /// 查询按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnselect_Click(object sender, EventArgs e)
- {
- this.ucPagerEx1.Visible = true;
- this.PublicFunctionRows_Show();
- }
- /// <summary>
- /// 创建行
- /// </summary>
- private void PublicFunctionRows_Show()
- {
- 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)
- {
- #region 获取查询条件
- //string StrWhere = "";
- //StrWhere += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime("提醒时间查询", this.datebing.DateValue.Trim(), this.dateEnd.DateValue.Trim(), ConnectWord: "");
- //if (this.dt_RemindSet.Rows.Count > 0)
- //{
- // string StrSQL = "";
- // DataRow[] dtRow1 = dt_RemindSet.Select("(Hrs_RemindConditions = '0' or Hrs_RemindConditions = '1') And Hrs_StartState = '0' ");
- // for (int i = 0; i < dtRow1.Length; i++)
- // { StrSQL += dtRow1[i]["Hrs_RemindDays"] + ","; }
- // if (!string.IsNullOrEmpty(StrSQL.TrimEnd(',')))
- // { StrWhere += " or 宝宝天数 in (" + StrSQL.TrimEnd(',') + ")"; }
- //}
- //StrWhere = "(" + StrWhere + ")";
- #endregion
- DataTable dt = new DataTable();
- LYFZ.UCPager.PageData pageData = new LYFZ.UCPager.PageData();
- pageData.TableName = "View_HospitalRemindedToday";
- pageData.PageIndex = this.ucPagerEx1.PageCurrent;
- pageData.PageSize = this.ucPagerEx1.PageSize;
- pageData.QueryCondition = GetWhere(this.datebing.DateValue.Trim(), this.dateEnd.DateValue.Trim());
- 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.dgvRemind.DataSource(dt, strHideField: strHideField); }
- catch
- { }
- try
- {
- this.ucPagerEx1.TbDataSource = dt;
- }
- catch { }
- this.dgvRemind.ClearSelection();
- return pageData.TotalCount;
- }
- string GetWhere(string datebing, string dateEnd)
- {
- string StrWhere = "";
- StrWhere += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime("提醒时间查询", datebing, dateEnd, ConnectWord: "");
- //StrWhere += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime("提醒时间查询", SDateTime.Now.ToString("yyyy-MM-dd"), SDateTime.Now.ToString("yyyy-MM-dd"), ConnectWord: "");
- if (this.dt_RemindSet.Rows.Count > 0)
- {
- string StrSQL = "";
- DataRow[] dtRow1 = dt_RemindSet.Select("(Hrs_RemindConditions = '0' or Hrs_RemindConditions = '1') And Hrs_StartState = '0' ");
- for (int i = 0; i < dtRow1.Length; i++)
- { StrSQL += dtRow1[i]["Hrs_RemindDays"] + ","; }
- if (!string.IsNullOrEmpty(StrSQL.TrimEnd(',')))
- { StrWhere += " or 宝宝天数 in (" + StrSQL.TrimEnd(',') + ")"; }
- }
- StrWhere = "(" + StrWhere + ")";
- return StrWhere;
- }
- int GetRemindCount()
- {
- //string StrWhere = "";
- //StrWhere += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime("提醒时间查询", SDateTime.Now.ToString("yyyy-MM-dd"), SDateTime.Now.ToString("yyyy-MM-dd"), ConnectWord: "");
- //if (this.dt_RemindSet.Rows.Count > 0)
- //{
- // string StrSQL = "";
- // DataRow[] dtRow1 = dt_RemindSet.Select("(Hrs_RemindConditions = '0' or Hrs_RemindConditions = '1') And Hrs_StartState = '0' ");
- // for (int i = 0; i < dtRow1.Length; i++)
- // { StrSQL += dtRow1[i]["Hrs_RemindDays"] + ","; }
- // if (!string.IsNullOrEmpty(StrSQL.TrimEnd(',')))
- // { StrWhere += " or 宝宝天数 in (" + StrSQL.TrimEnd(',') + ")"; }
- //}
- //StrWhere = "(" + StrWhere + ")";
- DataTable dt = orbll.GetView_Custom("View_HospitalRemindedToday", StrWhere: GetWhere(SDateTime.Now.ToString("yyyy-MM-dd"), SDateTime.Now.ToString("yyyy-MM-dd")), ShowColumnName: "Count(*) AS CountID").Tables[0];
- return Convert.ToInt32(dt.Rows[0]["CountID"]);
- }
- }
- }
|