FrmMissedCall.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. using LYFZ.ComponentLibrary;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. namespace LYFZ.Software.MainBusiness.CallerWizard
  11. {
  12. public partial class FrmMissedCall : LYFZ.Software.UI.CallerWizard.FrmMissedCall
  13. {
  14. LYFZ.BLL.BLL_ErpCallWizard cwbll = new BLL.BLL_ErpCallWizard();
  15. private delegate void UpdateControl();
  16. public FrmMissedCall()
  17. {
  18. this.Shown += FrmMissedCall_Shown;
  19. this.btnQuery.Click += btnQuery_Click;
  20. this.btnDelete.Click += btnDelete_Click;
  21. this.btnClose.Click += btnClose_Click;
  22. this.UcPagerEx1.EventPaging += UcPagerEx1_EventPaging;
  23. }
  24. string strUsrID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  25. /// <summary>
  26. /// 加载数据
  27. /// </summary>
  28. /// <param name="sender"></param>
  29. /// <param name="e"></param>
  30. void FrmMissedCall_Shown(object sender, EventArgs e)
  31. {
  32. this.PublicFunctionRows();
  33. }
  34. /// <summary>
  35. /// 查询
  36. /// </summary>
  37. /// <param name="sender"></param>
  38. /// <param name="e"></param>
  39. void btnQuery_Click(object sender, EventArgs e)
  40. {
  41. this.btnDelete.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.CustomerCallsCompetence, CustomAttributes.OperatingAuthority.Delete);
  42. this.PublicFunctionRows();
  43. }
  44. /// <summary>
  45. /// 删除
  46. /// </summary>
  47. /// <param name="sender"></param>
  48. /// <param name="e"></param>
  49. void btnDelete_Click(object sender, EventArgs e)
  50. {
  51. if (this.dgvData.Rows.Count > 0)
  52. {
  53. if (this.dgvData.CurrentRow == null)
  54. { MessageBoxCustom.Show("请选中你要录音回放的数据!"); return; }
  55. if (this.dgvData.CurrentRow.Index >= 0 && this.dgvData.CurrentCell.RowIndex >= 0)
  56. {
  57. if (!string.IsNullOrEmpty(this.dgvData.CurrentRow.Cells["ID"].Value.ToString().Trim()))
  58. {
  59. if (MessageBoxCustom.Show("您确定删除吗?", "温馨提示!", MessageBoxButtons.YesNo) == DialogResult.No)
  60. { return; }
  61. if (cwbll.Delete(Convert.ToInt32(this.dgvData.CurrentRow.Cells["ID"].Value)))
  62. {
  63. string logsContent = "删除客户来电电话号码:" + this.dgvData.CurrentRow.Cells["电话"].Value.ToString();
  64. LYFZ.BLL.BLL_ErpSystemLogs.WriteSystemLog(LYFZ.EnumPublic.SystemLogsType.删除电话记录, logsContent, LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID, LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name);
  65. MessageBoxCustom.Show("删除成功!"); this.dgvData.Rows.Remove(this.dgvData.CurrentRow);
  66. }
  67. else
  68. { MessageBoxCustom.Show("删除失败!"); }
  69. }
  70. }
  71. }
  72. }
  73. /// <summary>
  74. /// 关闭
  75. /// </summary>
  76. /// <param name="sender"></param>
  77. /// <param name="e"></param>
  78. void btnClose_Click(object sender, EventArgs e)
  79. {
  80. this.Close();
  81. }
  82. /// <summary>
  83. /// 分页前数据,便于展开时用来查询订单的子数据
  84. /// </summary>
  85. DataTable tblMianSelectData = new DataTable();
  86. /// <summary>
  87. /// 创建行
  88. /// </summary>
  89. private void PublicFunctionRows()
  90. {
  91. this.UcPagerEx1.EventPaging -= UcPagerEx1_EventPaging;
  92. this.UcPagerEx1.EventPaging += UcPagerEx1_EventPaging;
  93. this.UcPagerEx1.PageCurrent = 1;
  94. this.UcPagerEx1.PageSize = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPageSize();//3;分页条数
  95. this.UcPagerEx1.Bind();
  96. }
  97. /// <summary>
  98. /// 数据处理与分页
  99. /// </summary>
  100. /// <param name="e"></param>
  101. /// <returns></returns>
  102. int UcPagerEx1_EventPaging(UCPager.EventPagingArg e)
  103. {
  104. LYFZ.UCPager.PageData pageData = new LYFZ.UCPager.PageData();
  105. pageData.TableName = "";
  106. pageData.PageIndex = this.UcPagerEx1.PageCurrent;
  107. pageData.PageSize = this.UcPagerEx1.PageSize;
  108. pageData.QueryCondition = GetWhereStr();
  109. pageData.OrderStr = "";
  110. pageData.OrderType = 1;
  111. this.dgvData.dgvGuidName = LYFZ.EnumPublic.dgvGuidName.E_FormAll_A0002.ToString().Trim();
  112. this.dgvData.dgvUserEmployeeID = strUsrID;
  113. this.dgvData.dgvFixedHideColumn = "";
  114. this.dgvData.dgvCurrentColumnOriginalSet = "";
  115. pageData.QueryFieldName = this.dgvData.dgvSetColumnName();
  116. if (string.IsNullOrEmpty(pageData.QueryFieldName))
  117. { pageData.QueryFieldName = this.dgvData.dgvCurrentColumnOriginalSet; }
  118. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  119. {
  120. this.tblMianSelectData = pageData.QueryOrderDataTable().Tables[0];
  121. try
  122. {
  123. this.Invoke(new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl(delegate()
  124. {
  125. this.dgvData.DataSourceMain(this.tblMianSelectData);
  126. this.dgvData.FillLastColumn(true);
  127. }));
  128. }
  129. catch
  130. { }
  131. });
  132. try
  133. {
  134. this.UcPagerEx1.TbDataSource = this.tblMianSelectData;
  135. this.dgvData.Columns["电话时间"].Width = 110;
  136. }
  137. catch { }
  138. this.dgvData.ClearSelection();
  139. return pageData.TotalCount;
  140. }
  141. /// <summary>
  142. /// 返回要操作的条件
  143. /// </summary>
  144. /// <returns></returns>
  145. private string GetWhereStr()
  146. {
  147. string StrWhere = " 1=1 ";
  148. string StrText = txtQuery.Text.Trim();
  149. return StrWhere;
  150. }
  151. //public void bindCustomerCalls()
  152. //{
  153. // dgv.Rows.Clear();
  154. // LYFZ.BLL.BLL_ErpCallWizard cabll = new BLL.BLL_ErpCallWizard();
  155. // LYFZ.BLL.BLL_ErpCustomer cubll = new BLL.BLL_ErpCustomer();
  156. // DataTable dt = new DataTable();
  157. // string keyword = txtkeyword.Text;
  158. // #region 获取来电精灵号码
  159. // if (!string.IsNullOrEmpty(keyword))
  160. // {
  161. // dt = cabll.GetList("(Callw_Status='未接电话' and Callw_Telephone like '%" + keyword + "%')").Tables[0];
  162. // }
  163. // else { dt = cabll.GetList("Callw_Status='未接电话'").Tables[0]; }
  164. // for (int i = 0; i < dt.Rows.Count; i++)
  165. // {
  166. // DataGridViewRow dgvr = new DataGridViewRow();
  167. // DataGridViewCell cell = null;
  168. // cell = new DataGridViewTextBoxCell();
  169. // cell.Value = dt.Rows[i]["ID"].ToString().Trim(); ;
  170. // dgvr.Cells.Add(cell);
  171. // cell = new DataGridViewTextBoxCell();
  172. // cell.Value = "";
  173. // dgvr.Cells.Add(cell);
  174. // cell = new DataGridViewTextBoxCell();
  175. // cell.Value = dt.Rows[i]["Callw_Telephone"].ToString(); ;
  176. // dgvr.Cells.Add(cell);
  177. // cell = new DataGridViewTextBoxCell();
  178. // cell.Value = dt.Rows[i]["Callw_DateTime"].ToString(); ;
  179. // dgvr.Cells.Add(cell);
  180. // cell = new DataGridViewTextBoxCell();
  181. // cell.Value = "";
  182. // dgvr.Cells.Add(cell);
  183. // this.dgv.Rows.Add(dgvr);
  184. // dgv.ClearSelection();
  185. // }
  186. // #endregion
  187. // if (dgv.Rows.Count > 0)
  188. // {
  189. // for (int t = 0; t < dgv.Rows.Count; t++)
  190. // {
  191. // string Callw_Telephone = dgv.Rows[t].Cells["Callw_Telephone"].Value.ToString();
  192. // #region 获取客户姓名和员工姓名和状态
  193. // DataTable dtcu = cabll.GetView_tb_ErpCallWizard("tb_ErpCallWizard.Callw_Telephone='" + Callw_Telephone + "' order by tb_ErpCallWizard.Id desc").Tables[0];
  194. // if (dtcu.Rows.Count > 0)
  195. // {
  196. // dgv.Rows[t].Cells["Cus_Name"].Value = dtcu.Rows[0]["Cus_Name"].ToString();
  197. // dgv.Rows[t].Cells["Type"].Value = dtcu.Rows[0]["Cus_Type"].ToString() + "来电";
  198. // }
  199. // DataTable dtus = cabll.GetView_tb_ErpCallWizard_tb_ErpUser("tb_ErpCallWizard.Callw_Telephone='" + Callw_Telephone + "' order by tb_ErpCallWizard.Id desc").Tables[0];
  200. // if (dtus.Rows.Count > 0)
  201. // {
  202. // dgv.Rows[t].Cells["Cus_Name"].Value = dtus.Rows[0]["User_Name"].ToString();
  203. // dgv.Rows[t].Cells["Type"].Value = "员工来电";
  204. // }
  205. // if (string.IsNullOrEmpty(dgv.Rows[t].Cells["Cus_Name"].Value.ToString()) && string.IsNullOrEmpty(dgv.Rows[t].Cells["Type"].Value.ToString()))
  206. // {
  207. // dgv.Rows[t].Cells["Cus_Name"].Value = "";
  208. // dgv.Rows[t].Cells["Type"].Value = "未知电话来电";
  209. // }
  210. // #endregion
  211. // }
  212. // }
  213. //}
  214. //public void GvDataBind()
  215. //{
  216. // this.ucPagerEx1.PageCurrent = 1;
  217. // this.ucPagerEx1.PageSize = 100;
  218. // this.ucPagerEx1.Bind();
  219. //}
  220. ///// <summary>
  221. ///// 画分页
  222. ///// </summary>
  223. ///// <param name="e"></param>
  224. ///// <returns></returns>
  225. //private int ucPagerEx1_EventPaging(UCPager.EventPagingArg e)
  226. //{
  227. // LYFZ.UCPager.PageData pageData = new LYFZ.UCPager.PageData();
  228. // dgv.Rows.Clear();
  229. // DataTable dt = new DataTable();
  230. // StringBuilder sql = new StringBuilder();
  231. // if (!string.IsNullOrEmpty(txtkeyword.Text))
  232. // {
  233. // sql.Append(" 1=1 and (Callw_Status='未接电话' and Callw_Telephone like '%" + txtkeyword.Text + "%')");
  234. // }
  235. // else
  236. // {
  237. // sql.Append(" 1=1 and Callw_Status='未接电话'");
  238. // }
  239. // LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  240. // {
  241. // pageData.TableName = "View_CallWizard";
  242. // pageData.PageIndex = this.ucPagerEx1.PageCurrent;
  243. // pageData.PageSize = this.ucPagerEx1.PageSize;
  244. // pageData.QueryCondition = sql.ToString();
  245. // pageData.QueryFieldName = "ID,Callw_Telephone,Callw_DateTime,Callw_Status,Callw_Remark,Callw_SoundRecording,Callw_UpdateDatetime,Cus_Name,Cus_Sex,Cus_CustomerNumber,Cus_Type";
  246. // pageData.OrderStr = " ID desc ";
  247. // DataSet da = pageData.QueryDataTable();
  248. // dt = da.Tables[0];
  249. // if (dt.Rows.Count > 0)
  250. // {
  251. // this.Invoke(new UpdateControl(delegate()
  252. // {
  253. // #region
  254. // for (int i = 0; i < dt.Rows.Count; i++)
  255. // {
  256. // DataGridViewRow dgvr = new DataGridViewRow();
  257. // DataGridViewCell cell = null;
  258. // cell = new DataGridViewTextBoxCell();
  259. // cell.Value = dt.Rows[i]["ID"].ToString().Trim();
  260. // dgvr.Cells.Add(cell);
  261. // cell = new DataGridViewTextBoxCell();
  262. // cell.Value = dt.Rows[i]["Cus_Name"].ToString();
  263. // dgvr.Cells.Add(cell);
  264. // cell = new DataGridViewTextBoxCell();
  265. // cell.Value = dt.Rows[i]["Callw_Telephone"].ToString();
  266. // dgvr.Cells.Add(cell);
  267. // cell = new DataGridViewTextBoxCell();
  268. // cell.Value = Convert.ToDateTime(dt.Rows[i]["Callw_DateTime"]).ToString("yyyy-MM-dd");
  269. // dgvr.Cells.Add(cell);
  270. // cell = new DataGridViewTextBoxCell();
  271. // cell.Value = dt.Rows[i]["Cus_Type"].ToString() == "" ? "其它电话来电" : dt.Rows[i]["Cus_Type"].ToString();
  272. // dgvr.Cells.Add(cell);
  273. // this.dgv.Rows.Add(dgvr);
  274. // dgv.ClearSelection();
  275. // }
  276. // #endregion
  277. // }));
  278. // }
  279. // });
  280. // try
  281. // {
  282. // this.ucPagerEx1.TbDataSource = dt;
  283. // }
  284. // catch { }
  285. // return pageData.TotalCount;
  286. //}
  287. }
  288. }