123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- 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 DispatchDoor : LYFZ.Software.UI.HospitalTrackingSystem.DispatchDoor
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_ErpHospitalDispatchDoor ambll = new BLL.BLL_ErpHospitalDispatchDoor();
- public DispatchDoor()
- {
- this.Load += DispatchDoor_Load;
- this.dgvData.CellDoubleClick += dgvData_CellDoubleClick;
- this.btnDelete.Click += btnDelete_Click;
- this.btnAdding.Click += btnAdding_Click;
- this.btnUpdate.Click += btnUpdate_Click;
- this.btnOK.Click += btnOK_Click;
- this.btnAdding.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.HospitalTrackingSystem, CustomAttributes.OperatingAuthority.AddSendSingleTask);
- this.btnDelete.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.HospitalTrackingSystem, CustomAttributes.OperatingAuthority.DelSendSingleTask);
- this.btnUpdate.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.HospitalTrackingSystem, CustomAttributes.OperatingAuthority.UpdateSendSingleTask);
- }
- Model.CameraTimeTemplate currentSelectCameraTime = null;
- /// <summary>
- /// 当前选择的档期
- /// </summary>
- public Model.CameraTimeTemplate CurrentSelectCameraTime { get => currentSelectCameraTime; set => currentSelectCameraTime = value; }
- /// <summary>
- /// 订单号
- /// </summary>
- public string StrOrderNumber;
- /// <summary>
- /// 是否保存
- /// </summary>
- public bool IsSaveed = false;
- /// <summary>
- /// 选择的ID
- /// </summary>
- public int SelectID = 0;
- /// <summary>
- /// 窗体加载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void DispatchDoor_Load(object sender, EventArgs e)
- {
- this.dgvData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.HidePhoneControls(this.txtMyselfPhone);
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.HidePhoneControls(this.txtHusbandPhone);
- IntentionsEntered frm = new IntentionsEntered();
- this.txtNumber.Text = StrOrderNumber;
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- DataTable dt = orbll.GetView_Custom("View_HospitalContact", StrWhere: "来单批号='" + StrOrderNumber + "'", ShowColumnName: "来单批号,客户姓名,本人手机,老公手机,客户区域,宝宝姓名,宝宝年龄,业务意向").Tables[0];
- this.txtName.Text = dt.Rows[0]["客户姓名"].ToString();
- this.txtMyselfPhone.Text = dt.Rows[0]["本人手机"].ToString();
- this.txtHusbandPhone.Text = dt.Rows[0]["老公手机"].ToString();
- this.txtAreas.Text = dt.Rows[0]["客户区域"].ToString();
- this.txtBabyName.Text = dt.Rows[0]["宝宝姓名"].ToString();
- this.txtBabyAge.Text = dt.Rows[0]["宝宝年龄"].ToString();
- this.txtBusinessType.Text = dt.Rows[0]["业务意向"].ToString();
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 双击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dgvData_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
- {
- if (this.dgvData.SelectedRows != null && this.dgvData.SelectedRows.Count > 0)
- { this.btnUpdate_Click(this, e); }
- // this.btnOK_Click(this, null);
- }
- /// <summary>
- /// 删除按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnDelete_Click(object sender, EventArgs e)
- {
- if (this.dgvData.Rows.Count > 0 && this.dgvData.SelectedRows.Count > 0)
- {
- if (this.dgvData.CurrentRow != null)
- {
- if (this.dgvData.SelectedRows.Count > 0)
- {
- if (MessageBoxCustom.Show("你确定要删除吗?", "删除提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- if (ambll.Delete(Convert.ToInt32(dgvData.CurrentRow.Cells["ID"].Value)))
- {
- this.IsSaveed = true;
- MessageBoxCustom.Show("删除成功!");
- this.PublicFunctionRows();
- }
- else
- { MessageBoxCustom.Show("删除失败!"); }
- }
- }
- }
- }
- else
- { MessageBoxCustom.Show("请选择要删除的数据!"); }
- }
- /// <summary>
- /// 添加派单
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnAdding_Click(object sender, EventArgs e)
- {
- if (this.txtNumber.Text != "")
- {
- AddingSendSingle frm = new AddingSendSingle();
- frm.StrOrderNumber = this.StrOrderNumber;
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- this.IsSaveed = true;
- this.PublicFunctionRows();
- }
- }
- else
- { MessageBoxCustom.Show("请选择客户进行添加!"); }
- }
- /// <summary>
- /// 修改派单
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnUpdate_Click(object sender, EventArgs e)
- {
- AddingSendSingle frm = new AddingSendSingle();
- frm.TeskRow = this.dgvData.CurrentRow;
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- this.IsSaveed = true;
- this.PublicFunctionRows();
- }
- }
- /// <summary>
- /// 确定
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnOK_Click(object sender, EventArgs e)
- {
- if (this.dgvData.SelectedRows.Count > 0)
- {
- this.IsSaveed = true;
- this.SelectID = Convert.ToInt32(this.dgvData.SelectedRows[0].Cells["ID"].Value);
- this.Close();
- }
- else
- { MessageBoxCustom.Show("请选择派单数据!"); }
- }
- /// <summary>
- /// 创建行
- /// </summary>
- private void PublicFunctionRows()
- {
- string StrColumnName = "ID,dbo.fn_CheckDateTimeReturn_Date(dbo.fn_CheckDateTime(Hdr_DoorTime)) as 上门日期,Hdr_DoorPeriod as 上门时间,case when Hdr_HomeState = 0 then '未上门' else 'OK' end as 上门状态," +
- "Hdr_DoorPersonOne as 上门人员1,Hdr_DoorPersonTwo as 上门人员2,Hdr_DoorPersonThree as 上门人员3,Hdr_DoorPersonFour as 上门人员4,Hdr_Vehicle as 车辆,Hdr_DispatchDoorRemark AS 备注";
- DataTable dt = orbll.GetView_Custom("tb_ErpHospitalDispatchDoor", StrWhere: "Hdr_Number = '" + this.txtNumber.Text.Trim() + "'", ShowColumnName: StrColumnName).Tables[0];
- this.dgvData.DataSource(dt, strHideField: "ID");
- this.dgvData.ClearSelection();
- }
- }
- }
|