/// <summary> /// 名录转移 /// </summary> private void Shift() { int objid = 0; if (!int.TryParse(nv["objid"], out objid)) { HttpContext.Current.Response.Write("参数错误"); return; } string ids = nv["ciids"]; if (!MLMGC.COMP.StringUtil.IsStringArrayList(ids)) { HttpContext.Current.Response.Write("参数错误"); return; } bool b = new T_Allot().ShiftAllot(new E_Allot() { EnterpriseID = bp.EnterpriceID, TeamID = bp.TeamID, ObjIDs = objid.ToString(), ClientInfoIDs = ids }); //添加操作日志 new MLMGC.BLL.Enterprise.T_Log().Add(new MLMGC.DataEntity.Enterprise.E_Log() { EnterpriseID = bp.EnterpriceID, UserID = bp.UserID, LogTitle = "名录转移", IP = MLMGC.COMP.Requests.GetRealIP() }); HttpContext.Current.Response.Write(Convert.ToInt16(b)); }
/// <summary> /// 数据绑定 /// </summary> protected void databind() { //获取该人员下面的直接下属 rpList.DataSource = new T_Team().GetDirectMember(new E_Team { EnterpriseID = EnterpriceID, TeamID = TeamID }); rpList.DataBind(); //属性配置 E_Property dataProperty = new T_Property().Get(new E_Property { EnterpriseID = EnterpriceID }); TradeFlag = Convert.ToBoolean((int)dataProperty.TradeFlag); AreaFlag = Convert.ToBoolean((int)dataProperty.AreaFlag); SourceFlag = Convert.ToBoolean((int)dataProperty.SourceFlag); //获取配置信息 DataSet ds = new T_Allot().Select(new E_Allot() { EnterpriseID = EnterpriceID, TeamID = TeamID }); if (ds == null || ds.Tables.Count != 5) { return; } SettingFlag = true; }
/// <summary> /// 自动分配 /// </summary> private void AutoAllot() { int amount = 0, type = 0; int.TryParse(nv["num"], out amount); string sort = nv["orderby"]; int.TryParse(nv["type"], out type); //---------------验证数据是否正确--------------- if (amount <= 0) { HttpContext.Current.Response.Write("参数错误"); HttpContext.Current.Response.End(); } if (!(new string[] { "asc", "desc" }).Contains(sort)) { HttpContext.Current.Response.Write("参数错误"); HttpContext.Current.Response.End(); } if (type < 2 || type > 6) { HttpContext.Current.Response.Write("参数错误"); HttpContext.Current.Response.End(); } E_Allot data = new E_Allot(); data.EnterpriseID = bp.EnterpriceID; data.TeamID = bp.TeamID; data.AllotAmount = amount; data.AllotSort = sort; data.SetMode = type; T_Allot bll = new T_Allot(); DataTable dt = bll.AutoAllot(data); new MLMGC.BLL.Enterprise.T_Log().Add(new MLMGC.DataEntity.Enterprise.E_Log() { EnterpriseID = bp.EnterpriceID, UserID = bp.UserID, LogTitle = "自动分配", IP = MLMGC.COMP.Requests.GetRealIP() }); JsonArrayCollection jac = new JsonArrayCollection(); if (dt != null) { foreach (DataRow dr in dt.Rows) { jac.Add(new JsonObjectCollection() { new JsonStringValue("objName", dr[0].ToString()), new JsonStringValue("Amount", dr[1].ToString()) }); } HttpContext.Current.Response.Write("succ"); } else { HttpContext.Current.Response.Write("error"); } }
/// <summary> /// 设置分配设置 /// </summary> private void Setting() { //------------判断数据是否合法--------------------- string aryObj = nv["objid"].Replace('|', ','); if (!StringUtil.IsStringArrayList(aryObj)) { HttpContext.Current.Response.Write("参数错误"); return; } string[] aryTrade = nv["trade"].Split('|'); string[] aryArea = nv["area"].Split('|'); string[] arySource = nv["source"].Split('|'); if (aryTrade.Length != aryArea.Length || aryArea.Length != arySource.Length) { HttpContext.Current.Response.Write("参数错误"); return; } for (int i = 0; i < aryTrade.Length; i++) { if (!string.IsNullOrEmpty(aryTrade[i]) && !StringUtil.IsStringArrayList(aryTrade[i])) { HttpContext.Current.Response.Write("参数错误"); return; } if (!string.IsNullOrEmpty(aryArea[i]) && !StringUtil.IsStringArrayList(aryArea[i])) { HttpContext.Current.Response.Write("参数错误"); return; } if (!string.IsNullOrEmpty(arySource[i]) && !StringUtil.IsStringArrayList(arySource[i])) { HttpContext.Current.Response.Write("参数错误"); return; } } E_Allot data = new E_Allot(); data.EnterpriseID = bp.EnterpriceID; data.TeamID = bp.TeamID; int limit = 0; int.TryParse(nv["limit"], out limit); data.Limit = limit; data.ObjIDs = aryObj.Replace(",", MLMGC.COMP.Config.Separation); data.TradeS = string.Join(MLMGC.COMP.Config.Separation, aryTrade); data.AreaS = string.Join(MLMGC.COMP.Config.Separation, aryArea); data.SourceS = string.Join(MLMGC.COMP.Config.Separation, arySource); T_Allot bll = new T_Allot(); bool b = bll.Update(data); new MLMGC.BLL.Enterprise.T_Log().Add(new MLMGC.DataEntity.Enterprise.E_Log() { EnterpriseID = bp.EnterpriceID, UserID = bp.UserID, LogTitle = "分配设置", IP = MLMGC.COMP.Requests.GetRealIP() }); HttpContext.Current.Response.Write(b?"1":"0"); }
/// <summary> /// 数据绑定 /// </summary> protected void databind() { E_Allot data = new E_Allot(); data.EnterpriseID = EnterpriceID; data.ClientInfoIDs = Requests.GetQueryString("ids"); DataTable dt = new T_Allot().ListResultSelect(data); rpList.DataSource = dt; rpList.DataBind(); lblCount.Text = dt.Rows.Count.ToString(); }
/// <summary> /// 点击保存按钮处理事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { //获取界面数据 string amount = txtAllotAmount.Text; string cycle = txtDay.Text; string hour = txtHour.Text.Trim(); string minute = txtMinute.Text.Trim(); if (string.IsNullOrEmpty(amount) || string.IsNullOrEmpty(cycle) || Convert.ToInt32(amount) <= 0 || Convert.ToInt32(cycle) > 200 && Convert.ToInt32(cycle) <= 0 || Convert.ToInt32(hour) > 23 && Convert.ToInt32(hour) < 0 || Convert.ToInt32(minute) > 59 && Convert.ToInt32(minute) < 0) { MLMGC.COMP.Jscript.ShowMsg("输入有误,请重新输入", this); return; } E_Allot data = new E_Allot(); data.EnterpriseID = EnterpriceID; data.TeamID = TeamID; data.Available = Convert.ToInt32(rblEnabledState.SelectedValue); data.AllotAmount = Convert.ToInt32(amount); data.AllotSort = rdOrderbyAsc.Checked ? "asc" : "desc"; data.SetMode = cbTypeAvg.Checked ? 2 : (cbTypeMakeup.Checked ? 3 : (cbTypeTrade.Checked ? 4 : (cbTypeArea.Checked ? 5 : 6))); data.Cycle = Convert.ToInt32(cycle); data.AllotTime = string.Format("{0}:{1}", hour.Length == 1 ? string.Format("0{0}", hour) : hour, minute.Length == 1 ? string.Format("0{0}", minute) : minute); bool flag = new T_Allot().UpdateAutoConfig(data); new MLMGC.BLL.Enterprise.T_Log().Add(new MLMGC.DataEntity.Enterprise.E_Log() { EnterpriseID = EnterpriceID, UserID = UserID, LogTitle = "修改自动分配设置", IP = MLMGC.COMP.Requests.GetRealIP() }); if (flag) { MLMGC.COMP.Jscript.AlertAndRedirect(this, "保存成功", "AutoAllot.aspx"); } else { MLMGC.COMP.Jscript.ShowMsg("保存失败", this); } }
/// <summary> /// 手动分配 /// </summary> private void ManualAllot() { string type = nv["type"]; string objids = nv["objids"]; string ciids = nv["ids"]; //---------------验证数据是否正确--------------- if (!(new string[] { "specified", "avg", "makeup", "trade", "area", "source" }).Contains(type) ||//分配方式 !MLMGC.COMP.StringUtil.IsStringArrayList(objids) ||//对象 !MLMGC.COMP.StringUtil.IsStringArrayList(ciids) //分配名录 ) { HttpContext.Current.Response.Write("参数错误"); HttpContext.Current.Response.End(); } if (type.Equals("specified") && !StringUtil.VldInt(objids)) { HttpContext.Current.Response.Write("参数错误"); HttpContext.Current.Response.End(); } E_Allot data = new E_Allot(); data.EnterpriseID = bp.EnterpriceID; data.TeamID = bp.TeamID; data.AllotType = type; data.ObjIDs = objids; data.ClientInfoIDs = ciids; T_Allot bll = new T_Allot(); bool b = bll.ManualAllot(data); new MLMGC.BLL.Enterprise.T_Log().Add(new MLMGC.DataEntity.Enterprise.E_Log() { EnterpriseID = bp.EnterpriceID, UserID = bp.UserID, LogTitle = "手动分配", IP = MLMGC.COMP.Requests.GetRealIP() }); HttpContext.Current.Response.Write(b?"1":"0"); }
/// <summary> /// 数据绑定 /// </summary> public void databind() { string start = Requests.GetQueryString("startdate"); string end = Requests.GetQueryString("enddate"); txtStartDate.Text = start; txtEndDate.Text = end; E_Allot data = new E_Allot(); data.EnterpriseID = EnterpriceID; data.TeamID = TeamID; data.Page = new E_Page(); if (!string.IsNullOrEmpty(start)) { data.Page.StartDate = Convert.ToDateTime(start); } if (!string.IsNullOrEmpty(end)) { data.Page.EndDate = Convert.ToDateTime(end); } data.Page.PageIndex = pageIndex; data.Page.PageSize = pageSize; DataTable dt = new T_Allot().AllotStatistics(data); rpList.DataSource = dt; rpList.DataBind(); //设置分页样式 pageList1.PageSize = pageSize; pageList1.CurrentPageIndex = pageIndex; pageList1.RecordCount = data.Page.TotalCount; pageList1.CustomInfoHTML = string.Format("共有记录 <span class='red_font'>{0}</span> 条", pageList1.RecordCount); pageList1.TextAfterPageIndexBox = " 页/" + pageList1.PageCount + " "; }
protected void databind() { //获取待分配名录数量 E_ClientInfo data = new E_ClientInfo(); data.EnterpriseID = EnterpriceID; data.TeamID = TeamID; data.Mode = EnumClientMode.团队; data.Status = EnumClientStatus.待分配名录; int count = new T_ClientInfo().WaitCount(data); ltSumAmount.Text = count.ToString(); txtAllotAmount.Attributes.Add("maxNum", count.ToString()); //获取名录属性信息 E_Property dataProperty = new T_Property().Get(new E_Property() { EnterpriseID = EnterpriceID }); TradeFlag = Convert.ToBoolean((int)dataProperty.TradeFlag); AreaFlag = Convert.ToBoolean((int)dataProperty.AreaFlag); SourceFlag = Convert.ToBoolean((int)dataProperty.SourceFlag); //获取配置信息 DataSet ds = new T_Allot().Select(new E_Allot() { EnterpriseID = EnterpriceID, TeamID = TeamID }); if (ds == null || ds.Tables.Count != 5) { return; } SettingFlag = true; //----------读取自行分配配置信息--------------- E_Allot config = new T_Allot().GetModelConfig(new E_Allot() { EnterpriseID = EnterpriceID, TeamID = TeamID }); if (config != null) { rblEnabledState.SelectedValue = config.Available.ToString(); txtAllotAmount.Text = config.AllotAmount.ToString(); txtDay.Text = config.Cycle.ToString(); if (config.AllotTime != null && config.AllotTime.IndexOf(":") > -1) { txtHour.Text = config.AllotTime.Substring(0, 2); txtMinute.Text = config.AllotTime.Substring(3, 2); } lbCurExecDate.Text = config.LastDate == null ? "----" :string.Format("{0:yyyy-MM-dd HH:mm:ss}", config.LastDate); lbNextDate.Text = string.Format("{0:yyyy-MM-dd HH:mm:ss}", config.NextDate); //排序方式 if (config.AllotSort == "asc") { rdOrderbyAsc.Checked = true; } else { rdOrderbyDesc.Checked = true; } //分配类型 switch (config.Mode) { case EnumMode.平均分配: cbTypeAvg.Checked = true; break; case EnumMode.补差分配: if (SettingFlag) { cbTypeMakeup.Checked = true; } break; case EnumMode.行业分配: if (SettingFlag && TradeFlag) { cbTypeTrade.Checked = true; } break; case EnumMode.地区分配: if (SettingFlag && AreaFlag) { cbTypeArea.Checked = true; } break; case EnumMode.来源分配: if (SettingFlag && SourceFlag) { cbTypeSource.Checked = true; } break; } } }
protected void databind() { //获取名录属性信息 E_Property dataProperty = new T_Property().Get(new E_Property() { EnterpriseID = EnterpriceID }); TradeFlag = Convert.ToBoolean((int)dataProperty.TradeFlag); AreaFlag = Convert.ToBoolean((int)dataProperty.AreaFlag); SourceFlag = Convert.ToBoolean((int)dataProperty.SourceFlag); if (TradeFlag) {//绑定行业 rpTradeList.DataSource = new T_Trade().GetShowList(new E_Trade() { EnterpriseID = EnterpriceID, CodeIsValue = false }); rpTradeList.DataBind(); } if (AreaFlag) {//绑定地区 rpAreaList.DataSource = new T_Area().GetShowList(new E_Area() { EnterpriseID = EnterpriceID, CodeIsValue = false }); rpAreaList.DataBind(); } if (SourceFlag) {//绑定来源 rpSource.DataSource = new T_Source().GetList(new E_Source() { EnterpriseID = EnterpriceID, CodeIsValue = false }); rpSource.DataBind(); } //----------------绑定对象列表 rpList.DataSource = new T_Team().GetDirectMember(new E_Team() { EnterpriseID = EnterpriceID, TeamID = TeamID }); rpList.DataBind(); //绑定配置信息 DataSet ds = new T_Allot().Select(new E_Allot() { EnterpriseID = EnterpriceID, TeamID = TeamID }); if (ds == null || ds.Tables.Count != 5) { return; } List <string> listObj = new List <string>(); List <string> listTrade = new List <string>(); List <string> listArea = new List <string>(); List <string> listSource = new List <string>(); //遍历对象 foreach (DataRow dr in ds.Tables[1].Rows) { listObj.Add(dr["objID"].ToString()); List <string> aryTrade = new List <string>(); List <string> aryArea = new List <string>(); List <string> arySource = new List <string>(); //行业 foreach (DataRow drTrade in ds.Tables[2].Select("gid=" + dr["gid"])) { aryTrade.Add(drTrade["TradeID"].ToString()); } //地区 foreach (DataRow drArea in ds.Tables[3].Select("gid=" + dr["gid"])) { aryArea.Add(drArea["AreaID"].ToString()); } //来源 foreach (DataRow drSource in ds.Tables[4].Select("gid=" + dr["gid"])) { arySource.Add(drSource["SourceID"].ToString()); } listTrade.Add(string.Join(",", aryTrade)); listArea.Add(string.Join(",", aryArea)); listSource.Add(string.Join(",", arySource)); } txtCILimit.Text = ds.Tables[0].Rows[0][0].ToString(); hdObj.Value = string.Join("|", listObj); hdTrade.Value = string.Join("|", listTrade); hdArea.Value = string.Join("|", listArea); hdSource.Value = string.Join("|", listSource); }