/// <summary> /// 共享名录 /// </summary> private void Share() { string ciids = nv["ids"]; if (!MLMGC.COMP.StringUtil.IsStringArrayList(ciids))//判断格式是否正确 格式:1,21,321 { HttpContext.Current.Response.Write("参数错误"); return; } E_ClientInfo data = new E_ClientInfo(); data.EnterpriseID = bp.EnterpriceID; data.EPUserTMRID = bp.EPUserTMRID; data.Mode = EnumClientMode.共享; data.Status = EnumClientStatus.共享; data.ClientInfoIDs = ciids; bool b = new T_ClientInfo().UpdateMode(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"); }
protected void databind() { //获取名录属性信息 E_Property dataProperty = new T_Property().Get(new E_Property() { EnterpriseID = EnterpriceID }); E_ClientInfo data = new E_ClientInfo(); data.EnterpriseID = EnterpriceID; data.UserID = UserID; data.EPUserTMRID = EPUserTMRID; data.TeamID = 0; data.Property = dataProperty; data.ClientName = Request.QueryString["keyword"] ?? string.Empty; data.Mode = EnumClientMode.业务员; data.Status = EnumClientStatus.所有状态; //分页参数 data.Page = new MLMGC.DataEntity.E_Page(); data.Page.PageSize = pageSize; data.Page.PageIndex = pageIndex; rpList.DataSource = new T_ClientInfo().GetList(data); 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 + " "; }
/// <summary> /// 删除某状态下所有名录 /// </summary> private void DeleteAll() { int mode, status; if (!int.TryParse(nv["mode"], out mode) || !int.TryParse(nv["status"], out status)) { HttpContext.Current.Response.Write("参数错误"); return; } E_ClientInfo data = new E_ClientInfo(); data.EnterpriseID = bp.EnterpriceID; data.EPUserTMRID = bp.EPUserTMRID; data.TeamID = bp.TeamID; data.SetMode = mode; data.SetStatus = status; bool flag = new T_ClientInfo().DeleteAll(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(flag ? "1" : "0"); }
/// <summary> /// 查询个人潜在客户 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>tianzhenyun 2011-10-25</remarks> public DataTable LatenceSelect(E_ClientInfo data) { SqlParameter[] parms = { new SqlParameter("@PersonalID", SqlDbType.Int), new SqlParameter("@ClientName", SqlDbType.VarChar, 128), new SqlParameter("@Status", SqlDbType.TinyInt), new SqlParameter("@SourceFlag", SqlDbType.Int), new SqlParameter("@TradeFlag", SqlDbType.Int), new SqlParameter("@AreaFlag", SqlDbType.Int), new SqlParameter("@SourceID", SqlDbType.Int), new SqlParameter("@TradeID", SqlDbType.Int), new SqlParameter("@AreaID", SqlDbType.Int), new SqlParameter("@PageIndex", SqlDbType.Int), new SqlParameter("@PageSize", SqlDbType.Int), new SqlParameter("@TotalCount", SqlDbType.Int) }; parms[0].Value = data.PersonalID; parms[1].Value = data.ClientName; parms[2].Value = data.Status; parms[3].Value = (int)data.Property.SourceFlag; parms[4].Value = (int)data.Property.TradeFlag; parms[5].Value = (int)data.Property.AreaFlag; parms[6].Value = data.SourceID; parms[7].Value = data.TradeID; parms[8].Value = data.AreaID; parms[9].Value = data.Page.PageIndex; parms[10].Value = data.Page.PageSize; parms[11].Direction = ParameterDirection.Output; DataTable dt = DbHelperSQL.RunProcedureTable("ProcPI_B_ClientInfoS_LatenceSelect", parms); data.Page.TotalCount = parms[11].Value == DBNull.Value ? 0 : Convert.ToInt32(parms[11].Value); return(dt); }
/// <summary> /// 还原到共享池处理事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnRestore_Click(object sender, EventArgs e) { string ciids = hdClientInfoIDs.Value; hdClientInfoIDs.Value = ""; if (!MLMGC.COMP.StringUtil.IsStringArrayList(ciids))//判断格式是否正确 格式:1,21,321 { HttpContext.Current.Response.Write("参数错误"); return; } E_ClientInfo data = new E_ClientInfo(); data.EnterpriseID = EnterpriceID; data.Mode = EnumClientMode.共享; data.Status = EnumClientStatus.共享; data.EPUserTMRID = EPUserTMRID; data.ClientInfoIDs = ciids; bool flag = new T_ClientInfoHelper().LeaderRestore(data); if (flag) { Jscript.AlertAndRedirect(this, "还原成功", "Recycled.aspx"); } else { Jscript.ShowMsg("还原失败", this); } }
/// <summary> /// 获取名录列表 /// </summary> /// <param name="data"></param> /// <returns></returns> public DataTable GetList(E_ClientInfo data) { if (data.Mode == EnumClientMode.业务员) { switch (data.Status) { case EnumClientStatus.潜在客户: return(dal.GetLatenceList(data)); case EnumClientStatus.意向客户: return(dal.GetWishList(data)); case EnumClientStatus.成交客户: return(dal.GetTradedList(data)); default: return(dal.GetList(data)); } } else if (data.Mode == EnumClientMode.共享) { return(dal.GetShareList(data)); } return(null); }
/// <summary> /// 绑定列表 /// </summary> protected void databind() { //开始计时 DateTime StartTime = DateTime.Now; E_ClientInfo data = new E_ClientInfo(); data.PersonalID = PersonalID; //--设置名录属性查询属性 data.ClientName = Requests.GetQueryString("name"); txtName.Text = data.ClientName; //分页参数 data.Page = new MLMGC.DataEntity.E_Page(); data.Page.PageSize = pageSize; data.Page.PageIndex = pageIndex; rpList.DataSource = new T_ClientInfo().Select(data); 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 + " "; //停止计时 DateTime EndTime = DateTime.Now; TimeSpan ts = EndTime - StartTime; lblExecTime.Text = ts.TotalSeconds.ToString(); }
/* * /// <summary> * /// 初始化配置信息 * /// </summary> * private static void InitConfig() * { * enterprisecode = ConfigurationManager.AppSettings["EnterpriseCode"]; * enterprisename = ConfigurationManager.AppSettings["EnterpriseName"]; * itemname = ConfigurationManager.AppSettings["ItemName"]; * useramount = Convert.ToInt32(ConfigurationManager.AppSettings["UserAmount"]); * startdate = Convert.ToDateTime(ConfigurationManager.AppSettings["StartDate"]); * expiredate = Convert.ToDateTime(ConfigurationManager.AppSettings["ExpireDate"]); * adminusername = ConfigurationManager.AppSettings["AdminUserName"]; * adminpassword = ConfigurationManager.AppSettings["AdminPassword"]; * * teammodelid = Convert.ToInt32(ConfigurationManager.AppSettings["TeamModelID"]); * teamscalexml = ConfigurationManager.AppSettings["TeamScaleXml"]; * } * * /// <summary> * /// 开始添加测试数据 * /// </summary> * private static void StartProgram() * { * Console.WriteLine("请输入要添加的企业数量:"); * string content = Console.ReadLine(); * int num; * while(!int.TryParse(content, out num)) * { * Console.WriteLine("输入错误请继续:"); * content = Console.ReadLine(); * } * * string code=enterprisecode; * string name=enterprisename; * //InsertData(code, name); * for (int i = 0; i < num; i++) * { * //Console.WriteLine(string .Format("第{0}个企业",i+1)); * code = code.Substring(0, 4) + (Convert.ToInt32(code.Substring(4)) + 1).ToString(); * name = name.Substring(0, 2) + (Convert.ToInt32(name.Substring(2)) + 1).ToString(); * if (!InsertData(code, name)) * { * Console.WriteLine("出错"); * new Log().WriteLog("出错"); * break; * } * } * //然后把最后的企业号修改到配置文件中,为了下次可直接运行。 * Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); * AppSettingsSection appsection = (AppSettingsSection)config.GetSection("appSettings"); * appsection.Settings["EnterpriseCode"].Value = code; * appsection.Settings["EnterpriseName"].Value = name; * config.Save(); * } * * /// <summary> * /// 插入数据 * /// </summary> * /// <returns></returns> * private static bool InsertData(string code,string name) * { * bool flag; * int EnterpriseID = new Program().AddEnterprise(code,name); * if (EnterpriseID <= 0) * { * new Log().WriteLog("添加企业基本信息失败"); * Console.WriteLine("添加企业基本信息失败"); * return false; * } * * flag = new Program().AddUser(EnterpriseID); * if (!flag) * { * new Log().WriteLog("添加用户失败"); * Console.WriteLine("添加用户失败"); * return false; * } * * flag = new Program().AddClientInfo(EnterpriseID, name); * if (!flag) * { * new Log().WriteLog("添加名录失败"); * Console.WriteLine("添加名录失败"); * return false; * } * return true; * } * * /// <summary> * /// 添加企业 * /// </summary> * /// <returns></returns> * private int AddEnterprise(string code,string name) * { * int EnterpriseID = 0; * //---添加企业---- * E_Enterprise EPdata = new E_Enterprise(); * EPdata.EnterpriseCode = code; * EPdata.EnterpriseNames = name; * EPdata.ItemName = itemname; * EPdata.UserAmount = useramount; * EPdata.StartDate = startdate; * EPdata.ExpireDate = expiredate; * EPdata.AdminUserName = adminusername; * EPdata.AdminPassword = MLMGC.COMP.EncryptString.EncryptPassword(adminpassword); * * DateTime now = DateTime.Now; * EnterpriseID = new DataSql().Add(EPdata); * Console.WriteLine("添加企业时间:" + (DateTime.Now - now).TotalMilliseconds.ToString()); * if (EnterpriseID == 0) * { * //new Log().WriteLog("添加企业出错"); * //Console.WriteLine("添加企业出错"); * return 0; * } * * new Log().WriteLog("添加企业成功,企业号:" + EnterpriseID.ToString()); * Console.WriteLine("添加企业成功,企业号:" + EnterpriseID.ToString()); * //------------------- * * //------------设置企业团队模型------------ * E_TeamModel TMdata = new E_TeamModel(); * TMdata.EnterpriseID = EnterpriseID; * TMdata.TeamModelID = teammodelid; * now = DateTime.Now; * int result = new DataSql().SetTeamModel(TMdata); * Console.WriteLine("设置团队模型时间:" + (DateTime.Now - now).TotalMilliseconds.ToString()); * if (result <= 0) * { * //new Log().WriteLog("设置团队模型出错"); * //Console.WriteLine("设置团队模型出错"); * return 0; * } * //new Log().WriteLog("设置团队模型成功"); * //Console.WriteLine("设置团队模型成功"); * //--------------------------------------- * * //----------设置企业团队规模--------- * E_TeamModel data = new E_TeamModel(); * data.EnterpriseID = EnterpriseID; * data.TeamScaleXml = teamscalexml; * data.Child_RoleID = "3,4";//经理roleid 3,组长roleid 4; * data.Child_RoleAmount = "2,4";//经理 2,组长 3; * result = new DataSql().UpdateTeamScale(data); * if (result < 0) * { * //new Log().WriteLog("设置企业团队规模出错"); * //Console.WriteLine("设置企业团队规模出错"); * return 0; * } * //new Log().WriteLog("设置企业团队规模成功"); * //Console.WriteLine("设置企业团队规模成功"); * //---------------------------------- * * //---------修改团队信息(指定上级)---------- * string sql = string.Format("UPDATE dbo.EP_B_Team SET pid= 3 WHERE EnterpriseID={0} AND TeamType=2 AND TeamModelRoleID =9;UPDATE t SET t.pid = 2 FROM (SELECT TOP 2 * FROM dbo.EP_B_Team WHERE EnterpriseID={0} AND TeamType=2 AND TeamModelRoleID =9) t;", EnterpriseID); * //new Log().WriteLog(sql); * //Console.WriteLine(sql); * now = DateTime.Now; * DbHelperSQL.ExecuteSql(sql); * Console.WriteLine("修改团队上级时间:" + (DateTime.Now - now).TotalMilliseconds.ToString()); * //new Log().WriteLog("修改团队信息完成"); * //Console.WriteLine("修改团队信息完成"); * //----------------------------------------- * * //new Log().WriteLog("添加企业完成"); * //Console.WriteLine("添加企业完成"); * return EnterpriseID; * } * * /// <summary> * /// 添加企业用户 * /// </summary> * /// <returns></returns> * private bool AddUser(int EnterpriseID) * { * if (EnterpriseID == 0) * { * new Log().WriteLog("没有企业号"); * Console.WriteLine("没有企业号"); * return false; * } * E_User data = new E_User(); * data.EnterpriseID = EnterpriseID; * data.UserName = "******"; * data.Password = MLMGC.COMP.EncryptString.EncryptPassword("123456"); * data.UserType = (int)UserType.企业用户; * data.TrueName = "总监"; * data.RoleSetting = "7:1"; * if (new DataSql().AddEnterpriseUser(data) < 1) * { * new Log().WriteLog("添加总监失败"); * Console.WriteLine("添加总监失败"); * return false ; * } * //new Log().WriteLog("添加总监成功"); * //Console.WriteLine("添加总监成功"); * * //经理 * for (int i = 0; i < 2; i++) * { * data.UserName = string.Format("jili{0}", i + 1); * data.TrueName = string.Format("经理{0}", i + 1); * data.RoleSetting = string.Format("8:{0}", i + 2); * if (new DataSql().AddEnterpriseUser(data) < 1) * { * new Log().WriteLog(string.Format("添加经理{0}失败",i+1)); * Console.WriteLine(string.Format("添加经理{0}失败", i + 1)); * return false; * } * //new Log().WriteLog(string.Format("添加经理{0}成功", i + 1)); * //Console.WriteLine(string.Format("添加经理{0}成功", i + 1)); * } * * //组长 * * for (int i = 0; i < 4; i++) * { * data.UserName = string.Format("zuzhang{0}", i + 1); * data.TrueName = string.Format("组长{0}", i + 1); * data.RoleSetting = string.Format("9:{0}", i+4); * if (new DataSql().AddEnterpriseUser(data) < 1) * { * new Log().WriteLog(string.Format("添加组长{0}失败", i + 1)); * Console.WriteLine(string.Format("添加组长{0}失败", i + 1)); * return false; * } * //new Log().WriteLog(string.Format("添加组长{0}成功", i + 1)); * //Console.WriteLine(string.Format("添加组长{0}成功", i + 1)); * } * * //业务员 * for (int i = 0; i < 100; i++) * { * data.UserName = string.Format("yewuyuan{0}", i + 1); * data.TrueName = string.Format("业务员{0}", i + 1); * data.RoleSetting = string.Format("10:{0}", i/25 + 4); * DateTime now = DateTime.Now; * if (new DataSql().AddEnterpriseUser(data) < 1) * { * new Log().WriteLog(string.Format("添加业务员{0}失败", i + 1)); * Console.WriteLine(string.Format("添加业务员{0}失败", i + 1)); * return false; * } * double d =(DateTime.Now - now).TotalMilliseconds; * if(d>=250) * Console.WriteLine("添加一个业务员时间:" + d.ToString ()); * //new Log().WriteLog(string.Format("添加业务员{0}成功", i + 1)); * //Console.WriteLine(string.Format("添加业务员{0}成功", i + 1)); * } * //new Log().WriteLog("添加用户完成"); * //Console.WriteLine("添加用户完成"); * return true; * } * * /// <summary> * /// 添加名录 * /// </summary> * /// <returns></returns> * private bool AddClientInfo(int EnterpriseID, string name) * { * if (EnterpriseID == 0) * { * new Log().WriteLog("没有企业号"); * Console.WriteLine("没有企业号"); * return false; * } * bool flag; * //查询所有业务员 * string sql = string.Format("select EPUserTMRID from EP_R_EPUserTMR where EnterpriseID ={0} and TeamModelRoleID =10", EnterpriseID); * DataTable dt = DbHelperSQL.Query(sql).Tables[0]; * if (dt == null) * { * new Log().WriteLog("没有找到业务员"); * Console.WriteLine("没有找到业务员"); * return false; * } * int EPUserTMRID = 0; * * E_ClientInfo data = new E_ClientInfo(); * data.EnterpriseID = EnterpriseID; * foreach (DataRow row in dt.Rows) * { * EPUserTMRID = Convert.ToInt32(row["EPUserTMRID"]); * data.EPUserTMRID = EPUserTMRID; * Console.WriteLine(data.EPUserTMRID); * DateTime now = DateTime.Now; * for (int i = 0; i < 40000; i++) //每个人5条名录 * { * data.ClientName = string.Format("{0}{1}{2}", name, EPUserTMRID, i); * flag = new DataSql().Add(data); * if (!flag) * { * new Log().WriteLog(string.Format("添加{0}的第{1}个名录出错", EPUserTMRID, i)); * Console.WriteLine(string.Format("添加{0}的第{1}个名录出错", EPUserTMRID, i)); * return false; * } * } * Console.WriteLine((DateTime.Now - now).TotalSeconds.ToString()); * } * //Console.WriteLine("添加名录完成"); * //new Log().WriteLog("添加名录完成"); * return true; * } * */ #endregion #region 个人 /// <summary> /// 添加名录 /// </summary> /// <returns></returns> public static bool AddClientInfo(string name, int num) { E_ClientInfo data = new E_ClientInfo(); T_ClientInfo bll = new T_ClientInfo(); data.PersonalID = 9; Console.WriteLine("开始添加:" + DateTime.Now.ToShortTimeString()); new Log().WriteLog("开始添加:" + DateTime.Now.ToShortTimeString()); bool flag = false; for (int i = 1; i <= num; i++) { data.ClientName = string.Format("{0}{1}", name, i); flag = bll.Add(data); if (!flag) { Console.WriteLine("添加出错!"); new Log().WriteLog("添加出错!"); break; } if (i % 1000 == 0) { Console.WriteLine(string.Format("已经添加{0}条,时间:{1}", i, DateTime.Now.ToShortTimeString())); } } Console.WriteLine("添加完成:" + DateTime.Now.ToShortTimeString()); new Log().WriteLog("添加完成:" + DateTime.Now.ToShortTimeString()); return(flag); }
/// <summary> /// 修改状态 /// </summary> private void UpdateStatus() { E_ClientInfo data = new E_ClientInfo(); data.PersonalID = bp.PersonalID; data.ClientInfoID = Convert.ToInt32(nv["id"]); data.SetStatus = Convert.ToInt32(nv["status"]); if (data.Status == EnumClientStatus.所有状态)//判断是否是可用状态 { HttpContext.Current.Response.Write("参数错误啦"); return; } if (data.Status == EnumClientStatus.意向客户) { data.WishID = Convert.ToInt32(nv["wishid"]); } else if (data.Status == EnumClientStatus.成交客户) { data.TradedMoney = float.Parse(nv["money"]); } else if (data.Status == EnumClientStatus.失败客户) { data.NotTradedID = Convert.ToInt32(nv["nottradedid"]); } else if (data.Status == EnumClientStatus.报废客户) { data.ScrapID = Convert.ToInt32(nv["scrapid"]); } bool b = new T_ClientInfo().UpdateStatus(data); HttpContext.Current.Response.Write(b ? "1" : "0"); }
protected void databind() { E_ClientInfo data = new E_ClientInfo(); data.EnterpriseID = EnterpriceID; data.ClientName = Requests.GetQueryString("name"); txtName.Text = data.ClientName; string startdate = Requests.GetQueryString("startdate"); string enddate = Requests.GetQueryString("enddate"); //分页参数 data.Page = new MLMGC.DataEntity.E_Page(); data.Page.PageSize = pageSize; data.Page.PageIndex = pageIndex; if (startdate != string.Empty) { data.Page.StartDate = Convert.ToDateTime(startdate); txtStartDate.Text = startdate; } if (enddate != string.Empty) { data.Page.EndDate = Convert.ToDateTime(enddate); txtEndDate.Text = enddate; } rpList.DataSource = new T_ClientInfoHelper().LeaderDeleteSelect(data); 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 + " "; }
/// <summary> /// 导入名录信息 /// </summary> /// <param name="shtClient"></param> /// <returns></returns> private bool ImportClient(HSSFSheet shtClient) { int count = shtClient.LastRowNum; int succNum = 0, errorNum = 0; HSSFRow row; T_ClientInfo bll = new T_ClientInfo(); E_ClientInfo data; for (int i = 1; i <= count; ++i) { if (ISCheckRowStrNullOrEmpty(i, shtClient)) { continue; } row = shtClient.GetRow(i); data = new E_ClientInfo(); data.PersonalID = _personalid; data.ClientName = GetCellValue(row.GetCell(0)); //名称 data.Address = GetCellValue(row.GetCell(1)); //地址 data.ZipCode = GetCellValue(row.GetCell(2)); //邮编 data.Linkman = GetCellValue(row.GetCell(3)); //联系人 data.Position = GetCellValue(row.GetCell(4)); //职务 data.Tel = GetCellValue(row.GetCell(5)); //电话 data.Mobile = GetCellValue(row.GetCell(6)); //手机 data.Fax = GetCellValue(row.GetCell(7)); //传真 data.Website = GetCellValue(row.GetCell(8)); //网址 data.Email = GetCellValue(row.GetCell(9)); //邮箱 data.QQ = GetCellValue(row.GetCell(10)); //QQ data.MSN = GetCellValue(row.GetCell(11)); //MSN data.SourceName = GetCellValue(row.GetCell(12)); //来源编码 data.TradeName = GetCellValue(row.GetCell(13)); //行业编码 data.AreaName = GetCellValue(row.GetCell(14)); //地区编码 data.Remark = GetCellValue(row.GetCell(15)); //备注 //判断名录名是否存在 bool flag = bll.Exists(new E_ClientInfo() { PersonalID = _personalid, ClientName = data.ClientName, ClientInfoID = 0 }); if (flag) { _result.Add(string.Format("[{0}]已经导入数据库! 位置[{1}]中,第{2}行", data.ClientName, strClientName, i)); ++errorNum; continue; } //名录写入数据库 if (bll.Add(data))//判断名录写入成功与失败 { ++succNum; } else { ++errorNum; } } _result.Add(string.Format("成功导入{0}条,失败{1}条。", succNum, errorNum)); return(errorNum == 0); }
protected void databind() { //名录位置、状态 LSOperate1.Mode = 2; //在共享 LSOperate1.Status = 6; //共享客户 //是否显示删除按钮 if (RoleID == (int)EnumRole.总监) { LSOperate1.HideDelete = false; LSOperate1.HideDeleteAll = false; } //获取名录属性信息 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); E_ClientInfo data = new E_ClientInfo(); data.EnterpriseID = EnterpriceID; data.UserID = UserID; data.Property = dataProperty; data.Mode = EnumClientMode.共享; data.ClientName = Requests.GetQueryString("name"); txtName.Text = data.ClientName; //--设置名录属性查询属性 data.Property = dataProperty; data.TradeID = Requests.GetQueryInt("tradeid", -1); data.AreaID = Requests.GetQueryInt("areaid", -1); data.SourceID = Requests.GetQueryInt("sourceid", -1); Property1.PropertyData = dataProperty; Property1.AreaID = data.AreaID; Property1.SourceID = data.SourceID; Property1.TradeID = data.TradeID; //分页参数 data.Page = new MLMGC.DataEntity.E_Page(); data.Page.PageSize = pageSize; data.Page.PageIndex = pageIndex; rpList.DataSource = new T_ClientInfo().GetShareList(data); 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 + " "; }
/// <summary> /// 判断手机或电话号码是否存在 /// </summary> private void ExistsContact() { string type = nv["type"]; string value = nv["value"].Trim(); bool b = false; if (type == "1") { Regex m = new Regex(@"^1(3|5|8)+\d{9}$");//验证手机号 b = m.IsMatch(value); } else { Regex t = new Regex(@"^(0[0-9]{2,3}\-)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$");//验证电话 b = t.IsMatch(value); } if (!b || string.IsNullOrWhiteSpace(type)) { HttpContext.Current.Response.Write("参数错误"); return; } int ciid = 0; int.TryParse(nv["ciid"], out ciid); E_ClientInfo data = new E_ClientInfo(); data.PersonalID = bp.PersonalID; data.ClientInfoID = ciid; data.Type = Convert.ToInt32(type); data.Value = value; DataTable dt = new T_ClientInfo().ExistsContact(data); string result = string.Empty; bool flag = false; if (dt != null && dt.Rows.Count == 1) { int mode = Convert.ToInt32(dt.Rows[0]["Flag"]); switch (mode) { case -1: flag = true; result = "这个号码可以使用!"; break; case 1: result = string.Format("该{0}号码已存在,所在名录:{1}", type == "1" ? "手机" : "电话", dt.Rows[0]["Name"].ToString()); break; } } JsonObjectCollection colDR = new JsonObjectCollection(); colDR.Add(new JsonStringValue("flag", flag ? "1" : "0")); colDR.Add(new JsonStringValue("detail", result)); HttpContext.Current.Response.Write(colDR.ToString()); }
/// <summary> /// 名录统计信息 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>qipengfei 2011-10-25</remarks> public DataTable Statistics(E_ClientInfo data) { SqlParameter[] parms = { new SqlParameter("@PersonalID", SqlDbType.Int) }; parms[0].Value = data.PersonalID; return(DbHelperSQL.RunProcedureTable("ProcPI_B_ClientInfo_Statistics", parms)); }
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); E_ClientInfo data = new E_ClientInfo(); data.EnterpriseID = EnterpriceID; data.UserID = UserID; data.Property = dataProperty; data.Mode = EnumClientMode.共享; data.ClientName = Requests.GetQueryString("name"); txtName.Text = data.ClientName; //--设置名录属性查询属性 data.Property = dataProperty; data.TradeID = Requests.GetQueryInt("tradeid", -1); data.AreaID = Requests.GetQueryInt("areaid", -1); data.SourceID = Requests.GetQueryInt("sourceid", -1); Property1.PropertyData = dataProperty; Property1.AreaID = data.AreaID; Property1.SourceID = data.SourceID; Property1.TradeID = data.TradeID; //分页参数 data.Page = new MLMGC.DataEntity.E_Page(); data.Page.PageSize = pageSize; data.Page.PageIndex = pageIndex; rpList.DataSource = new T_ClientInfo().GetShareList(data); rpList.DataBind(); //----------------获取当前用户角色信息---------------- int roleid = new T_User().GetEPRoleID(new E_EnterpriseUser() { EnterpriseID = EnterpriceID, EPUserTMRID = EPUserTMRID }); btnMyGet.Visible = (roleid == (int)EnumRole.销售人员); //设置分页样式 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 + " "; }
/// <summary> /// 总监导出名录信息 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>tianzhenyun 2012-01-05</remarks> public DataSet LeaderDataExport(E_ClientInfo data) { SqlParameter[] parms = { new SqlParameter("@EnterpriseID", SqlDbType.Int), new SqlParameter("@Status", SqlDbType.TinyInt) }; parms[0].Value = data.EnterpriseID; parms[1].Value = (int)data.Status; return(DbHelperSQL.RunProcedureDataSet("ProcEP_B_ClientInfoS_LeaderExportSelect", parms)); }
/// <summary> /// 获取名录状态操作列表 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>qipengfei 2011-10-26</remarks> public DataTable GetStatusList(E_ClientInfo data) { SqlParameter[] parms = { new SqlParameter("@PersonalID", SqlDbType.Int), new SqlParameter("@ClientInfoID", SqlDbType.Int) }; parms[0].Value = data.PersonalID; parms[1].Value = data.ClientInfoID; return(DbHelperSQL.RunProcedureTable("ProcPI_B_ClientLogS_Select", parms)); }
/// <summary> /// 页面初始化加载数据 /// </summary> protected void databind() { E_ClientInfo data = new E_ClientInfo(); data.EnterpriseID = EnterpriceID; data.TeamID = TeamID; data.ClientName = Requests.GetQueryString("keyword"); txtKeyword.Text = data.ClientName; //分页参数 data.Page = new MLMGC.DataEntity.E_Page(); data.Page.PageSize = pageSize; data.Page.PageIndex = pageIndex; DataSet ds = new T_ClientInfo().LeaderList(data); if (ds != null && ds.Tables.Count > 1)//判断是否有数据返回 { //绑定列表 rpList.DataSource = ds.Tables[0]; rpList.DataBind(); //绑定统计 DataTable dt = MLMGC.COMP.EnumUtil.ToTable <EnumClientStatus>(); //过虑 “所有状态”,"共享" 二项 dt.Rows.Remove(dt.Select("name='" + EnumClientStatus.所有状态 + "'")[0]); dt.Rows.Remove(dt.Select("name='" + EnumClientStatus.共享 + "'")[0]); dt.Columns.Add("Amount", typeof(int)); dt.Columns.Add("Percentage", typeof(string)); foreach (DataRow dr in dt.Rows) { if (ds.Tables[1].Select("Status=" + dr["id"]).Count() > 0) { dr["Amount"] = ds.Tables[1].Select("[Status]=" + dr["id"])[0]["Amount"]; dr["Percentage"] = ds.Tables[1].Select("[Status]=" + dr["id"])[0]["Percentage"]; } else { dr["Amount"] = "0"; dr["Percentage"] = "0.00"; } } //绑定列表 rpStatistics.DataSource = dt; rpStatistics.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 + " "; }
/// <summary> /// 添加新名录 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>tianzhenyun 2011-10-24</remarks> public bool Add(E_ClientInfo data) { SqlParameter[] parms = { new SqlParameter("@PersonalID", SqlDbType.Int), new SqlParameter("@ClientName", SqlDbType.VarChar, 128), new SqlParameter("@Address", SqlDbType.VarChar, 128), new SqlParameter("@ZipCode", SqlDbType.VarChar, 8), new SqlParameter("@Linkman", SqlDbType.VarChar, 64), new SqlParameter("@Position", SqlDbType.VarChar, 64), new SqlParameter("@Tel", SqlDbType.VarChar, 32), new SqlParameter("@Mobile", SqlDbType.VarChar, 16), new SqlParameter("@Fax", SqlDbType.VarChar, 32), new SqlParameter("@Email", SqlDbType.VarChar, 128), new SqlParameter("@QQ", SqlDbType.VarChar, 128), new SqlParameter("@MSN", SqlDbType.VarChar, 128), new SqlParameter("@Remark", SqlDbType.VarChar), new SqlParameter("@SourceName", SqlDbType.VarChar, 16), new SqlParameter("@TradeName", SqlDbType.VarChar, 16), new SqlParameter("@AreaName", SqlDbType.VarChar, 16), new SqlParameter("@Status", SqlDbType.TinyInt), new SqlParameter("@Website", SqlDbType.VarChar, 128), new SqlParameter("@ClientInfoID", SqlDbType.Int) }; parms[0].Value = data.PersonalID; parms[1].Value = data.ClientName; parms[2].Value = data.Address; parms[3].Value = data.ZipCode; parms[4].Value = data.Linkman; parms[5].Value = data.Position; parms[6].Value = data.Tel; parms[7].Value = data.Mobile; parms[8].Value = data.Fax; parms[9].Value = data.Email; parms[10].Value = data.QQ; parms[11].Value = data.MSN; parms[12].Value = data.Remark; parms[13].Value = data.SourceName; parms[14].Value = data.TradeName; parms[15].Value = data.AreaName; parms[16].Value = (int)EnumClientStatus.潜在客户; parms[17].Value = data.Website; parms[18].Direction = ParameterDirection.Output; int ReturnValue = 0; DbHelperSQL.RunProcedures("ProcPI_B_ClientInfoS_Insert", parms, out ReturnValue); if (ReturnValue > 0)//判断是否录入成功 { data.ClientInfoID = Convert.ToInt32(parms[18].Value); return(true); } return(false); }
/// <summary> /// 名录数据导出 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>qipengfei 2011-10-25</remarks> public DataSet DataExport(E_ClientInfo data) { SqlParameter[] parms = { new SqlParameter("@PersonalID", SqlDbType.Int), new SqlParameter("@Status", SqlDbType.TinyInt) }; parms[0].Value = data.PersonalID; parms[1].Value = (int)data.Status; return(DbHelperSQL.RunProcedureDataSet("ProcPI_B_ClientInfoS_ExportSelect", parms)); }
protected void databind() { //开始计时 DateTime StartTime = DateTime.Now; //获取名录属性信息 E_Property dataProperty = new T_Property().Get(new E_Property() { PersonalID = PersonalID }); TradeFlag = Convert.ToBoolean((int)dataProperty.TradeFlag); AreaFlag = Convert.ToBoolean((int)dataProperty.AreaFlag); SourceFlag = Convert.ToBoolean((int)dataProperty.SourceFlag); E_ClientInfo data = new E_ClientInfo(); data.PersonalID = PersonalID; //--设置名录属性查询属性 data.Property = dataProperty; data.TradeID = Requests.GetQueryInt("tradeid", -1); data.AreaID = Requests.GetQueryInt("areaid", -1); data.SourceID = Requests.GetQueryInt("sourceid", -1); Property1.PropertyData = dataProperty; Property1.AreaID = data.AreaID; Property1.SourceID = data.SourceID; Property1.TradeID = data.TradeID; data.ClientName = Requests.GetQueryString("name"); txtName.Text = data.ClientName; data.Status = EnumClientStatus.潜在客户; //分页参数 data.Page = new MLMGC.DataEntity.E_Page(); data.Page.PageSize = pageSize; data.Page.PageIndex = pageIndex; rpList.DataSource = new T_ClientInfo().LatenceSelect(data); 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 + " "; //停止计时 DateTime EndTime = DateTime.Now; TimeSpan ts = EndTime - StartTime; lblExecTime.Text = ts.TotalSeconds.ToString(); }
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); E_ClientInfo data = new E_ClientInfo(); data.EnterpriseID = EnterpriceID; data.UserID = UserID; data.EPUserTMRID = EPUserTMRID; data.Property = dataProperty; data.TradeID = Requests.GetQueryInt("tradeid", -1); data.AreaID = Requests.GetQueryInt("areaid", -1); data.SourceID = Requests.GetQueryInt("sourceid", -1); Property1.PropertyData = dataProperty; Property1.AreaID = data.AreaID; Property1.SourceID = data.SourceID; Property1.TradeID = data.TradeID; data.TradedMoney = Requests.GetQueryFloat("money", -1); if (data.TradedMoney > 0) { txtMoney.Text = data.TradedMoney.ToString(); } data.ClientName = Requests.GetQueryString("name"); txtName.Text = data.ClientName; data.Mode = EnumClientMode.业务员; data.Status = EnumClientStatus.成交客户; //分页参数 data.Page = new MLMGC.DataEntity.E_Page(); data.Page.PageSize = pageSize; data.Page.PageIndex = pageIndex; rpList.DataSource = new T_ClientInfo().GetList(data); 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 + " "; }
/// <summary> /// 判断名录是否存在 /// </summary> private void Exists() { E_ClientInfo data = new E_ClientInfo(); data.PersonalID = bp.PersonalID; data.ClientName = nv["clientname"]; string clientinfoid = nv["clientinfoid"]; data.ClientInfoID = Convert.ToInt32(clientinfoid ?? "0"); bool flag = new T_ClientInfo().Exists(data); HttpContext.Current.Response.Write(flag ? "1" : "0"); }
/// <summary> /// 修改名录信息 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>qipengfei 2011-10-26</remarks> public bool Update(E_ClientInfo data) { SqlParameter[] parms = { new SqlParameter("@PersonalID", SqlDbType.Int), new SqlParameter("@ClientInfoID", SqlDbType.Int), new SqlParameter("@ClientName", SqlDbType.VarChar, 128), new SqlParameter("@Address", SqlDbType.VarChar, 128), new SqlParameter("@ZipCode", SqlDbType.VarChar, 8), new SqlParameter("@Linkman", SqlDbType.VarChar, 64), new SqlParameter("@Position", SqlDbType.VarChar, 64), new SqlParameter("@Tel", SqlDbType.VarChar, 32), new SqlParameter("@Mobile", SqlDbType.VarChar, 16), new SqlParameter("@Fax", SqlDbType.VarChar, 32), new SqlParameter("@Email", SqlDbType.VarChar, 128), new SqlParameter("@QQ", SqlDbType.VarChar, 128), new SqlParameter("@MSN", SqlDbType.VarChar, 128), new SqlParameter("@Remark", SqlDbType.VarChar), new SqlParameter("@SourceID", SqlDbType.Int), new SqlParameter("@TradeID", SqlDbType.Int), new SqlParameter("@AreaID", SqlDbType.Int), new SqlParameter("@Website", SqlDbType.VarChar, 128) }; parms[0].Value = data.PersonalID; parms[1].Value = data.ClientInfoID; parms[2].Value = data.ClientName; parms[3].Value = data.Address; parms[4].Value = data.ZipCode; parms[5].Value = data.Linkman; parms[6].Value = data.Position; parms[7].Value = data.Tel; parms[8].Value = data.Mobile; parms[9].Value = data.Fax; parms[10].Value = data.Email; parms[11].Value = data.QQ; parms[12].Value = data.MSN; parms[13].Value = data.Remark; parms[14].Value = data.SourceID; parms[15].Value = data.TradeID; parms[16].Value = data.AreaID; parms[17].Value = data.Website; int ReturnValue = 0; DbHelperSQL.RunProcedures("ProcPI_B_ClientInfoS_Update", parms, out ReturnValue); if (ReturnValue > 0)//修改成功 { return(true); } return(false); }
/// <summary> /// 批量删除名录信息 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>tianzhenyun 2011-10-26</remarks> public bool BatchDelete(E_ClientInfo data) { SqlParameter[] parms = { new SqlParameter("@PersonalID", SqlDbType.Int), new SqlParameter("@ClientInfoIDs", SqlDbType.NVarChar) }; parms[0].Value = data.PersonalID; parms[1].Value = data.ClientInfoIDs; int ReturnValue = 0; DbHelperSQL.RunProcedures("ProcPI_B_ClientInfoS_BatchDelete", parms, out ReturnValue); return(ReturnValue > 0); }
/// <summary> /// 判断电话和手机是否存在 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>tianzhenyun 2012-02-14</remarks> public DataTable ExistsContact(E_ClientInfo data) { SqlParameter[] parms = { new SqlParameter("@PersonalID", SqlDbType.Int), new SqlParameter("@ClientInfoID", SqlDbType.Int), new SqlParameter("@Type", SqlDbType.TinyInt), new SqlParameter("@Value", SqlDbType.VarChar, 16) }; parms[0].Value = data.PersonalID; parms[1].Value = data.ClientInfoID; parms[2].Value = data.Type; parms[3].Value = data.Value; return(DbHelperSQL.RunProcedureTable("ProcPI_B_ClientInfo_ExistsContact", parms)); }
/// <summary> /// 数据绑定 /// </summary> 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); E_ClientInfo data = new E_ClientInfo(); data.EnterpriseID = EnterpriceID; data.TeamID = TeamID; data.Mode = EnumClientMode.团队; data.Status = EnumClientStatus.待分配名录; data.Property = dataProperty; data.ClientName = Requests.GetQueryString("name"); data.SourceID = Requests.GetQueryInt("sourceid", -1); data.AreaID = Requests.GetQueryInt("areaid", -1); data.TradeID = Requests.GetQueryInt("tradeid", -1); //设置分页参数 data.Page = new MLMGC.DataEntity.E_Page(); string start = Requests.GetQueryString("startdate"); string end = Requests.GetQueryString("enddate"); if (!string.IsNullOrWhiteSpace(start)) { data.Page.StartDate = Convert.ToDateTime(start); } if (!string.IsNullOrWhiteSpace(end)) { data.Page.EndDate = Convert.ToDateTime(end); } data.Page.PageIndex = pageIndex; data.Page.PageSize = pageSize; rpList.DataSource = new T_ClientInfo().LeaderWaitList(data); 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 btnExport_Click(object sender, EventArgs e) { bool b = false; T_ClientInfo bll = new T_ClientInfo(); E_ClientInfo data = new E_ClientInfo(); data.PersonalID = PersonalID; data.SetStatus = int.Parse(rblStatus.SelectedValue.ToString()); DataSet ds = bll.DataExport(data); Jscript.ShowMsg(b ? "导出成功" : "操作失败", this); ExportDataSet(ds, "导出——" + DateTime.Now.ToString("yyyyMMddHHss") + "(" + data.Status.ToString() + ")", new List <string>() { "名录信息", "来源信息", "行业信息", "地区信息" }); }
/// <summary> /// 判断名录名是否存在 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>tianzhenyun 2011-10-24</remarks> public bool Exists(E_ClientInfo data) { SqlParameter[] parms = { new SqlParameter("@PersonalID", SqlDbType.Int), new SqlParameter("@ClientInfoID", SqlDbType.Int), new SqlParameter("@ClientName", SqlDbType.VarChar, 128) }; parms[0].Value = data.PersonalID; parms[1].Value = data.ClientInfoID; parms[2].Value = data.ClientName; int ReturnValue = 0; DbHelperSQL.RunProcedures("ProcPI_B_ClientInfo_Exists", parms, out ReturnValue); return(ReturnValue > 0); }
/// <summary> /// 批量删除名录 /// </summary> private void Delete() { string ids = nv["ids"]; if (MLMGC.COMP.StringUtil.IsStringArrayList(ids)) { E_ClientInfo data = new E_ClientInfo(); data.PersonalID = bp.PersonalID; data.ClientInfoIDs = ids; bool b = new T_ClientInfo().BatchDelete(data); HttpContext.Current.Response.Write(b ? "1" : "0"); } else { HttpContext.Current.Response.Write("参数错误"); } }