123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649 |
- using LYFZ.ComponentLibrary;
- 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.CallerWizard
- {
- public partial class FrmOutgoingCalls : LYFZ.Software.UI.CallerWizard.FrmOutgoingCalls
- {
- LYFZ.BLL.BLL_ErpCallWizard cwbll = new BLL.BLL_ErpCallWizard();
- private delegate void UpdateControl();
- public FrmOutgoingCalls()
- {
- this.Shown += FrmCustomerCalls_Shown;
- this.btnQuery.Click += btnQuery_Click;
- this.btnDelete.Click += btnDelete_Click;
- this.btnCall.Click += btnCall_Click;
- this.btnPlayer.Click += btnPlayer_Click;
- this.btnClose.Click += btnClose_Click;
- this.tabControlEx1.SelectedIndexChanged += tabControlEx1_SelectedIndexChanged;
- this.ucPager_ClientOrder.EventPaging += UcPagerEx1_EventPaging;
- }
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void FrmCustomerCalls_Shown(object sender, EventArgs e)
- {
- this.btnDelete.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.CustomerCallsCompetence, CustomAttributes.OperatingAuthority.Delete);
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnQuery_Click(object sender, EventArgs e)
- {
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnDelete_Click(object sender, EventArgs e)
- {
- if (this.dgvData.Rows.Count > 0)
- {
- if (this.dgvData.CurrentRow == null)
- { MessageBoxCustom.Show("请选中你要录音回放的数据!"); return; }
- if (this.dgvData.CurrentRow.Index >= 0 && this.dgvData.CurrentCell.RowIndex >= 0)
- {
- if (!string.IsNullOrEmpty(this.dgvData.CurrentRow.Cells["ID"].Value.ToString().Trim()))
- {
- if (MessageBoxCustom.Show("您确定删除吗?", "温馨提示!", MessageBoxButtons.YesNo) == DialogResult.No)
- { return; }
- if (cwbll.Delete(Convert.ToInt32(this.dgvData.CurrentRow.Cells["ID"].Value)))
- {
- string logsContent = "删除客户来电电话号码:" + this.dgvData.CurrentRow.Cells["电话"].Value.ToString();
- LYFZ.BLL.BLL_ErpSystemLogs.WriteSystemLog(LYFZ.EnumPublic.SystemLogsType.删除电话记录, logsContent, LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID, LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name);
- MessageBoxCustom.Show("删除成功!"); this.dgvData.Rows.Remove(this.dgvData.CurrentRow);
- }
- else
- { MessageBoxCustom.Show("删除失败!"); }
- }
- }
- }
- }
- /// <summary>
- /// 呼叫
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnCall_Click(object sender, EventArgs e)
- {
- if (this.dgvData.Rows.Count > 0)
- {
- if (this.dgvData.CurrentRow == null)
- { MessageBoxCustom.Show("请选中你要录音回放的数据!"); return; }
- if (this.dgvData.CurrentRow.Index >= 0 && this.dgvData.CurrentCell.RowIndex >= 0)
- {
- if (!string.IsNullOrEmpty(this.dgvData.CurrentRow.Cells["电话"].Value.ToString().Trim()))
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.PhoneCall(this.dgvData.CurrentRow.Cells["电话"].Value.ToString().Trim());
- }
- else
- { MessageBoxCustom.Show("选择的通话记录电话号码为空!"); }
- }
- }
- }
- /// <summary>
- /// 录音回放
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnPlayer_Click(object sender, EventArgs e)
- {
- if (this.dgvData.Rows.Count > 0)
- {
- if (this.dgvData.CurrentRow == null)
- { MessageBoxCustom.Show("请选中你要录音回放的数据!"); return; }
- if (this.dgvData.CurrentRow.Index >= 0 && this.dgvData.CurrentCell.RowIndex >= 0)
- {
- if (!string.IsNullOrEmpty(this.dgvData.CurrentRow.Cells["路径"].Value.ToString().Trim()))
- {
- //播放
- FrmPlayer set = new FrmPlayer();
- set.Path = this.dgvData.CurrentRow.Cells["路径"].Value.ToString().Trim();
- set.ShowDialog();
- }
- else
- { MessageBoxCustom.Show("选择的通话记录未录音!"); }
- }
- }
- }
- /// <summary>
- /// 关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 选项卡选择事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void tabControlEx1_SelectedIndexChanged(object sender, EventArgs e)
- {
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 分页前数据,便于展开时用来查询订单的子数据
- /// </summary>
- DataTable tblMianSelectData = new DataTable();
- /// <summary>
- /// 创建行
- /// </summary>
- private void PublicFunctionRows()
- {
- this.UcPagerEx1.EventPaging -= UcPagerEx1_EventPaging;
- this.UcPagerEx1.EventPaging += UcPagerEx1_EventPaging;
- this.UcPagerEx1.PageCurrent = 1;
- this.UcPagerEx1.PageSize = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPageSize();//3;分页条数
- this.UcPagerEx1.Bind();
- }
- /// <summary>
- /// 画分页
- /// </summary>
- /// <param name="e"></param>
- /// <returns></returns>
- int UcPagerEx1_EventPaging(UCPager.EventPagingArg e)
- {
- LYFZ.UCPager.PageData pageData = new LYFZ.UCPager.PageData();
- pageData.TableName = GetTableName_Main();
- pageData.PageIndex = this.UcPagerEx1.PageCurrent;
- pageData.PageSize = this.UcPagerEx1.PageSize;
- pageData.QueryCondition = GetWhereStr();
- pageData.OrderStr = "时间";
- pageData.OrderType = 1;
- string StrTabName = this.tabControlEx1.SelectedTab.Name.Trim();
- this.dgvData.dgvGuidName = GetGuidName();
- this.dgvData.dgvUserEmployeeID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- this.dgvData.dgvFixedHideColumn = "ID,路径";
- this.dgvData.dgvCurrentColumnOriginalSet = GetFieldName();
- pageData.QueryFieldName = this.dgvData.dgvSetColumnName();
- if (string.IsNullOrEmpty(pageData.QueryFieldName))
- { pageData.QueryFieldName = this.dgvData.dgvCurrentColumnOriginalSet; }
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
- {
- this.tblMianSelectData = pageData.QueryDataTable().Tables[0];
- try
- {
- this.Invoke(new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl(delegate()
- {
- this.dgvData.DataSource(this.tblMianSelectData);
- this.dgvData.FillLastColumn(true);
- }));
- }
- catch
- { }
- });
- try
- {
- this.UcPagerEx1.TbDataSource = this.tblMianSelectData;
- this.dgvData.Columns["时间"].Width = 110;
- this.dgvData.ColumnHeaderMouseDoubleClick -= dgvData_ColumnHeaderMouseDoubleClick;
- this.dgvData.ColumnHeaderMouseDoubleClick += dgvData_ColumnHeaderMouseDoubleClick;
- }
- catch { }
- this.dgvData.ClearSelection();
- return pageData.TotalCount;
- }
- /// <summary>
- /// 列表双击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dgvData_ColumnHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
- {
- }
- /// <summary>
- /// 查询要获取的字段
- /// </summary>
- /// <returns></returns>
- private string GetGuidName()
- {
- switch (this.tabControlEx1.SelectedTab.Name.Trim())
- {
- case "tabPage_ClientOrder":
- return LYFZ.EnumPublic.dgvGuidName.E_FormAll_A0035.ToString().Trim();
- case "tabPage_ClientOld":
- return LYFZ.EnumPublic.dgvGuidName.E_FormAll_A0036.ToString().Trim();
- case "tabPage_ClientIntent":
- return LYFZ.EnumPublic.dgvGuidName.E_FormAll_A0037.ToString().Trim();
- case "tabPage_ClientOther":
- return LYFZ.EnumPublic.dgvGuidName.E_FormAll_A0038.ToString().Trim();
- case "tabPage_ClientUser":
- return LYFZ.EnumPublic.dgvGuidName.E_FormAll_A0039.ToString().Trim();
- default: return "";
- }
- }
- /// <summary>
- /// 查询要获取的字段
- /// </summary>
- /// <returns></returns>
- private string GetFieldName()
- {
- switch (this.tabControlEx1.SelectedTab.Name.Trim())
- {
- case "tabPage_ClientOrder":
- return "";
- case "tabPage_ClientOld":
- return "";
- case "tabPage_ClientIntent":
- return "";
- case "tabPage_ClientOther":
- return "";
- case "tabPage_ClientUser":
- return "ID,姓名,电话,时间,路径";
- default: return "";
- }
- }
- /// <summary>
- /// 返回要操作的条件
- /// </summary>
- /// <returns></returns>
- private string GetWhereStr()
- {
- string StrWhere = " 1=1 ";
- switch (this.tabControlEx1.SelectedTab.Name.Trim())
- {
- case "tabPage_ClientOrder":
- StrWhere += "";
- break;
- case "tabPage_ClientOld":
- StrWhere += "";
- break;
- case "tabPage_ClientIntent":
- StrWhere += "";
- break;
- case "tabPage_ClientOther":
- StrWhere += "";
- break;
- case "tabPage_ClientUser":
- StrWhere += " And 状态 = '拨出电话'";
- if (this.txtQuery.Text.Trim() != "")
- { StrWhere += " And (姓名 like '%" + this.txtQuery.Text.Trim() + "%' or 电话 like '%" + this.txtQuery.Text.Trim() + "%')"; }
- break;
- }
- return StrWhere;
- }
- /// <summary>
- /// 返回要操作的数据表
- /// </summary>
- /// <returns></returns>
- private string GetTableName_Main()
- {
- switch (this.tabControlEx1.SelectedTab.Name.Trim())
- {
- case "tabPage_ClientOrder":
- return "";
- case "tabPage_ClientOld":
- return "";
- case "tabPage_ClientIntent":
- return "";
- case "tabPage_ClientOther":
- return "";
- case "tabPage_ClientUser":
- return "BView_CallsElves_UserCalls";
- default: return "";
- }
- }
- /// <summary>
- /// 定义列表属性
- /// </summary>
- public LYFZ.ComponentLibrary.DataGridViewEc dgvData
- {
- get
- {
- switch (this.tabControlEx1.SelectedTab.Name.Trim())
- {
- case "tabPage_ClientOrder":
- return this.dgvData_ClientOrder;
- case "tabPage_ClientOld":
- return this.dgvData_ClientOld;
- case "tabPage_ClientIntent":
- return this.dgvData_ClientIntent;
- case "tabPage_ClientOther":
- return this.dgvData_ClientOther;
- case "tabPage_ClientUser":
- return this.dgvData_ClientUser;
- default: return this.dgvData_ClientOrder;
- }
- }
- set
- {
- switch (this.tabControlEx1.SelectedTab.Name.Trim())
- {
- case "tabPage_ClientOrder":
- this.dgvData_ClientOrder = value;
- break;
- case "tabPage_ClientOld":
- this.dgvData_ClientOld = value;
- break;
- case "tabPage_ClientIntent":
- this.dgvData_ClientIntent = value;
- break;
- case "tabPage_ClientOther":
- this.dgvData_ClientOther = value;
- break;
- case "tabPage_ClientUser":
- this.dgvData_ClientUser = value;
- break;
- }
- }
- }
- /// <summary>
- /// 定义分页控件属性
- /// </summary>
- public LYFZ.UCPager.ucPagerEx UcPagerEx1
- {
- get
- {
- switch (this.tabControlEx1.SelectedTab.Name.Trim())
- {
- case "tabPage_ClientOrder":
- return this.ucPager_ClientOrder;
- case "tabPage_ClientOld":
- return this.ucPager_ClientOld;
- case "tabPage_ClientIntent":
- return this.ucPager_ClientIntent;
- case "tabPage_ClientOther":
- return this.ucPager_ClientOther;
- case "tabPage_ClientUser":
- return this.ucPager_ClientUser;
- default: return this.ucPager_ClientOrder;
- }
- }
- set
- {
- switch (this.tabControlEx1.SelectedTab.Name.Trim())
- {
- case "tabPage_ClientOrder":
- this.ucPager_ClientOrder = value;
- break;
- case "tabPage_ClientOld":
- this.ucPager_ClientOld = value;
- break;
- case "tabPage_ClientIntent":
- this.ucPager_ClientIntent = value;
- break;
- case "tabPage_ClientOther":
- this.ucPager_ClientOther = value;
- break;
- case "tabPage_ClientUser":
- this.ucPager_ClientUser = value;
- break;
- }
- }
- }
- //string type;
- //#region 加载数据
- //protected override void FrmOutgoingCalls_Shown(object sender, EventArgs e)
- //{
-
- // try
- // {
- // type = "5";
- // GvDataBind();
- // #region 权限设置
- // #region 删除拨出电话
- // if (LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OutgoingCallsCompetence, CustomAttributes.OperatingAuthority.Delete))
- // {
- // btnDelete.Enabled = true;
- // }
- // else
- // {
- // btnDelete.Enabled = false;
- // }
- // #endregion
- // #endregion
-
- // }
- // catch (Exception ex)
- // {
- // MessageBoxCustom.Show(ex.Message);
- // }
- //}
- //#endregion
- //#region 获取客户来电
- //protected override void btnCustomerCalls_Click(object sender, EventArgs e)
- //{
-
- // try
- // {
- // type = "1";
- // GvDataBind();
- // }
- // catch (Exception ex)
- // {
- // MessageBoxCustom.Show(ex.Message);
- // }
- //}
- //#endregion
- //#region 获取老客户来电
- //protected override void btnOldCustomers_Click(object sender, EventArgs e)
- //{
- // try
- // {
- // type = "2";
- // GvDataBind();
- // }
- // catch (Exception ex)
- // {
- // MessageBoxCustom.Show(ex.Message);
- // }
- //}
- //#region 获取老客户来电
- //public void bindOldCustomers()
- //{
- // dgv.Rows.Clear();
- // dgv.Columns["Cus_Name"].Visible = true;
- // dgv.Columns["Sex"].Visible = true;
- // LYFZ.BLL.BLL_ErpCallWizard cabll = new BLL.BLL_ErpCallWizard();
- // LYFZ.BLL.BLL_ErpCustomer cubll = new BLL.BLL_ErpCustomer();
- // DataTable dt = new DataTable();
- // string keyword = txtQuery.Text;
- // #region 获取来电精灵号码
- // if (!string.IsNullOrEmpty(keyword))
- // {
- // dt = cabll.GetView_tb_ErpCallWizard("(Callw_Status='拨出电话' and Cus_Type='老客户') and (Cus_Name like '%" + keyword + "%' or dbo.tb_Product(Cus_Name) like '%" + keyword + "%' or Cus_Telephone like '%" + keyword + "%') order by tb_ErpCallWizard.Id desc").Tables[0];
- // }
- // else { dt = cabll.GetView_tb_ErpCallWizard("Callw_Status='拨出电话' and Cus_Type='老客户' order by tb_ErpCallWizard.Id desc").Tables[0]; }
- // for (int i = 0; i < dt.Rows.Count; i++)
- // {
- // DataGridViewRow dgvr = new DataGridViewRow();
- // DataGridViewCell cell = null;
- // cell = new DataGridViewTextBoxCell();
- // cell.Value = dt.Rows[i]["ID"].ToString().Trim(); ;
- // dgvr.Cells.Add(cell);
- // cell = new DataGridViewTextBoxCell();
- // cell.Value = dt.Rows[i]["Cus_Name"].ToString().Trim();
- // dgvr.Cells.Add(cell);
- // cell = new DataGridViewTextBoxCell();
- // if (Convert.ToBoolean(dt.Rows[i]["Cus_Sex"].ToString().Trim()) == false)
- // {
- // cell.Value = "男";
- // }
- // else { cell.Value = "女"; }
- // dgvr.Cells.Add(cell);
- // cell = new DataGridViewTextBoxCell();
- // cell.Value = dt.Rows[i]["Callw_Telephone"].ToString(); ;
- // dgvr.Cells.Add(cell);
- // cell = new DataGridViewTextBoxCell();
- // cell.Value = dt.Rows[i]["Callw_DateTime"].ToString(); ;
- // dgvr.Cells.Add(cell);
- // this.dgv.Rows.Add(dgvr);
- // }
- // #endregion
- //}
- //#endregion
- //#endregion
- //#region 获取意向客户
- //protected override void btnIntentionOfCustomers_Click(object sender, EventArgs e)
- //{
- // try
- // {
- // type = "3";
- // GvDataBind();
- // }
- // catch (Exception ex)
- // {
- // MessageBoxCustom.Show(ex.Message);
- // }
- //}
-
- //#endregion
- //#region 获取员工电话
- //protected override void btnStaffPhone_Click(object sender, EventArgs e)
- //{
-
- //}
-
- //#endregion
- //#region 获取其它电话
- //protected override void btnOtherPhone_Click(object sender, EventArgs e)
- //{
- // try
- // {
- // type = "4";
- // GvDataBind();
- // }
- // catch (Exception ex)
- // {
- // MessageBoxCustom.Show(ex.Message);
- // }
- //}
- //#endregion
- //#region 删除
- //protected override void btndelete_Click(object sender, EventArgs e)
- //{
- // try
- // {
- // if (this.dgv.SelectedRows.Count == 0)
- // {
- // MessageBoxCustom.Show("请选中你要删除的数据!");
- // return;
- // }
- // if (MessageBoxCustom.Show("你确定要删除吗?", "删除提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- // {
- // LYFZ.BLL.BLL_ErpCallWizard bll = new BLL.BLL_ErpCallWizard();
- // int id = Convert.ToInt32(this.dgv.CurrentRow.Cells["ID"].Value);
- // if (bll.Delete(id) == true)
- // {
- // #region 写入操作日志
- // string logsContent = "删除拨出电话号码:" + dgv.CurrentRow.Cells["Callw_Telephone"].Value.ToString();
- // LYFZ.BLL.BLL_ErpSystemLogs.WriteSystemLog(LYFZ.EnumPublic.SystemLogsType.删除电话记录, logsContent, LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID, LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name);
- // //LYFZ.BLL.BLL_ErpSystemLogs systemLogsBll = new BLL.BLL_ErpSystemLogs();
- // //LYFZ.Model.Model_ErpSystemLogs systemLogsModel = new Model.Model_ErpSystemLogs();
- // //systemLogsModel.Slogs_Type = "user";
- // //systemLogsModel.Slogs_Topic = "删除拨出电话";
- // //systemLogsModel.Slogs_Content = "删除拨出电话号码:" + dgv.CurrentRow.Cells["Callw_Telephone"].Value.ToString();
- // //systemLogsModel.Slogs_UserName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name;
- // //systemLogsModel.Slogs_IP = "";
- // //systemLogsModel.Slogs_CreateDatetime = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime();
- // //systemLogsModel.Slogs_CreateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- // //systemLogsBll.Add(systemLogsModel);
- // #endregion
- // MessageBoxCustom.Show("删除成功!");
- // GvDataBind();
- // }
- // else { MessageBoxCustom.Show("删除失败!"); }
- // }
- // }
- // catch (Exception ex) { MessageBoxCustom.Show(ex.Message); }
- //}
- //#endregion
- //#region 关闭
- //protected override void btnClose_Click(object sender, EventArgs e)
- //{
- // this.Close();
- //}
- //#endregion
- //#region 录音回放
- //protected override void btnRecordingPlayback_Click(object sender, EventArgs e)
- //{
- // try
- // {
- // if (this.dgv.SelectedRows.Count == 0)
- // {
- // MessageBoxCustom.Show("请选中你要录音回放的数据!");
- // return;
- // }
- // LYFZ.BLL.BLL_ErpCallWizard bll = new BLL.BLL_ErpCallWizard();
- // int id = Convert.ToInt32(this.dgv.CurrentRow.Cells["ID"].Value);
- // DataTable dt = bll.GetList("ID=" + id + "").Tables[0];
- // if (dt.Rows.Count > 0)
- // {
- // string Callw_SoundRecording = dt.Rows[0]["Callw_SoundRecording"].ToString();
- // if (!string.IsNullOrEmpty(Callw_SoundRecording))
- // {
- // //播放
- // FrmPlayer set = new FrmPlayer();
- // set.Path = Callw_SoundRecording;
- // set.ShowDialog();
- // }
- // else { MessageBoxCustom.Show("文件未找到!"); }
- // }
- // }
- // catch (Exception ex) { MessageBoxCustom.Show(ex.Message); }
- //}
- //#endregion
- }
- }
|