frmFullPhoneNumber.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. namespace LYFZ.ComponentLibrary
  10. {
  11. public partial class frmFullPhoneNumber : Form
  12. {
  13. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  14. LYFZ.BLL.BLL_ErpUserViewPhoneCount uvpnbll = new BLL.BLL_ErpUserViewPhoneCount();
  15. public frmFullPhoneNumber()
  16. {
  17. InitializeComponent();
  18. this.Load += frmFullPhoneNumber_Load;
  19. this.buttonEx1.Click += buttonEx1_Click;
  20. this.buttonForm1.Click += buttonForm1_Click;
  21. }
  22. /// <summary>
  23. /// 查看的电话号码
  24. /// </summary>
  25. public string StrPhone = "";
  26. /// <summary>
  27. /// 员工编号
  28. /// </summary>
  29. public string StrUserNumber = "";
  30. /// <summary>
  31. /// 窗体加载事件
  32. /// </summary>
  33. /// <param name="sender"></param>
  34. /// <param name="e"></param>
  35. void frmFullPhoneNumber_Load(object sender, EventArgs e)
  36. {
  37. List<LYFZ.Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
  38. DataTable dt = orbll.GetView_Custom("tb_ErpUserViewPhoneCount", StrWhere: "Uvpn_ViewPerson='" + StrUserNumber + "' And Uvpn_ViewDateTime = '" + SDateTime.Now.ToString("yyyy-MM-dd 00:00:00") + "'", ShowColumnName: "*").Tables[0];
  39. int intViewPhoneCount = 0;
  40. if (dt.Rows.Count > 0)
  41. { intViewPhoneCount = Convert.ToInt32(dt.Rows[0]["Uvpn_ViewCount"]); }
  42. if ((LYFZ.BLL.OtherCommonModel.UserCanViewPhoneCount - intViewPhoneCount) > 0)
  43. {
  44. LYFZ.Model.Model_ErpUserViewPhoneCount model = null;
  45. if (dt.Rows.Count > 0)
  46. {
  47. model = uvpnbll.DataRowToModel(dt.Rows[0]);
  48. model.Uvpn_ViewCount += 1;
  49. model.Uvpn_UpdateDateTime = SDateTime.Now;
  50. model.Uvpn_UpdateName = this.StrUserNumber;
  51. clist.Add(uvpnbll.GetUpdateCommandInfo(model));
  52. }
  53. else
  54. {
  55. model = new Model.Model_ErpUserViewPhoneCount();
  56. model.Uvpn_ViewPerson = this.StrUserNumber;
  57. model.Uvpn_ViewCount = 1;
  58. model.Uvpn_ViewTotalCount = LYFZ.BLL.OtherCommonModel.UserCanViewPhoneCount;
  59. model.Uvpn_ViewDateTime = Convert.ToDateTime(SDateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
  60. model.Uvpn_UpdateDateTime = SDateTime.Now;
  61. model.Uvpn_UpdateName = this.StrUserNumber;
  62. clist.Add(uvpnbll.GetAddCommandInfo(model));
  63. }
  64. }
  65. if (clist.Count > 0)
  66. { LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist); }
  67. List<string> StrPhoneList = new List<string>();
  68. if (this.StrPhone.Trim().IndexOf('/') == -1)
  69. {
  70. this.labelEx1.Tag = this.StrPhone.Trim();
  71. StrPhoneList.Add(this.StrPhone.Trim());
  72. }
  73. else
  74. {
  75. string[] strSplitList = this.StrPhone.Trim().Split('/');
  76. for (int i = 0; i < strSplitList.Length; i++)
  77. { StrPhoneList.Add(strSplitList[i].Trim()); }
  78. this.labelEx1.Tag = strSplitList[0].Trim();
  79. }
  80. string StrTextPhone = "";
  81. for (int i = 0; i < StrPhoneList.Count; i++)
  82. {
  83. StrTextPhone += StrPhoneList[i].Trim().Insert(3, " ").Insert(8, " ") + "\r\n";
  84. }
  85. this.labelEx1.Text = StrTextPhone;
  86. if (LYFZ.BLL.OtherCommonModel.UserCanViewPhoneCount <= 0)
  87. { this.labelEx2.Visible = false; }
  88. else if ((LYFZ.BLL.OtherCommonModel.UserCanViewPhoneCount - intViewPhoneCount) > 0)
  89. { this.labelEx2.Text = "温馨提示:查看次数今日还剩 " + (LYFZ.BLL.OtherCommonModel.UserCanViewPhoneCount - intViewPhoneCount - 1) + " 次!"; }
  90. else
  91. {
  92. this.labelEx2.Text = "温馨提示:今日查看次数已经用完,明日再来!";
  93. this.labelEx1.Visible = false;
  94. this.buttonEx1.Visible = false;
  95. }
  96. }
  97. /// <summary>
  98. /// 拨号
  99. /// </summary>
  100. /// <param name="sender"></param>
  101. /// <param name="e"></param>
  102. void buttonEx1_Click(object sender, EventArgs e)
  103. {
  104. if (this.labelEx1.Text.Trim().Length > 0)
  105. {
  106. try
  107. {
  108. if (!LYFZ.Command.Command_Validate.IsMobilePhone(this.labelEx1.Tag.ToString().Trim()))
  109. { MessageBoxCustom.Show("请输入完整呼叫号码!"); return; }
  110. LYFZ.BLL.BLL_ErpCallWizard cwbll = new BLL.BLL_ErpCallWizard();
  111. if (cwbll.ProgramStarts() == false)
  112. { MessageBoxCustom.Show("来电精灵未启动,请启动"); return; }
  113. cwbll.GetCPhone(this.labelEx1.Tag.ToString().Trim());
  114. }
  115. catch (Exception ex)
  116. { MessageBoxCustom.Show(ex.Message); }
  117. }
  118. }
  119. /// <summary>
  120. /// 关闭
  121. /// </summary>
  122. /// <param name="sender"></param>
  123. /// <param name="e"></param>
  124. void buttonForm1_Click(object sender, EventArgs e)
  125. {
  126. this.Close();
  127. }
  128. }
  129. }