123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- 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.ComponentLibrary
- {
- public partial class frmFullPhoneNumber : Form
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_ErpUserViewPhoneCount uvpnbll = new BLL.BLL_ErpUserViewPhoneCount();
- public frmFullPhoneNumber()
- {
- InitializeComponent();
- this.Load += frmFullPhoneNumber_Load;
- this.buttonEx1.Click += buttonEx1_Click;
- this.buttonForm1.Click += buttonForm1_Click;
- }
- /// <summary>
- /// 查看的电话号码
- /// </summary>
- public string StrPhone = "";
- /// <summary>
- /// 员工编号
- /// </summary>
- public string StrUserNumber = "";
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void frmFullPhoneNumber_Load(object sender, EventArgs e)
- {
- List<LYFZ.Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
- 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];
- int intViewPhoneCount = 0;
- if (dt.Rows.Count > 0)
- { intViewPhoneCount = Convert.ToInt32(dt.Rows[0]["Uvpn_ViewCount"]); }
- if ((LYFZ.BLL.OtherCommonModel.UserCanViewPhoneCount - intViewPhoneCount) > 0)
- {
- LYFZ.Model.Model_ErpUserViewPhoneCount model = null;
- if (dt.Rows.Count > 0)
- {
- model = uvpnbll.DataRowToModel(dt.Rows[0]);
- model.Uvpn_ViewCount += 1;
- model.Uvpn_UpdateDateTime = SDateTime.Now;
- model.Uvpn_UpdateName = this.StrUserNumber;
- clist.Add(uvpnbll.GetUpdateCommandInfo(model));
- }
- else
- {
- model = new Model.Model_ErpUserViewPhoneCount();
- model.Uvpn_ViewPerson = this.StrUserNumber;
- model.Uvpn_ViewCount = 1;
- model.Uvpn_ViewTotalCount = LYFZ.BLL.OtherCommonModel.UserCanViewPhoneCount;
- model.Uvpn_ViewDateTime = Convert.ToDateTime(SDateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
- model.Uvpn_UpdateDateTime = SDateTime.Now;
- model.Uvpn_UpdateName = this.StrUserNumber;
- clist.Add(uvpnbll.GetAddCommandInfo(model));
- }
- }
- if (clist.Count > 0)
- { LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist); }
- List<string> StrPhoneList = new List<string>();
- if (this.StrPhone.Trim().IndexOf('/') == -1)
- {
- this.labelEx1.Tag = this.StrPhone.Trim();
- StrPhoneList.Add(this.StrPhone.Trim());
- }
- else
- {
- string[] strSplitList = this.StrPhone.Trim().Split('/');
- for (int i = 0; i < strSplitList.Length; i++)
- { StrPhoneList.Add(strSplitList[i].Trim()); }
- this.labelEx1.Tag = strSplitList[0].Trim();
- }
- string StrTextPhone = "";
- for (int i = 0; i < StrPhoneList.Count; i++)
- {
- StrTextPhone += StrPhoneList[i].Trim().Insert(3, " ").Insert(8, " ") + "\r\n";
- }
- this.labelEx1.Text = StrTextPhone;
- if (LYFZ.BLL.OtherCommonModel.UserCanViewPhoneCount <= 0)
- { this.labelEx2.Visible = false; }
- else if ((LYFZ.BLL.OtherCommonModel.UserCanViewPhoneCount - intViewPhoneCount) > 0)
- { this.labelEx2.Text = "温馨提示:查看次数今日还剩 " + (LYFZ.BLL.OtherCommonModel.UserCanViewPhoneCount - intViewPhoneCount - 1) + " 次!"; }
- else
- {
- this.labelEx2.Text = "温馨提示:今日查看次数已经用完,明日再来!";
- this.labelEx1.Visible = false;
- this.buttonEx1.Visible = false;
- }
- }
- /// <summary>
- /// 拨号
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void buttonEx1_Click(object sender, EventArgs e)
- {
- if (this.labelEx1.Text.Trim().Length > 0)
- {
- try
- {
- if (!LYFZ.Command.Command_Validate.IsMobilePhone(this.labelEx1.Tag.ToString().Trim()))
- { MessageBoxCustom.Show("请输入完整呼叫号码!"); return; }
- LYFZ.BLL.BLL_ErpCallWizard cwbll = new BLL.BLL_ErpCallWizard();
- if (cwbll.ProgramStarts() == false)
- { MessageBoxCustom.Show("来电精灵未启动,请启动"); return; }
- cwbll.GetCPhone(this.labelEx1.Tag.ToString().Trim());
- }
- catch (Exception ex)
- { MessageBoxCustom.Show(ex.Message); }
- }
- }
- /// <summary>
- /// 关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void buttonForm1_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- }
- }
|