123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- 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.CameraControlBook.SuperSmallForm
- {
- public partial class AddClientServiceExecTaskSuperSmallForm : LYFZ.Software.UI.CameraControlBook.SuperSmallForm.AddClientServiceExecTaskSuperSmallForm
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_ErpCustomersTrackRecord ctrbll = new BLL.BLL_ErpCustomersTrackRecord();
- public AddClientServiceExecTaskSuperSmallForm()
- {
- this.Load += AddClientServiceExecTaskSuperSmallForm_Load;
- this.Shown += AddClientServiceExecTaskSuperSmallForm_Shown;
- this.btnSaveed.Click += btnSaveed_Click;
- this.btnCancel.Click += btnCancel_Click;
- this.btnSet.Click += btnSet_Click;
- this.cmbtreevClientName.ComboBoxTree_NodeMouseClick += cmbtreevClientName_ComboBoxTree_NodeMouseClick;
- this.txtLength.KeyPress += txtLength_KeyPress;
- }
- /// <summary>
- /// 任务类型
- /// </summary>
- public string StrTaskType = "";
- /// <summary>
- /// 任务项目
- /// </summary>
- public string StrTaskItem = "";
- /// <summary>
- /// 任务编号
- /// </summary>
- public string StrTaskNumber = "";
- /// <summary>
- /// 客户组编号
- /// </summary>
- public string StrClientGroupNumber = "";
- /// <summary>
- /// 客户编号
- /// </summary>
- public string StrClientNumber = "";
- /// <summary>
- /// 医院编号
- /// </summary>
- public string StrHospitalNumber = "";
- /// <summary>
- /// 任务完成时间
- /// </summary>
- public string StrClientServiceDateTime = "";
- /// <summary>
- /// 任务完成说明
- /// </summary>
- public string StrCompletionRemark = "";
- /// <summary>
- /// 是否保存
- /// </summary>
- public bool IsSaveed = false;
- /// <summary>
- /// 当前登录者的ID
- /// </summary>
- string StrUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void AddClientServiceExecTaskSuperSmallForm_Load(object sender, EventArgs e)
- {
- this.dtDateTime.DateValue = SDateTime.Now.ToString("yyyy-MM-dd");
- #region 获取客户数据
- DataTable tbl = new DataTable();
- if (!string.IsNullOrEmpty(this.StrClientGroupNumber))
- { tbl = orbll.GetView_Custom("tb_ErpCustomerGroupMembers left join tb_ErpCustomer on Cus_CustomerNumber=GM_CustomerID", StrWhere: "GM_CustomerGroupID='" + this.StrClientGroupNumber + "'", ShowColumnName: "Cus_Name,Cus_CustomerNumber,Cus_Telephone,GM_Master,GM_ProtagonistCustomer,GM_Relation").Tables[0]; }
- else if (!string.IsNullOrEmpty(this.StrClientNumber))
- { tbl = orbll.GetView_Custom("tb_ErpCustomer", StrWhere: "Cus_CustomerNumber='" + this.StrClientNumber + "'", ShowColumnName: "Cus_CustomerNumber,Cus_Name,Cus_Telephone").Tables[0]; }
- else if (!string.IsNullOrEmpty(this.StrHospitalNumber))
- {
- DataTable dt = orbll.GetView_Custom("tb_ErpHospitalClient", StrWhere: "Hct_Oddnumber = '" + this.StrHospitalNumber + "'", ShowColumnName: "*").Tables[0];
- if (dt.Rows.Count > 0)
- {
- System.Windows.Forms.TreeNode root = new System.Windows.Forms.TreeNode();
- root.Text = dt.Rows[0]["Hct_CustomerName"].ToString().Trim();
- root.Tag = dt.Rows[0]["Hct_CustomerName"].ToString().Trim();
- root.Name = dt.Rows[0]["Hct_MyselfMobile"].ToString().Trim();
- this.cmbtreevClientName.Nodes.Add(root);
- this.cmbtreevClientName.TagFindText(dt.Rows[0]["Hct_CustomerName"].ToString().Trim());
- this.txtClientTelephone.Text = dt.Rows[0]["Hct_MyselfMobile"].ToString().Trim();
- this.cmbtreevClientName.Enabled = false;
- this.txtClientTelephone.Enabled = false;
- }
- }
- if (tbl.Rows.Count > 0)
- {
- System.Windows.Forms.TreeNode root = null;
- if (StrClientGroupNumber != "")
- {
- string StrCurrentClientNumber = "";
- for (int i = 0; i < tbl.Rows.Count; i++)
- {
- if (tbl.Rows[i]["GM_Master"].ToString().Trim() == "0" && tbl.Rows[i]["GM_ProtagonistCustomer"].ToString() == "1" && tbl.Rows[i]["GM_Relation"].ToString() == "本人")
- { continue; }
- if (StrCurrentClientNumber == "")
- { StrCurrentClientNumber = tbl.Rows[i]["Cus_CustomerNumber"].ToString().Trim(); }
- root = new System.Windows.Forms.TreeNode();
- root.Text = tbl.Rows[i]["Cus_Name"].ToString();
- root.Tag = tbl.Rows[i]["Cus_CustomerNumber"].ToString();
- root.Name = tbl.Rows[i]["Cus_Telephone"].ToString();
- this.cmbtreevClientName.Nodes.Add(root);
- }
- this.cmbtreevClientName.TagFindText(StrCurrentClientNumber);
- }
- else
- {
- root = new System.Windows.Forms.TreeNode();
- root.Text = tbl.Rows[0]["Cus_Name"].ToString();
- root.Tag = tbl.Rows[0]["Cus_CustomerNumber"].ToString();
- root.Name = tbl.Rows[0]["Cus_Telephone"].ToString();
- this.cmbtreevClientName.Nodes.Add(root);
- this.cmbtreevClientName.TagFindText(this.StrClientNumber);
- }
- this.txtClientTelephone.Text = this.cmbtreevClientName.StrGetName;
- }
- #endregion
- }
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void AddClientServiceExecTaskSuperSmallForm_Shown(object sender, EventArgs e)
- {
- this.txtTaskType.Text = this.StrTaskType;
- this.txtTaskItem.Text = this.StrTaskItem;
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("AAAAAAE", this.cmbtreevCommunicateMode);
- }
- /// <summary>
- /// 保存
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnSaveed_Click(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(this.cmbtreevClientName.Text.Trim()))
- { MessageBoxCustom.Show("客户姓名不能为空!"); return; }
- if (string.IsNullOrEmpty(this.dtDateTime.DateValue.Trim()))
- { MessageBoxCustom.Show("沟通时间不能为空!"); return; }
- if (string.IsNullOrEmpty(this.cmbtreevCommunicateMode.Text.Trim()))
- { MessageBoxCustom.Show("沟通方式不能为空!"); return; }
- List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
- DateTime StrTime = SDateTime.Now;
- LYFZ.Model.Model_ErpCustomersTrackRecord model = new Model.Model_ErpCustomersTrackRecord();
- model.TR_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- if (!string.IsNullOrEmpty(this.StrClientGroupNumber))
- { model.TR_CustomerGroupID = this.StrClientGroupNumber; }
- else if (!string.IsNullOrEmpty(this.StrClientNumber))
- { model.TR_CustomerGroupID = this.StrClientNumber; }
- else if (!string.IsNullOrEmpty(this.StrHospitalNumber))
- { model.TR_CustomerGroupID = this.StrHospitalNumber; }
- model.TR_CustomerID = this.cmbtreevClientName.Tag.ToString();
- model.TR_TracePersonID = StrUserID;
- model.TR_TraceDateTime = Convert.ToDateTime(this.dtDateTime.DateValue.Trim());
- model.TR_TraceWay = this.cmbtreevCommunicateMode.Text.Trim().ToString();
- if (this.txtLength.Text.Trim() != "")
- { model.TR_TraceTimeLength = Convert.ToInt32(this.txtLength.Text.Trim()); }
- else
- { model.TR_TraceTimeLength = 0; }
- model.TR_Communicationstatus = "已沟通";
- model.TR_Remark = this.txtRemark.Text.Trim().ToString();
- model.TR_NextRemindTime = LYFZ.WinAPI.CustomPublicMethod.GetNullDateTime();
- model.TR_TraceType = this.txtTaskType.Text.Trim();
- model.TR_SpecificMatters = this.txtTaskItem.Text.Trim();
- model.TR_TraceInputTypes = Convert.ToInt32(Enum.Parse(typeof(LYFZ.EnumPublic.ClientServiceTaskItem), this.StrTaskItem));
- model.TR_CreateDateTime = StrTime;
- model.TR_UpdateDateName = this.StrUserID;
- model.TR_TaskNumber = this.StrTaskNumber;
- clist.Add(ctrbll.GetAddCommandInfo(model));
- if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0)
- {
- this.IsSaveed = true;
- this.StrCompletionRemark = this.txtRemark.Text.Trim();
- this.StrClientServiceDateTime = this.dtDateTime.DateValue.Trim();
- this.Close();
- }
- else
- { MessageBoxCustom.Show("保存失败"); }
- }
- /// <summary>
- /// 关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnCancel_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnSet_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet frm = new InitialSet.FrmSystemSet();
- frm.TypeName = "AAAAAAE";
- frm.Version = "Version";
- if (frm.ShowDialog() == DialogResult.OK)
- { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("AAAAAAE", this.cmbtreevCommunicateMode); }
- }
- /// <summary>
- /// 选择客户给客户电话赋值
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void cmbtreevClientName_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
- {
- this.txtClientTelephone.Text = e.Node.Name;
- }
- /// <summary>
- /// 沟通时长
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtLength_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar != 8 && !Char.IsDigit(e.KeyChar))
- { e.Handled = true; }
- }
- }
- }
|