123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- 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 FrmMissedCall : LYFZ.Software.UI.CallerWizard.FrmMissedCall
- {
- LYFZ.BLL.BLL_ErpCallWizard cwbll = new BLL.BLL_ErpCallWizard();
- private delegate void UpdateControl();
- public FrmMissedCall()
- {
- this.Shown += FrmMissedCall_Shown;
- this.btnQuery.Click += btnQuery_Click;
- this.btnDelete.Click += btnDelete_Click;
- this.btnClose.Click += btnClose_Click;
- this.UcPagerEx1.EventPaging += UcPagerEx1_EventPaging;
- }
- string strUsrID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- /// <summary>
- /// 加载数据
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void FrmMissedCall_Shown(object sender, EventArgs e)
- {
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnQuery_Click(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 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 btnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <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 = "";
- pageData.PageIndex = this.UcPagerEx1.PageCurrent;
- pageData.PageSize = this.UcPagerEx1.PageSize;
- pageData.QueryCondition = GetWhereStr();
- pageData.OrderStr = "";
- pageData.OrderType = 1;
- this.dgvData.dgvGuidName = LYFZ.EnumPublic.dgvGuidName.E_FormAll_A0002.ToString().Trim();
- this.dgvData.dgvUserEmployeeID = strUsrID;
- this.dgvData.dgvFixedHideColumn = "";
- this.dgvData.dgvCurrentColumnOriginalSet = "";
- 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.QueryOrderDataTable().Tables[0];
- try
- {
- this.Invoke(new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl(delegate()
- {
- this.dgvData.DataSourceMain(this.tblMianSelectData);
- this.dgvData.FillLastColumn(true);
- }));
- }
- catch
- { }
- });
- try
- {
- this.UcPagerEx1.TbDataSource = this.tblMianSelectData;
- this.dgvData.Columns["电话时间"].Width = 110;
- }
- catch { }
- this.dgvData.ClearSelection();
- return pageData.TotalCount;
- }
- /// <summary>
- /// 返回要操作的条件
- /// </summary>
- /// <returns></returns>
- private string GetWhereStr()
- {
- string StrWhere = " 1=1 ";
- string StrText = txtQuery.Text.Trim();
- return StrWhere;
- }
- //public void bindCustomerCalls()
- //{
- // dgv.Rows.Clear();
- // LYFZ.BLL.BLL_ErpCallWizard cabll = new BLL.BLL_ErpCallWizard();
- // LYFZ.BLL.BLL_ErpCustomer cubll = new BLL.BLL_ErpCustomer();
- // DataTable dt = new DataTable();
- // string keyword = txtkeyword.Text;
- // #region 获取来电精灵号码
- // if (!string.IsNullOrEmpty(keyword))
- // {
- // dt = cabll.GetList("(Callw_Status='未接电话' and Callw_Telephone like '%" + keyword + "%')").Tables[0];
- // }
- // else { dt = cabll.GetList("Callw_Status='未接电话'").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 = "";
- // 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);
- // cell = new DataGridViewTextBoxCell();
- // cell.Value = "";
- // dgvr.Cells.Add(cell);
- // this.dgv.Rows.Add(dgvr);
- // dgv.ClearSelection();
- // }
- // #endregion
- // if (dgv.Rows.Count > 0)
- // {
- // for (int t = 0; t < dgv.Rows.Count; t++)
- // {
- // string Callw_Telephone = dgv.Rows[t].Cells["Callw_Telephone"].Value.ToString();
- // #region 获取客户姓名和员工姓名和状态
- // DataTable dtcu = cabll.GetView_tb_ErpCallWizard("tb_ErpCallWizard.Callw_Telephone='" + Callw_Telephone + "' order by tb_ErpCallWizard.Id desc").Tables[0];
- // if (dtcu.Rows.Count > 0)
- // {
- // dgv.Rows[t].Cells["Cus_Name"].Value = dtcu.Rows[0]["Cus_Name"].ToString();
- // dgv.Rows[t].Cells["Type"].Value = dtcu.Rows[0]["Cus_Type"].ToString() + "来电";
- // }
- // DataTable dtus = cabll.GetView_tb_ErpCallWizard_tb_ErpUser("tb_ErpCallWizard.Callw_Telephone='" + Callw_Telephone + "' order by tb_ErpCallWizard.Id desc").Tables[0];
- // if (dtus.Rows.Count > 0)
- // {
- // dgv.Rows[t].Cells["Cus_Name"].Value = dtus.Rows[0]["User_Name"].ToString();
- // dgv.Rows[t].Cells["Type"].Value = "员工来电";
- // }
- // if (string.IsNullOrEmpty(dgv.Rows[t].Cells["Cus_Name"].Value.ToString()) && string.IsNullOrEmpty(dgv.Rows[t].Cells["Type"].Value.ToString()))
- // {
- // dgv.Rows[t].Cells["Cus_Name"].Value = "";
- // dgv.Rows[t].Cells["Type"].Value = "未知电话来电";
- // }
- // #endregion
- // }
- // }
- //}
- //public void GvDataBind()
- //{
- // this.ucPagerEx1.PageCurrent = 1;
- // this.ucPagerEx1.PageSize = 100;
- // this.ucPagerEx1.Bind();
- //}
- ///// <summary>
- ///// 画分页
- ///// </summary>
- ///// <param name="e"></param>
- ///// <returns></returns>
- //private int ucPagerEx1_EventPaging(UCPager.EventPagingArg e)
- //{
- // LYFZ.UCPager.PageData pageData = new LYFZ.UCPager.PageData();
- // dgv.Rows.Clear();
- // DataTable dt = new DataTable();
- // StringBuilder sql = new StringBuilder();
- // if (!string.IsNullOrEmpty(txtkeyword.Text))
- // {
- // sql.Append(" 1=1 and (Callw_Status='未接电话' and Callw_Telephone like '%" + txtkeyword.Text + "%')");
- // }
- // else
- // {
- // sql.Append(" 1=1 and Callw_Status='未接电话'");
- // }
- // LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
- // {
- // pageData.TableName = "View_CallWizard";
- // pageData.PageIndex = this.ucPagerEx1.PageCurrent;
- // pageData.PageSize = this.ucPagerEx1.PageSize;
- // pageData.QueryCondition = sql.ToString();
- // pageData.QueryFieldName = "ID,Callw_Telephone,Callw_DateTime,Callw_Status,Callw_Remark,Callw_SoundRecording,Callw_UpdateDatetime,Cus_Name,Cus_Sex,Cus_CustomerNumber,Cus_Type";
- // pageData.OrderStr = " ID desc ";
- // DataSet da = pageData.QueryDataTable();
- // dt = da.Tables[0];
- // if (dt.Rows.Count > 0)
- // {
- // this.Invoke(new UpdateControl(delegate()
- // {
- // #region
- // 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();
- // dgvr.Cells.Add(cell);
- // cell = new DataGridViewTextBoxCell();
- // cell.Value = dt.Rows[i]["Callw_Telephone"].ToString();
- // dgvr.Cells.Add(cell);
- // cell = new DataGridViewTextBoxCell();
- // cell.Value = Convert.ToDateTime(dt.Rows[i]["Callw_DateTime"]).ToString("yyyy-MM-dd");
- // dgvr.Cells.Add(cell);
- // cell = new DataGridViewTextBoxCell();
- // cell.Value = dt.Rows[i]["Cus_Type"].ToString() == "" ? "其它电话来电" : dt.Rows[i]["Cus_Type"].ToString();
- // dgvr.Cells.Add(cell);
- // this.dgv.Rows.Add(dgvr);
- // dgv.ClearSelection();
- // }
- // #endregion
- // }));
- // }
- // });
- // try
- // {
- // this.ucPagerEx1.TbDataSource = dt;
- // }
- // catch { }
- // return pageData.TotalCount;
- //}
- }
- }
|