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 hideControls = new List(); hideControls.Add(btnTexting); LYFZ.Software.MainBusiness.VersionControl.StaticVersion.BindVersionShowHideControl(VersionControl.VersionFunctionEnum.短信管理医院跟踪短信, hideControls, null, null); } public TodayReminded(string p) : this() { ShowType = p; } /// /// 是否弹屏提示:“AutoShow” 为判断 /// string ShowType = ""; DataTable dt_RemindSet = new DataTable(); /// /// 窗体加载时 /// /// /// 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(); } /// /// 双击事件 /// /// /// 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(); } } } } } } /// /// 查看全部按钮 /// /// /// void btnWhole_Click(object sender, EventArgs e) { this.ucPagerEx1.Visible = false; this.PublicFunctionRows_Show(); } /// /// 关闭 /// /// /// 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.dgvRemind.Rows.Count > 0) { this.dgvRemind.ExportDataTable(); } else { MessageBoxCustom.Show("没有数据可导出"); return; } } /// /// 发短信按钮 /// /// /// 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(); } /// /// 取消提醒按钮 /// /// /// 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("取消提醒失败"); } } } /// /// 查询按钮 /// /// /// void btnselect_Click(object sender, EventArgs e) { this.ucPagerEx1.Visible = true; this.PublicFunctionRows_Show(); } /// /// 创建行 /// private void PublicFunctionRows_Show() { this.ucPagerEx1.PageCurrent = 1; this.ucPagerEx1.PageSize = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPageSize();//3;分页条数 this.ucPagerEx1.Bind(); } /// /// 分页数据 /// /// /// 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"]); } } }