protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int userID = BLL.Util.GetLoginUserID(); Entities.EmployeeAgent employeeagent = BLL.EmployeeAgent.Instance.GetEmployeeAgentByUserID(userID); //不是西安 if (employeeagent == null || employeeagent.RegionID != 2) { total_count.Text = "0"; objecttype.Text = "--"; n_entered.Text = "0"; n_entered_out.Text = "0"; n_answered.Text = "0"; pc_n_answered.Text = "0.00%"; pc_n_distrib_in_tr.Text = "0.00%"; av_t_answered.Text = "0.00"; return; } if (string.IsNullOrEmpty(BusinessType) || string.IsNullOrEmpty(StartTime) || string.IsNullOrEmpty(EndTime) || string.IsNullOrEmpty(ShowTime)) { return; } else { BindData(); } } }
/// <summary> /// 增加一条数据 /// </summary> public int Insert(Entities.EmployeeAgent model) { SqlParameter[] parameters = { new SqlParameter("@RecID", SqlDbType.Int, 4), new SqlParameter("@UserID", SqlDbType.Int, 4), new SqlParameter("@AgentNum", SqlDbType.VarChar, 50), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@CreateUserID", SqlDbType.Int, 4), new SqlParameter("@BGID", SqlDbType.Int, 4), new SqlParameter("@RegionID", SqlDbType.Int, 4), new SqlParameter("@BusinessType", SqlDbType.Int, 4) }; parameters[0].Direction = ParameterDirection.Output; parameters[1].Value = model.UserID; parameters[2].Value = model.AgentNum; parameters[3].Value = model.CreateTime; parameters[4].Value = model.CreateUserID; parameters[5].Value = model.BGID; parameters[6].Value = model.RegionID; parameters[7].Value = model.BusinessType; SqlHelper.ExecuteNonQuery(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_EMPLOYEEAGENT_INSERT, parameters); return((int)parameters[0].Value); }
/// 获取用户信息 /// <summary> /// 获取用户信息 /// </summary> private void GetEmployeeAgentInfo() { Entities.EmployeeAgent model = BLL.EmployeeAgent.Instance.GetEmployeeAgentByUserID(int.Parse(UserID)); if (model != null) { //设置区域 if (model.RegionID == 1) { this.rdo_areaid_1.Checked = true; } else if (model.RegionID == 2) { this.rdo_areaid_2.Checked = true; } //设置所属业务 if ((CommonFunction.ObjectToInteger(model.BusinessType) & (int)BusinessTypeEnum.CC) == (int)BusinessTypeEnum.CC) { this.ckb_businesstype_1.Checked = true; } if ((CommonFunction.ObjectToInteger(model.BusinessType) & (int)BusinessTypeEnum.IM) == (int)BusinessTypeEnum.IM) { this.ckb_businesstype_2.Checked = true; } //设置所属分组 AtGroupID = model.BGID.ToString(); } txtAgentNum.InnerText = string.IsNullOrEmpty(AgentNum) ? BLL.EmployeeAgent.Instance.GenNewAgentID(genNewAgentID_StartPoint) : AgentNum; }
private void GetGroupInfo() { //所属分组 Entities.EmployeeAgent model = BLL.EmployeeAgent.Instance.GetEmployeeAgentByUserID(int.Parse(UserID)); if (model != null) { AtGroupID = model.BGID.ToString(); AreaID = model.RegionID.ToString(); } //管辖分组 Entities.QueryUserGroupDataRigth query = new Entities.QueryUserGroupDataRigth(); query.UserID = int.Parse(UserID); int totalCount = 0; DataTable dt = BLL.UserGroupDataRigth.Instance.GetUserGroupDataRigth(query, "", 1, 1000, out totalCount); int i = 0; foreach (DataRow dr in dt.Rows) { ManagerGroupIDs += dr["BGID"].ToString() + ","; } if (ManagerGroupIDs != "") { ManagerGroupIDs = ManagerGroupIDs.Substring(0, ManagerGroupIDs.Length - 1); } }
private void SaveEmployeeAgent(int userid, int btype) { Entities.EmployeeAgent model = BLL.EmployeeAgent.Instance.GetEmployeeAgentByUserID(userid); if (model != null) { //存在,更新 model.AgentNum = AgentNum; model.BGID = int.Parse(AtGroupID); model.RegionID = int.Parse(AreaID); model.BusinessType = btype; BLL.EmployeeAgent.Instance.Update(model); BLL.Loger.Log4Net.Info("【用户基本信息设置】3.更新[UserID=" + userid + "]的用户的[AgentNum(工号)=" + AgentNum + "],[RegionID(所属区域)=" + AreaID + "],[BusinessType(所属业务)=" + btype + "],[BGID(所属分组)=" + AtGroupID + "]"); //清空另一个区域的管辖分组数据 //BLL.UserGroupDataRigth.Instance.DeleteErrorData(userid); } else { //不存在,插入 model = new Entities.EmployeeAgent(); model.AgentNum = AgentNum; model.BGID = int.Parse(AtGroupID); model.CreateTime = DateTime.Now; model.CreateUserID = BLL.Util.GetLoginUserID(); model.UserID = UserID; model.RegionID = int.Parse(AreaID); model.BusinessType = btype; BLL.EmployeeAgent.Instance.Insert(model); BLL.Loger.Log4Net.Info("【用户基本信息设置】3.新增用户[UserID=" + userid + "],[AgentNum(工号)=" + AgentNum + "],[RegionID(所属区域)=" + AreaID + "],[BusinessType(所属业务)=" + btype + "],[BGID(所属分组)=" + AtGroupID + "]"); } }
private Entities.EmployeeAgent LoadSingleEmployeeAgent(DataRow row) { Entities.EmployeeAgent model = new Entities.EmployeeAgent(); if (row["RecID"].ToString() != "") { model.RecID = int.Parse(row["RecID"].ToString()); } if (row["UserID"].ToString() != "") { model.UserID = int.Parse(row["UserID"].ToString()); } if (row["BGID"].ToString() != "") { model.BGID = int.Parse(row["BGID"].ToString()); } model.AgentNum = row["AgentNum"].ToString(); if (row["CreateTime"].ToString() != "") { model.CreateTime = DateTime.Parse(row["CreateTime"].ToString()); } if (row["CreateUserID"].ToString() != "") { model.CreateUserID = int.Parse(row["CreateUserID"].ToString()); } if (row["RegionID"].ToString() != "") { model.RegionID = int.Parse(row["RegionID"].ToString()); } if (row["BusinessType"].ToString() != "") { model.BusinessType = int.Parse(row["BusinessType"].ToString()); } return(model); }
/// <summary> /// 存储分组数据 /// 强斐 /// 2014-10-11 /// </summary> /// <param name="model"></param> /// <returns></returns> private Entities.ExamOnline SaveBgid(Entities.ExamOnline model) { Entities.EmployeeAgent agent = EmployeeAgent.Instance.GetEmployeeAgentByUserID(model.ExamPersonID); if (agent != null) { model.BGID = agent.BGID; } return(model); }
/// <summary> /// 通过UserID获取所在业务组ID /// </summary> /// <returns>成功找到返回BGID,否则返回0</returns> public int GetSelfBGIDByUserID(int userID) { int bgid = 0; Entities.EmployeeAgent model = BLL.EmployeeAgent.Instance.GetEmployeeAgentByUserID(userID); if (model != null && model.BGID != null) { bgid = (int)model.BGID; } return(bgid); }
protected void Page_Load(object sender, EventArgs e) { Entities.EmployeeAgent model = BLL.EmployeeAgent.Instance.GetEmployeeAgentByUserID(Convert.ToInt32(RequestUserID)); if (model == null) { Response.Write("ERROR:用户不存在"); return; } string operStr = string.Empty; VisitBusinessTypeEnum bt = (VisitBusinessTypeEnum)CommonFunction.ObjectToInteger(RequestBussinessType); if (bt != VisitBusinessTypeEnum.S0_其他系统 && bt != VisitBusinessTypeEnum.None) { string url = ""; url = BLL.CallRecord_ORIG_Business.Instance.GetTaskUrl(RequestTaskID, RequestBGID, RequestSCID); url = BLL.CallRecord_ORIG_Business.Instance.GetViewUrl(RequestTaskID, url); operStr += url; } else { string url = ""; url = BLL.CallRecord_ORIG_Business.Instance.GetTaskUrl(RequestTaskID, RequestBGID, RequestSCID); if (!string.IsNullOrEmpty(url)) { url = BLL.CallRecord_ORIG_Business.Instance.GetViewUrl(RequestTaskID, url); //如果是惠买车业务 if (BLL.Util.IsMatchBGIDAndSCID(RequestBGID, RequestSCID, "EPEmbedCC_HMCBGIDSCID"))//惠买车 { operStr += GetEPURL(YPFanXianURL, url); } else if (BLL.Util.IsMatchBGIDAndSCID(RequestBGID, RequestSCID, "EasySetOff_BGIDSCID"))//精准广告 { operStr += GetEasyOffURL(url); } else if (BLL.Util.IsMatchBGIDAndSCID(RequestBGID, RequestSCID, "CarFinancial_BGIDSCID"))//易车车贷 { operStr += GetCarFinancialURL(url); } else if (BLL.Util.IsMatchBGIDAndSCID(RequestBGID, RequestSCID, "EasyPass_BGIDSCID"))//易湃业务 { operStr += GetEasyPassURL(RequestTaskID); } else { operStr += url; } } } Response.Redirect(operStr); }
/// 查询用户的区域信息 /// <summary> /// 查询用户的区域信息 /// </summary> /// <param name="UserID"></param> /// <returns></returns> public int GetEmployeeAgentRegionID(int UserID) { Entities.EmployeeAgent user = GetEmployeeAgentByUserID(UserID); int?r = user.RegionID; if (r.HasValue) { return(r.Value); } else { return(-1); } }
/// <summary> /// 绑定录音共享2级分类 /// </summary> private void BindKCID2() { int currentUserId = BLL.Util.GetLoginUserID(); Entities.EmployeeAgent model = BLL.EmployeeAgent.Instance.GetEmployeeAgentByUserID(currentUserId); DataTable dt = BLL.KnowledgeCategory.Instance.GetCategoryByPName("录音共享", Convert.ToInt32(model.RegionID)); if (dt != null && dt.Rows.Count != 0) { selKCID2.DataSource = dt; selKCID2.DataTextField = "Name"; selKCID2.DataValueField = "KCID"; selKCID2.DataBind(); } selKCID2.Items.Insert(0, new ListItem("请选择", "-1")); }
private void SaveEmpleeInfo() { #region 判断工号是否已被使用,如果已经被使用,把别人的设置为空 Entities.EmployeeAgent model = new Entities.EmployeeAgent(); Entities.QueryEmployeeAgent query = new Entities.QueryEmployeeAgent(); query.AgentNum = AgentNum; int total = 0; DataTable dt = BLL.EmployeeAgent.Instance.GetEmployeeAgent(query, "", 1, 10, out total); if (dt.Rows.Count > 0 && dt.Rows[0]["UserID"].ToString() != UserID) { //与别人的工号有重复,把别人的置为空 model = BLL.EmployeeAgent.Instance.GetEmployeeAgentByUserID(int.Parse(dt.Rows[0]["UserID"].ToString())); if (model != null) { model.AgentNum = ""; BLL.EmployeeAgent.Instance.Update(model); } } #endregion model = BLL.EmployeeAgent.Instance.GetEmployeeAgentByUserID(int.Parse(UserID)); if (model != null) { //存在,更新 model.AgentNum = AgentNum; model.BGID = int.Parse(AtGroupID); model.RegionID = int.Parse(AreaID); BLL.EmployeeAgent.Instance.Update(model); } else { //不存在,插入 model = new Entities.EmployeeAgent(); model.AgentNum = AgentNum; model.BGID = int.Parse(AtGroupID); model.CreateTime = DateTime.Now; model.CreateUserID = BLL.Util.GetLoginUserID(); model.UserID = int.Parse(UserID); model.RegionID = int.Parse(AreaID); BLL.EmployeeAgent.Instance.Insert(model); } }
public bool isXiAn = false; //当前登录人所属区域 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int currentUserID = BLL.Util.GetLoginUserID(); right_Export = BLL.Util.CheckRight(currentUserID, "SYS024BUT600105"); Entities.EmployeeAgent agent = BLL.EmployeeAgent.Instance.GetEmployeeAgentByUserID(currentUserID); if (agent != null) { if (agent.RegionID == 2) { isXiAn = true; } } } }
//坐席表 插日志 private void employeeAgentInsertLog(Entities.EmployeeAgent oldModel, Entities.EmployeeAgent newModel) { string userLogStr = string.Empty; string logStr = string.Empty; Hashtable ht_FieldName = new Hashtable(); ht_FieldName.Add("UserID", "员工姓名"); ht_FieldName.Add("AgentNum", "工号"); ht_FieldName.Add("CreateTime", "编辑时间"); ht_FieldName.Add("CreateUserID", "编辑人"); BLL.GetLogDesc.ht_FieldName = ht_FieldName; Hashtable ht_FieldType = new Hashtable(); ht_FieldType.Add("UserID", "UserID"); ht_FieldType.Add("CreateUserID", "UserID"); BLL.GetLogDesc.ht_FieldType = ht_FieldType; if (oldModel == null)//为空,则是新增 { //插入日志 BLL.GetLogDesc.getAddLogInfo(newModel, out userLogStr); logStr = "坐席表新增:" + userLogStr; } else //不为空,则是编辑 { //插入日志 BLL.GetLogDesc.getCompareLogInfo(oldModel, newModel, out userLogStr); logStr = "坐席表编辑:" + userLogStr; } if (userLogStr != string.Empty) { BLL.Util.InsertUserLog(logStr); } }
/// <summary> /// 更新一条数据 /// </summary> public int Update(Entities.EmployeeAgent model) { SqlParameter[] parameters = { new SqlParameter("@UserID", SqlDbType.Int, 4), new SqlParameter("@AgentNum", SqlDbType.VarChar, 50), new SqlParameter("@CreateUserID", SqlDbType.Int, 4), new SqlParameter("@BGID", SqlDbType.Int, 4), new SqlParameter("@RegionID", SqlDbType.Int, 4), new SqlParameter("@BusinessType", SqlDbType.Int, 4) }; parameters[0].Value = model.UserID; parameters[1].Value = model.AgentNum; parameters[2].Value = model.CreateUserID; parameters[3].Value = model.BGID; parameters[4].Value = model.RegionID; parameters[5].Value = model.BusinessType; return(SqlHelper.ExecuteNonQuery(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_EMPLOYEEAGENT_UPDATE, parameters)); }
private void AddNoDisturbData(out string msg) { msg = string.Empty; try { int valPhoneNumIsNoDisturb = BLL.BlackWhiteList.Instance.PhoneNumIsNoDisturb(PhoneNum); if (valPhoneNumIsNoDisturb == 2) { int userid = BLL.Util.GetLoginUserID(); //增加免打扰号码 Entities.BlackWhiteList model = new Entities.BlackWhiteList(); model.Type = 0; model.PhoneNum = PhoneNum; model.EffectiveDate = DateTime.Now; model.ExpiryDate = GetExpiryDate(ExpiryDate); model.CallType = int.Parse(CallType); int cdids; if (int.TryParse(CDIDS, out cdids)) { model.CDIDS = cdids; } model.Reason = Reason; model.SynchrodataStatus = 0; model.CreateUserId = userid; model.CreateDate = DateTime.Now; model.Status = 0; long callid; if (long.TryParse(CallID, out callid)) { model.CallID = callid; } int calloutndtype; if (int.TryParse(NoDisturbReason, out calloutndtype)) { model.CallOutNDType = calloutndtype; } Entities.EmployeeAgent employeeagent = BLL.EmployeeAgent.Instance.GetEmployeeAgentByUserID(userid); if (employeeagent != null && employeeagent.BGID.HasValue) { model.BGID = employeeagent.BGID.Value; } int retVal = BLL.BlackWhiteList.Instance.AddNoDisturbData(model); if (retVal > 0) { msg = "{result:'yes',msg:'保存成功'}"; } else { msg = "{result:'no',msg:'操作失败,请稍后再试'}"; } } else if (valPhoneNumIsNoDisturb == -1) { //修改免打扰号码,需要传递RecID int backRecID = BLL.BlackWhiteList.Instance.GetRecIDByPhoneNumberAndType(PhoneNum, 0); if (backRecID > 0) { UpdateNoDisturbData(out msg, backRecID); } else { msg = "{result:'no',msg:'没有找到主键RecID,请稍后再试'}"; } } else if (valPhoneNumIsNoDisturb == 0 || valPhoneNumIsNoDisturb == 1) { msg = "{result:'no',msg:'此号码已被设置为免打扰号码,不能重复添加'}"; } else { msg = "{result:'no',msg:'对号码的判断失败,请稍后再试'}"; } } catch (Exception ex) { msg = "{result:'no',msg:'" + ex.Message + "'}"; } }
/// <summary> /// 更新免打扰记录信息 /// </summary> /// <param name="msg"></param> private void UpdateNoDisturbData(out string msg, int updateRecID = 0) { msg = string.Empty; try { int recid = 0; if (int.TryParse(RecId, out recid) || updateRecID > 0) { if (BLL.BlackWhiteList.Instance.PhoneNumIsNoDisturb(PhoneNum) == 2) { //增加免打扰号码 //AddNoDisturbData(out msg); msg = "{result:'no',msg:'此号码还不是免打扰号码,请将此号码先添加为免打扰号码'}"; } else { int userid = BLL.Util.GetLoginUserID();; if (updateRecID > 0) { recid = updateRecID; } Entities.BlackWhiteList model = BLL.BlackWhiteList.Instance.GetModel(recid); model.RecId = recid; model.PhoneNum = PhoneNum; model.CallType = int.Parse(CallType); if (model.Status == -1 || model.Status == 1) { model.CreateDate = DateTime.Now; model.CreateUserId = userid; } DateTime expireydate = GetExpiryDate(ExpiryDate); if (expireydate.ToString("yyyy-MM-dd").CompareTo(DateTime.Now.ToString("yyyy-MM-dd")) >= 0) { model.Status = 0; } else { model.Status = 1; } model.ExpiryDate = expireydate; int cdids; if (int.TryParse(CDIDS, out cdids)) { model.CDIDS = cdids; } model.Reason = Reason; model.UpdateDate = DateTime.Now; model.UpdateUserId = userid; model.SynchrodataStatus = 1; long callid; if (long.TryParse(CallID, out callid)) { model.CallID = callid; } else if (updateRecID > 0) { model.CallID = null; } int calloutndtype; if (int.TryParse(NoDisturbReason, out calloutndtype)) { model.CallOutNDType = calloutndtype; } Entities.EmployeeAgent employeeagent = BLL.EmployeeAgent.Instance.GetEmployeeAgentByUserID(userid); if (employeeagent != null && employeeagent.BGID.HasValue) { model.BGID = employeeagent.BGID.Value; } bool retVal = BLL.BlackWhiteList.Instance.UpdateNoDisturbData(model); if (retVal) { msg = "{result:'yes',msg:'保存成功'}"; } else { msg = "{result:'no',msg:'操作失败,请稍后再试'}"; } } } else { msg = "{result:'no',msg:'参数异常'}"; } } catch (Exception ex) { msg = "{result:'no',msg:'" + ex.Message + "'}"; } }
/// <summary> /// 当时单个修改时,保存工号和数据权限 /// </summary> private void ModifyOther() { int retNum = 0; #region 修改工号 Entities.EmployeeAgent model = new Entities.EmployeeAgent(); Entities.EmployeeAgent oldModel = null; Entities.QueryEmployeeAgent query = new Entities.QueryEmployeeAgent(); query.UserID = int.Parse(UserIDs); int totalCount = 0; DataTable dt = BLL.EmployeeAgent.Instance.GetEmployeeAgent(query, "", 1, 10, out totalCount); oldModel = BLL.EmployeeAgent.Instance.GetEmployeeAgentByUserID(int.Parse(UserIDs)); //*add by qizq 2013-7-16 如果工号已存在,删除工号员工对应关系(程序走到这步说明用户已经选择要替换已有工号对应员工) if (!string.IsNullOrEmpty(AgentNum)) { Entities.QueryEmployeeAgent queryHave = new Entities.QueryEmployeeAgent(); queryHave.AgentNum = AgentNum; int total = 0; DataTable dtHave = BLL.EmployeeAgent.Instance.GetEmployeeAgent(queryHave, "", 1, 10, out total); if (total != 0) { if (dtHave.Rows[0]["UserID"].ToString() != UserIDs) { BLL.EmployeeAgent.Instance.Delete(int.Parse(dtHave.Rows[0]["RecID"].ToString())); string logStr = "删除用户工号:把" + BLL.Util.GetNameInHRLimitEID(Convert.ToInt32(dtHave.Rows[0]["UserID"].ToString())) + "的工号" + AgentNum + "删除"; BLL.Util.InsertUserLog(logStr); } } } //* if (dt == null || dt.Rows.Count == 0) { model.UserID = int.Parse(UserIDs); model.AgentNum = AgentNum; model.CreateTime = DateTime.Now; model.CreateUserID = BLL.Util.GetLoginUserID(); //如果没有,则插入 if (model.AgentNum != "") { retNum = BLL.EmployeeAgent.Instance.Insert(model); model.RecID = retNum; employeeAgentInsertLog(null, model); } } else { //如果有,则修改 if (dt.Rows[0]["AgentNum"].ToString() != AgentNum) { //有变动,要修改 model = BLL.EmployeeAgent.Instance.GetEmployeeAgent(int.Parse(dt.Rows[0]["RecID"].ToString())); model.AgentNum = AgentNum; if (model.AgentNum != "") { retNum = BLL.EmployeeAgent.Instance.Update(model); employeeAgentInsertLog(oldModel, model); } //*add by qizq2013-7-16如果工号为空,删除人员坐席对应关系。 else { retNum = BLL.EmployeeAgent.Instance.Delete(model.RecID); string logStr = "删除用户工号:把" + BLL.Util.GetNameInHRLimitEID(Convert.ToInt32(oldModel.UserID)) + "的工号" + oldModel.AgentNum + "删除"; BLL.Util.InsertUserLog(logStr); } //* } } #endregion #region 修改数据权限 Entities.UserDataRigth modeldata = new Entities.UserDataRigth(); Entities.UserDataRigth oldModel_UserData = null; Entities.QueryUserDataRigth dataQuery = new Entities.QueryUserDataRigth(); dataQuery.UserID = int.Parse(UserIDs); DataTable datadt = BLL.UserDataRigth.Instance.GetUserDataRigth(dataQuery, "", 1, 10, out totalCount); oldModel_UserData = BLL.UserDataRigth.Instance.GetUserDataRigth(int.Parse(UserIDs)); if (datadt == null || datadt.Rows.Count == 0) { modeldata.UserID = int.Parse(UserIDs); modeldata.RightType = int.Parse(RightType); modeldata.CreateTime = DateTime.Now; modeldata.CreateUserID = BLL.Util.GetLoginUserID(); //如果没有,则插入 BLL.UserDataRigth.Instance.Insert(modeldata); userDataRigthInsertLog(null, modeldata); } else { //如果有,则修改 if (datadt.Rows[0]["RightType"].ToString() != RightType) { //如果数据权限有变动,则更新 modeldata = BLL.UserDataRigth.Instance.GetUserDataRigth(int.Parse(datadt.Rows[0]["UserID"].ToString())); modeldata.RightType = int.Parse(RightType); retNum = BLL.UserDataRigth.Instance.Update(modeldata); userDataRigthInsertLog(oldModel_UserData, modeldata); } } #endregion #region 分组设置 if (!string.IsNullOrEmpty(GroupRightStr)) { //先删除用户的分组 BLL.UserGroupDataRigth.Instance.DeleteByUserID(int.Parse(UserIDs)); BLL.Util.InsertUserLog("删除用户ID为:" + UserIDs + ",姓名为:" + BLL.Util.GetNameInHRLimitEID(int.Parse(UserIDs)) + " 下面的所属业务组"); int userId = BLL.Util.GetLoginUserID(); string[] groupRightArry = GroupRightStr.Split(';'); foreach (string groupRight in groupRightArry) { string[] arry = groupRight.Split('|'); Entities.UserGroupDataRigth groupDataRigthModel = new Entities.UserGroupDataRigth(); groupDataRigthModel.CreateTime = DateTime.Now; groupDataRigthModel.CreateUserID = userId; groupDataRigthModel.RightType = int.Parse(arry[1]); groupDataRigthModel.UserID = int.Parse(UserIDs); groupDataRigthModel.BGID = int.Parse(arry[0]); int returnRecID = BLL.UserGroupDataRigth.Instance.Insert(groupDataRigthModel); groupDataRigthModel.RecID = returnRecID; userGroupDataRigthInsertLog(null, groupDataRigthModel); } } #endregion }
public DataTable GetAgentInfoByCondition(string Verifycode, AgentInfoCondition AgentInfoCondition, int PageSize, int PageIndex, ref int RecordCount, ref string msg) { try { #region 记接口调用日志 StringBuilder infoSb = new StringBuilder(); infoSb.Append("调用接口GetAgentInfoByCondition!"); infoSb.Append(";验证码:" + Verifycode); if (AgentInfoCondition == null) { infoSb.Append(";条件为空;"); } else { infoSb.Append(";条件:{LoginUserID:" + AgentInfoCondition.LoginUserID + ",UserID:" + AgentInfoCondition.UserID + ",TrueName:" + AgentInfoCondition.TrueName + ",ADName:" + AgentInfoCondition.ADName + "},"); } infoSb.Append(";PageSize;" + PageSize); infoSb.Append(";PageIndex;" + PageIndex); BLL.Loger.Log4Net.Info(infoSb.ToString()); #endregion RecordCount = 0; if (BLL.CallRecord_ORIG_Authorizer.Instance.Verify(Verifycode, 0, ref msg, "根据当前登录者ID或真实姓名,查询坐席信息,授权失败。")) { QueryEmployeeSuper query = new QueryEmployeeSuper(); if (AgentInfoCondition != null) { if (AgentInfoCondition.LoginUserID > 0) { Entities.EmployeeAgent model = BLL.EmployeeAgent.Instance.GetEmployeeAgentByUserID(AgentInfoCondition.LoginUserID); if (model != null && model.BGID != null && model.BGID > 0) { query.BGID = model.BGID.Value; } } if (AgentInfoCondition.BGID > 0) { query.BGID = AgentInfoCondition.BGID; } if (!string.IsNullOrEmpty(AgentInfoCondition.TrueName)) { query.TrueName = AgentInfoCondition.TrueName.Trim(); } if (AgentInfoCondition.UserID > 0) { query.UserID = AgentInfoCondition.UserID; } if (AgentInfoCondition.ADName != "") { query.ADName = AgentInfoCondition.ADName.Trim(); } query.OnlyCCDepart = true; } query.PartIDType = "PartID"; DataTable dt = BLL.EmployeeSuper.Instance.GetEmployeeSuper(query, "", PageIndex, PageSize, out RecordCount); return(dt); } else { BLL.Loger.Log4Net.Info("GetAgentInfoByCondition验证失败!msg=" + msg); return(null); } } catch (Exception ex) { msg = ex.Message; BLL.Loger.Log4Net.Info("GetAgentInfoByCondition运行报错!msg=" + ex.StackTrace); return(null); } }
/// 发送短信 /// <summary> /// 发送短信 /// </summary> /// <param name="msg"></param> public void SendSMSToPeople(out string msg) { msg = string.Empty; try { string[] telArry = Tels.Split(','); if (telArry.Length == 0) { msg = "电话号码不能为空"; msg = "{result:'false',msg:'" + msg + "'}"; return; } if (telArry.Length > 2) { msg = "电话号码不能超过3个"; msg = "{result:'false',msg:'" + msg + "'}"; return; } foreach (string str in telArry) { if (!string.IsNullOrEmpty(str)) { string telstr = str.Trim(); if (!BLL.Util.IsHandset(telstr)) { msg = "电话(" + telstr + ")不符合规则"; msg = "{result:'false',msg:'" + msg + "'}"; return; } //计算客户id string custid = CustID; if (string.IsNullOrEmpty(custid)) { custid = BLL.CustBasicInfo.Instance.GetMaxNewCustBasicInfoByTel(telstr); } //插入发送日志 Entities.SendSMSLog smsLogModel = new Entities.SendSMSLog(); smsLogModel.CreateUserID = BLL.Util.GetLoginUserID(); smsLogModel.CustID = custid; smsLogModel.Mobile = telstr; smsLogModel.SendContent = SendContent; smsLogModel.SendTime = DateTime.Now; smsLogModel.TemplateID = CommonFunction.ObjectToInteger(TemplateID, -1); BLL.SendSMSLog.Instance.Insert(smsLogModel); //发送短信 int status = -1; string md5 = SMSServiceHelper.Instance.MixMd5(telstr, SendContent); int msgid = SMSServiceHelper.Instance.SendMsgImmediately(telstr, SendContent, DateTime.Now.AddHours(1), md5); if (msgid > 0) { //插入发送短信记录 status = 0; BLL.Util.InsertUserLog("给手机(" + telstr + ")发送短信成功"); msg = "{result:'true',msg:''}"; } else { msg = BLL.Util.GetEnumOptText(typeof(Entities.SendSMSInfo), msgid); BLL.Util.InsertUserLog("给手机(" + telstr + ")发送短信失败【错误信息:" + msg + "】"); msg = "{result:'false',msg:'" + msg + "'}"; } //插入发送短信记录 Entities.SMSSendHistory smssendhistory = new Entities.SMSSendHistory(); smssendhistory.CreateUserID = BLL.Util.GetLoginUserID(); smssendhistory.CustID = custid; smssendhistory.CRMCustID = CRMCustID; Entities.EmployeeAgent agent = new Entities.EmployeeAgent(); agent = BLL.EmployeeAgent.Instance.GetEmployeeAgentByUserID(Convert.ToInt32(smssendhistory.CreateUserID)); if (agent != null && agent.BGID > 0) { smssendhistory.BGID = agent.BGID; } smssendhistory.TemplateID = CommonFunction.ObjectToInteger(TemplateID, -1); smssendhistory.TaskType = CommonFunction.ObjectToInteger(TaskType, -1); smssendhistory.TaskID = TaskID; smssendhistory.Phone = telstr; smssendhistory.Content = SendContent; smssendhistory.CreateTime = DateTime.Now; smssendhistory.Status = status; BLL.SMSSendHistory.Instance.Insert(smssendhistory); //成功后返回 if (status == 0) { msg = "{result:'true',msg:'',SMSSendHistoryRecID:'" + smssendhistory.RecID + "'}"; } } } } catch (Exception ex) { msg = "{result:'false',msg:'" + ex.Message + "'}"; } }
/// <summary> /// 处理导入的数据 /// </summary> private bool DealDataImportedForBlack(string fileName, out string msg) { System.Diagnostics.Debug.WriteLine("[HandlerImport]DealDataImported begin..."); BLL.Loger.Log4Net.Info("[HandlerImport]DealDataImported begin..."); bool success = true; msg = ""; //(1)连接EXCEL文件 string ext = Path.GetExtension(fileName); string connStr = string.Empty; if (ext.ToLower() == ".xls") { connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + @fileName + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\""; } else { //throw new Exception("上传文件应为xls或者xlsx格式的文件"); //throw new Exception("上传文件应为xls格式的文件"); msg = "传文件应为xls格式的文件"; return(false); } List <BusinessTypeMod> modeBusinessType = new List <BusinessTypeMod>(); modeBusinessType = (List <BusinessTypeMod>)Newtonsoft.Json.JavaScriptConvert.DeserializeObject(BusinessTypeJSON, typeof(List <BusinessTypeMod>)); int userid = BLL.Util.GetLoginUserID(); Entities.EmployeeAgent employeeagent = BLL.EmployeeAgent.Instance.GetEmployeeAgentByUserID(userid); using (OleDbConnection conn = new OleDbConnection(connStr)) { conn.Open(); //返回Excel的架构,包括各个sheet表的名称,类型,创建时间和修改时间等 DataTable dtSheetName = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "Table" }); //包含excel中表名的字符串数组 string firstSheetName = dtSheetName.Rows[0]["TABLE_NAME"].ToString(); //读取第一个sheet填充数据sheetConfig.Name.Replace(".", "#") + "$" OleDbCommand command = new OleDbCommand("select * from [" + firstSheetName.Replace(".", "#") + "]", conn); IDataReader idr = command.ExecuteReader(); // string phone = Constant.STRING_INVALID_VALUE; //string IsReturnVisit = Constant.STRING_INVALID_VALUE; List <Entities.BlackWhiteList> myDataList = new List <Entities.BlackWhiteList>(); while (idr.Read()) { Entities.BlackWhiteList model = new Entities.BlackWhiteList(); try { model.Type = int.Parse(Type); if (!string.IsNullOrEmpty(idr[0].ToString().Trim())) { model.PhoneNum = idr[0].ToString().Trim(); } else { msg = "模板数据不能为空"; return(false); } if (!string.IsNullOrEmpty(idr[1].ToString().Trim())) { model.EffectiveDate = DateTime.Parse(idr[1].ToString().Trim()); } else { msg = "模板数据不能为空"; return(false); } if (!string.IsNullOrEmpty(idr[2].ToString().Trim())) { model.ExpiryDate = DateTime.Parse(idr[2].ToString().Trim()); } else { msg = "模板数据不能为空"; return(false); } if (!string.IsNullOrEmpty(idr[3].ToString().Trim())) { int calltype = 0; if (idr[3].ToString().Trim().Contains("呼入")) { calltype = 1; } if (idr[3].ToString().Trim().Contains("呼出")) { calltype += 2; } if (calltype == 0) { msg = "模板数据异常,请检查模板数据"; return(false); } else { model.CallType = calltype; } } else { msg = "模板数据不能为空"; return(false); } if (!string.IsNullOrEmpty(idr[4].ToString().Trim())) { string cidsReal = idr[4].ToString().Replace(",", ",").Trim(); string[] businessnameArr = cidsReal.Split(','); int cdids = 0; for (int i = 0; i < businessnameArr.Length; i++) { for (int j = 0; j < modeBusinessType.Count; j++) { if (modeBusinessType[j].BusinessName == businessnameArr[i]) { if (BLL.BlackWhiteList.Instance.IsPhoneNumberCDIDExist(model.PhoneNum, int.Parse(modeBusinessType[j].BusinessRightValue))) { msg = "电话号码已添加过,请核对数据"; return(false); } cdids += int.Parse(modeBusinessType[j].BusinessRightValue); } } } if (cdids == 0) { msg = "模板数据异常,请检查模板数据"; return(false); } else { model.CDIDS = cdids; } } else { msg = "模板数据不能为空"; return(false); } if (!string.IsNullOrEmpty(idr[5].ToString().Trim())) { model.Reason = idr[5].ToString().Trim(); } else { msg = "模板数据不能为空"; return(false); } } catch (Exception ex) { msg = "模板数据异常,请检查模板数据"; return(false); } model.SynchrodataStatus = 0; model.CreateUserId = userid; model.CreateDate = DateTime.Now; model.UpdateUserId = Constant.INT_INVALID_VALUE; model.UpdateDate = Constant.DATE_INVALID_VALUE; model.Status = 0; if (employeeagent != null && employeeagent.BGID.HasValue) { model.BGID = employeeagent.BGID.Value; } myDataList.Add(model); } DataTable dtBW = BLL.Util.ListToDataTable(myDataList); BLL.BlackWhiteList.Instance.ImportData(dtBW); //return success; } //FileInfo fi = new FileInfo(fileName); //fi.Delete(); ClearFiles(fileName); return(success); }
/// <summary> /// 处理导入的数据 /// </summary> private bool DealDataImported(string fileName, out string msg) { System.Diagnostics.Debug.WriteLine("[HandlerImport]DealDataImported begin..."); BLL.Loger.Log4Net.Info("[HandlerImport]DealDataImported begin..."); bool success = false; msg = ""; //(1)连接EXCEL文件 string ext = Path.GetExtension(fileName); string connStr = string.Empty; if (ext.ToLower() == ".xls") { connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + @fileName + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\""; } else { //throw new Exception("上传文件应为xls或者xlsx格式的文件"); throw new Exception("上传文件应为xls格式的文件"); } List <BusinessTypeMod> modeBusinessType = new List <BusinessTypeMod>(); modeBusinessType = (List <BusinessTypeMod>)Newtonsoft.Json.JavaScriptConvert.DeserializeObject(BusinessTypeJSON, typeof(List <BusinessTypeMod>)); int userid = BLL.Util.GetLoginUserID(); Entities.EmployeeAgent employeeagent = BLL.EmployeeAgent.Instance.GetEmployeeAgentByUserID(userid); DataTable tbNoDisturbReason = BLL.Util.GetEnumDataTable(typeof(Entities.NoDisturbReason)); using (OleDbConnection conn = new OleDbConnection(connStr)) { conn.Open(); //返回Excel的架构,包括各个sheet表的名称,类型,创建时间和修改时间等 DataTable dtSheetName = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "Table" }); //包含excel中表名的字符串数组 string firstSheetName = dtSheetName.Rows[0]["TABLE_NAME"].ToString(); //读取第一个sheet填充数据sheetConfig.Name.Replace(".", "#") + "$" OleDbCommand command = new OleDbCommand("select * from [" + firstSheetName.Replace(".", "#") + "]", conn); IDataReader idr = command.ExecuteReader(); // string phone = Constant.STRING_INVALID_VALUE; //string IsReturnVisit = Constant.STRING_INVALID_VALUE; List <Entities.BlackWhiteList> myDataList = new List <Entities.BlackWhiteList>(); int rowIndex = 0; while (idr.Read()) { rowIndex++; Entities.BlackWhiteList model = new Entities.BlackWhiteList(); int backVal; string innerMsg = ""; try { //1.电话号码验证 if (!string.IsNullOrEmpty(idr[0].ToString().Trim())) { if (!BLL.Util.IsNumber(idr[0].ToString().Trim().Replace("-", ""))) { innerMsg += "第" + rowIndex + "行数据:" + "“电话号码”格式不正确,只能由数字组成<br/>"; msg += innerMsg; continue; } backVal = BLL.BlackWhiteList.Instance.PhoneNumIsNoDisturb(idr[0].ToString().Trim().Replace("-", "")); if (backVal == 0 || backVal == 1) //没有考虑到已删除数据的处理 { innerMsg += "第" + rowIndex + "行数据:" + "“电话号码”(" + idr[0] + ")已添加过,请核对数据<br/>"; msg += innerMsg; continue; } model.PhoneNum = idr[0].ToString().Trim().Replace("-", ""); } else { innerMsg += "第" + rowIndex + "行数据:" + "“电话号码”不能为空<br/>"; msg += innerMsg; continue; } //2.话务ID验证(可空) if (!string.IsNullOrEmpty(idr[1].ToString().Trim())) { if (!BLL.Util.IsNumber(idr[1].ToString().Trim())) { innerMsg += "第" + rowIndex + "行数据:" + "“话务ID”格式不正确,只能由数字组成<br/>"; msg += innerMsg; continue; } model.CallID = Convert.ToInt64(idr[1].ToString().Trim()); } //3.生效时间 if (!string.IsNullOrEmpty(idr[2].ToString().Trim())) { DateTime datetime; if (DateTime.TryParse(idr[2].ToString().Trim(), out datetime)) { model.EffectiveDate = datetime; } else { innerMsg += "第" + rowIndex + "行数据:" + "“生效时间”不是正确的日期时间格式<br/>"; msg += innerMsg; continue; } } else { innerMsg += "第" + rowIndex + "行数据:" + "“生效时间”不能为空<br/>"; msg += innerMsg; continue; } //4.过期时间 if (!string.IsNullOrEmpty(idr[3].ToString().Trim())) { DateTime datetime; if (DateTime.TryParse(idr[3].ToString().Trim(), out datetime)) { model.ExpiryDate = datetime; } else { innerMsg += "第" + rowIndex + "行数据:" + "“过期时间”不是正确的日期时间格式<br/>"; msg += innerMsg; continue; } } else { innerMsg += "第" + rowIndex + "行数据:" + "“过期时间”不能为空<br/>"; msg += innerMsg; continue; } //5.;类型 if (!string.IsNullOrEmpty(idr[4].ToString().Trim())) { int calltype = 0; if (idr[4].ToString().Trim().Contains("呼入")) { calltype = 1; //6.对应业务 if (!string.IsNullOrEmpty(idr[5].ToString().Trim())) { string cidsReal = idr[5].ToString().Replace(",", ",").Trim(); string[] businessnameArr = cidsReal.Split(','); int cdids = 0; for (int i = 0; i < businessnameArr.Length; i++) { for (int j = 0; j < modeBusinessType.Count; j++) { if (modeBusinessType[j].BusinessName == businessnameArr[i]) { cdids += int.Parse(modeBusinessType[j].BusinessRightValue); } } } if (cdids == 0) { innerMsg += "第" + rowIndex + "行数据:" + "“对应业务”数据异常,请检查数据<br/>"; msg += innerMsg; continue; } else { model.CDIDS = cdids; } } else { innerMsg += "第" + rowIndex + "行数据:" + "“对应业务”数据不能为空<br/>"; msg += innerMsg; continue; } } if (idr[4].ToString().Trim().Contains("呼出")) { calltype += 2; //7.原因 if (!string.IsNullOrEmpty(idr[6].ToString().Trim())) { bool hasVal = false; foreach (DataRow row in tbNoDisturbReason.Rows) { if (row["name"].ToString() == idr[6].ToString().Trim()) { model.CallOutNDType = int.Parse(row["value"].ToString()); hasVal = true; continue; } } if (!hasVal) { innerMsg += "第" + rowIndex + "行数据:" + "“原因”数据不正确,没有相匹配的原因数据<br/>"; msg += innerMsg; continue; } } else { innerMsg += "第" + rowIndex + "行数据:" + "“原因”数据不能为空<br/>"; msg += innerMsg; continue; } } if (calltype == 0) { innerMsg += "第" + rowIndex + "行数据:" + "“类型”数据异常,请检查数据<br/>"; msg += innerMsg; continue; } else { model.CallType = calltype; } } else { innerMsg += "第" + rowIndex + "行数据:" + "“类型”不能为空<br/>"; msg += innerMsg; continue; } //8.备注(可空) if (!string.IsNullOrEmpty(idr[7].ToString().Trim())) { model.Reason = idr[7].ToString().Trim(); } } catch (Exception eex) { innerMsg += "第" + rowIndex + "行数据:" + "部分数据异常,请检查数据<br/>"; msg += innerMsg; continue; } model.Type = int.Parse(Type); model.SynchrodataStatus = 0; model.CreateUserId = userid; model.CreateDate = DateTime.Now; model.UpdateUserId = Constant.INT_INVALID_VALUE; model.UpdateDate = Constant.DATE_INVALID_VALUE; model.Status = 0; if (employeeagent != null && employeeagent.BGID.HasValue) { model.BGID = employeeagent.BGID.Value; } if (innerMsg == "") { if (backVal == -1) { int backRecID = BLL.BlackWhiteList.Instance.GetRecIDByPhoneNumberAndType(idr[0].ToString().Trim().Replace("-", ""), 0); if (backRecID > 0) { model.RecId = backRecID; model.SynchrodataStatus = 1; model.UpdateDate = DateTime.Now; model.UpdateUserId = userid; bool retVal = BLL.BlackWhiteList.Instance.UpdateNoDisturbData(model); if (!retVal) { msg += "号码" + idr[0].ToString() + "更新失败<br/>"; } else { success = true; } } } else if (backVal == 2) { if (BLL.BlackWhiteList.Instance.AddNoDisturbData(model) <= 0) { msg += "号码" + idr[0].ToString() + "入库失败<br/>"; } else { success = true; } } } else { innerMsg = ""; } //myDataList.Add(model); } // DataTable dtBW = BLL.Util.ListToDataTable(myDataList); // BLL.BlackWhiteList.Instance.ImportData(dtBW); } //FileInfo fi = new FileInfo(fileName); //fi.Delete(); ClearFiles(fileName); return(success); }
/// <summary> /// 更新一条数据 /// </summary> public int Update(Entities.EmployeeAgent model) { return(Dal.EmployeeAgent.Instance.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Insert(Entities.EmployeeAgent model) { return(Dal.EmployeeAgent.Instance.Insert(model)); }