/// <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> /// 锁定解锁名录:1=锁定,0=解锁 /// </summary> private void Lock() { MLMGC.Security.EnterprisePage ep = new MLMGC.Security.EnterprisePage(true); string ciids = nv["ids"]; int islock = Convert.ToInt32(nv["islock"]); if (!MLMGC.COMP.StringUtil.IsStringArrayList(ciids))//判断格式是否正确 格式:1,21,321 { HttpContext.Current.Response.Write("参数错误"); return; } if (islock > 1 || islock < 0) { HttpContext.Current.Response.Write("参数错误"); return; } E_ClientInfoHelper data = new E_ClientInfoHelper(); data.EnterpriseID = ep.EnterpriceID; data.EPUserTMRID = ep.EPUserTMRID; data.ClientInfoIDs = ciids; data.IsLock = islock; bool flag = new T_ClientInfoHelper().IsLock(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> private void GetNowReservation() { string ids = nv["ids"]; if (!string.IsNullOrEmpty(ids) && !MLMGC.COMP.StringUtil.IsStringArrayList(ids)) { HttpContext.Current.Response.Write("Error"); return; } DataTable dt = new T_ClientInfoHelper().GetReservationNow(new E_Reservation() { EnterpriseID = bp.EnterpriceID, EPUserTMRID = bp.EPUserTMRID, ClientInfoIDs = ids }); JsonArrayCollection jac = new JsonArrayCollection(); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { JsonObjectCollection colDR = new JsonObjectCollection(); colDR.Add(new JsonStringValue("nid", dr["ReservationID"].ToString())); colDR.Add(new JsonStringValue("id", dr["ClientInfoID"].ToString())); colDR.Add(new JsonStringValue("name", dr["ClientName"].ToString())); colDR.Add(new JsonStringValue("date", Convert.ToDateTime(dr["ReservationDate"].ToString()).ToString("yyyy-MM-dd HH:mm"))); colDR.Add(new JsonStringValue("minute", dr["AdvanceMinute"].ToString())); colDR.Add(new JsonStringValue("type", dr["ReType"].ToString())); jac.Add(colDR); } } HttpContext.Current.Response.Write(jac.ToString()); }
protected void databind() { E_ClientInfoHelper data = new E_ClientInfoHelper(); T_ClientInfoHelper bll = new T_ClientInfoHelper(); data.EnterpriseID = EnterpriceID; data.EPUserTMRID = EPUserTMRID; data.TeamID = TeamID; data.Flag = flag; DataTable dt = bll.ComparisonDate(data); rpListDate.DataSource = dt; rpListDate.DataBind(); rpList.DataSource = dt; rpList.DataBind(); }
protected void databind() { E_ClientInfoHelper data = new E_ClientInfoHelper(); T_ClientInfoHelper bll = new T_ClientInfoHelper(); data.EnterpriseID = EnterpriceID; data.EPUserTMRID = EPUserTMRID; data.Page = new MLMGC.DataEntity.E_Page(); DateTime dtStart, dtEnd; if (DateTime.TryParse(txtStartDate.Text, out dtStart)) { data.Page.StartDate = dtStart; } if (DateTime.TryParse(txtEndDate.Text, out dtEnd)) { data.Page.EndDate = dtEnd; } rpList.DataSource = bll.ComparisonProperty(data, flag); rpList.DataBind(); }
/// <summary> /// 导入数据库 /// </summary> /// <returns></returns> public E_ImportingResult ImportingDB() { E_ImportingResult result = new E_ImportingResult(); XmlDocument xmldoc = new XmlDocument(); //加载文件 try { xmldoc.Load(_filename); } catch { //加载文件失败 result.ErrorNumber = 1; return(result); } //读取配置 E_ImportingClientInfo data = new E_ImportingClientInfo(); data.EnterpriseID = _enterpriseid; data.EPUserTMRID = _epuserid; XmlNodeList xnlConfig = xmldoc.SelectNodes("root/CorreField/Field"); for (int i = 0; i < xnlConfig.Count; i++) { XmlElement xe = (XmlElement)xnlConfig[i]; if (string.IsNullOrEmpty(xe.GetAttribute("Source"))) { continue; } switch (xe.GetAttribute("Name").ToLower()) { case "clientname": data.ClientNameFiled = xe.GetAttribute("Source"); break; case "address": data.AddressFiled = xe.GetAttribute("Source"); break; case "zipcode": data.ZipCodeFiled = xe.GetAttribute("Source"); break; case "linkman": data.LinkmanFiled = xe.GetAttribute("Source"); break; case "position": data.PositionFiled = xe.GetAttribute("Source"); break; case "tel": data.TelFiled = xe.GetAttribute("Source"); break; case "mobile": data.MobileFiled = xe.GetAttribute("Source"); break; case "fax": data.FaxFiled = xe.GetAttribute("Source"); break; case "website": data.WebsiteFiled = xe.GetAttribute("Source"); break; case "email": data.EmailFiled = xe.GetAttribute("Source"); break; case "qq": data.QQFiled = xe.GetAttribute("Source"); break; case "msn": data.MSNFiled = xe.GetAttribute("Source"); break; case "remark": data.RemarkFiled = xe.GetAttribute("Source"); break; case "sourcecode": data.SourceCodeFiled = xe.GetAttribute("Source"); break; case "tradecode": data.TradeCodeFiled = xe.GetAttribute("Source"); break; case "areacode": data.AreaCodeFiled = xe.GetAttribute("Source"); break; default: break; } } //读取数据 XmlNodeList xnlList = xmldoc.SelectNodes("root/List/Item"); int len = xnlList.Count; MLMGC.BLL.Enterprise.T_ClientInfo bll = new MLMGC.BLL.Enterprise.T_ClientInfo(); DataTable dt; for (int i = 0; i < len; i++) { data.ClientName = GetData(xnlList[i], data.ClientNameFiled); data.AddressFiled = GetData(xnlList[i], data.AddressFiled); data.ZipCode = GetData(xnlList[i], data.ZipCodeFiled); data.Linkman = GetData(xnlList[i], data.LinkmanFiled); data.Position = GetData(xnlList[i], data.PositionFiled); data.Tel = GetData(xnlList[i], data.TelFiled); data.Mobile = GetData(xnlList[i], data.MobileFiled); data.Fax = GetData(xnlList[i], data.FaxFiled); data.Website = GetData(xnlList[i], data.WebsiteFiled); data.Email = GetData(xnlList[i], data.EmailFiled); data.QQ = GetData(xnlList[i], data.QQFiled); data.MSN = GetData(xnlList[i], data.MSNFiled); data.Remark = GetData(xnlList[i], data.RemarkFiled); data.SourceCode = GetData(xnlList[i], data.SourceCodeFiled); data.TradeCode = GetData(xnlList[i], data.TradeCodeFiled); data.AreaCode = GetData(xnlList[i], data.AreaCodeFiled); //判断名录名是否存在 dt = bll.Exists(new E_ClientInfo() { EnterpriseID = _enterpriseid, ClientName = data.ClientName, ClientInfoID = 0 }); if (dt == null || dt.Rows.Count == 0) { result.FailList.Add("出错了!"); ++result.FailNum; continue; } if (dt.Rows[0]["Flag"].ToString() != "-1") { result.FailList.Add(string.Format("[{0}]已经导入数据库! 第{1}行", data.ClientName, i)); ++result.FailNum; continue; } //判断手机是否存在 if (!string.IsNullOrEmpty(data.Mobile)) { dt = new T_ClientInfoHelper().ExistsContact(new E_ClientInfoHelper { EnterpriseID = _enterpriseid, ClientInfoID = 0, Type = 1, Value = data.Mobile }); if (dt == null || dt.Rows.Count == 0) { result.FailList.Add("出错了!"); ++result.FailNum; continue; } if (dt.Rows[0]["Flag"].ToString() != "-1") { result.FailList.Add(string.Format("手机号码[{0}]已经存在于数据库! 第{1}行", data.Mobile, i)); ++result.FailNum; continue; } } //判断电话是否存在 if (!string.IsNullOrEmpty(data.Tel)) { dt = new T_ClientInfoHelper().ExistsContact(new E_ClientInfoHelper { EnterpriseID = _enterpriseid, ClientInfoID = 0, Type = 2, Value = data.Tel }); if (dt == null || dt.Rows.Count == 0) { result.FailList.Add("出错了!"); ++result.FailNum; continue; } if (dt.Rows[0]["Flag"].ToString() != "-1") { result.FailList.Add(string.Format("电话号码[{0}]已经存在于数据库! 第{1}行", data.Tel, i)); ++result.FailNum; continue; } } bool b = bll.Add(data); if (b) { ++result.SuccNum; } else { ++result.FailNum; result.FailList.Add(data.ClientName); } } //删除文件 try { System.IO.File.Delete(_filename); } catch { } return(result); }
/// <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; DataTable dt; for (int i = 1; i <= count; ++i) { if (ISCheckRowStrNullOrEmpty(i, shtClient)) { continue; } row = shtClient.GetRow(i); data = new E_ClientInfo(); data.EnterpriseID = _enterpriseid; data.EPUserTMRID = _epusertmrid; data.UserID = _userid; 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.SourceCode = GetCellValue(row.GetCell(12)); //来源编码 data.TradeCode = GetCellValue(row.GetCell(13)); //行业编码 data.AreaCode = GetCellValue(row.GetCell(14)); //地区编码 data.Remark = GetCellValue(row.GetCell(15)); //备注 //判断名录名是否存在 dt = bll.Exists(new E_ClientInfo() { EnterpriseID = _enterpriseid, ClientName = data.ClientName, ClientInfoID = 0 }); if (dt == null || dt.Rows.Count == 0) { _result.Add("出错了!"); ++errorNum; continue; } if (dt.Rows[0]["Flag"].ToString() != "-1") { _result.Add(string.Format("[{0}]已经导入数据库! 位置[{1}]中,第{2}行", data.ClientName, strClientName, i)); ++errorNum; continue; } //判断手机是否存在 if (!string.IsNullOrEmpty(data.Mobile)) { dt = new T_ClientInfoHelper().ExistsContact(new E_ClientInfoHelper { EnterpriseID = _enterpriseid, ClientInfoID = 0, Type = 1, Value = data.Mobile }); if (dt == null || dt.Rows.Count == 0) { _result.Add("出错了!"); ++errorNum; continue; } if (dt.Rows[0]["Flag"].ToString() != "-1") { _result.Add(string.Format("手机号码[{0}]已经存在于数据库! 位置[{1}]中,第{2}行", data.Mobile, strClientName, i)); ++errorNum; continue; } } //判断电话是否存在 if (!string.IsNullOrEmpty(data.Tel)) { dt = new T_ClientInfoHelper().ExistsContact(new E_ClientInfoHelper { EnterpriseID = _enterpriseid, ClientInfoID = 0, Type = 2, Value = data.Tel }); if (dt == null || dt.Rows.Count == 0) { _result.Add("出错了!"); ++errorNum; continue; } if (dt.Rows[0]["Flag"].ToString() != "-1") { _result.Add(string.Format("电话号码[{0}]已经存在于数据库! 位置[{1}]中,第{2}行", data.Tel, strClientName, i)); ++errorNum; continue; } } //名录写入数据库 if (bll.Add(data))//判断名录写入成功与失败 { ++succNum; } else { ++errorNum; } } _result.Add(string.Format("成功导入{0}条,失败{1}条。", succNum, errorNum)); return(errorNum == 0); }
/// <summary> /// 绑定页面数据 /// </summary> protected void databind() { int ciid = Requests.GetQueryInt("ciid", 0); Operate1.ClientInfoID = ciid; //-----------------绑定基本信息------------------------------ E_ClientInfo data = new T_ClientInfo().GetModel(new E_ClientInfo() { EnterpriseID = EnterpriceID, ClientInfoID = ciid, EPUserTMRID = EPUserTMRID }); if (data == null) { Jscript.AlertAndRedirect(this, "无权限查看信息", "/enterprise/clientinfosearch.aspx"); return; } #region info的绑定 lblClientName.Text = data.ClientName; lblAddress.Text = data.Address; lblZipCode.Text = data.ZipCode; lblLinkman.Text = data.Linkman; lblPosition.Text = data.Position; lblEmail.Text = data.Email; lblTel.Text = data.Tel; lblMobile.Text = data.Mobile; hlWebsite.NavigateUrl = data.Website.IndexOf("http://") == -1 ? "http://" + data.Website : data.Website; hlWebsite.Text = data.Website; lblFax.Text = data.Fax; lblQQ.Text = data.QQ; lblMSN.Text = data.MSN; lblRemark.Text = data.Remark; #endregion txtClientName.Text = data.ClientName; txtAddress.Text = data.Address; txtZipCode.Text = data.ZipCode; txtLinkman.Text = data.Linkman; txtPosition.Text = data.Position; txtEmail.Text = data.Email; txtTel.Text = data.Tel; txtWebsite.Text = data.Website; txtMobile.Text = data.Mobile; txtFax.Text = data.Fax; txtQQ.Text = data.QQ; txtMSN.Text = data.MSN; txtRemark.Text = data.Remark; //-----------------绑定名录属性------------------------------ Property1.SourceID = data.SourceID; Property1.TradeID = data.TradeID; Property1.AreaID = data.AreaID; Property2.SourceID = data.SourceID; Property2.TradeID = data.TradeID; Property2.AreaID = data.AreaID; //-----------------绑定状态列表------------------------------ //绑定意向程度 ddlWish.DataSource = new T_Wish().GetList(new E_Wish() { EnterpriseID = EnterpriceID }); ddlWish.DataTextField = "WishName"; ddlWish.DataValueField = "WishID"; ddlWish.DataBind(); //绑定失败理由 ddlNotTraded.DataSource = new T_NotTraded().GetList(new E_NotTraded() { EnterpriseID = EnterpriceID }); ddlNotTraded.DataTextField = "NotTradedName"; ddlNotTraded.DataValueField = "NotTradedID"; ddlNotTraded.DataBind(); //绑定报废理由 ddlScrap.DataSource = new T_Scrap().GetList(new E_Scrap() { EnterpriseID = EnterpriceID }); ddlScrap.DataTextField = "ScrapName"; ddlScrap.DataValueField = "ScrapID"; ddlScrap.DataBind(); //-----------------绑定名录状态------------------------------ hdStatus.Value = ((int)data.Status).ToString(); hdWish.Value = data.WishID.ToString(); ddlWish.SelectedValue = data.WishID.ToString(); txtMoney.Text = data.TradedMoney.ToString(); ddlNotTraded.SelectedValue = data.NotTradedID.ToString(); ddlScrap.SelectedValue = data.ScrapID.ToString(); //----------------绑定沟通记录--------------------- rpExchangeList.DataSource = new T_Exchange().GetList(new E_Exchange() { EnterpriseID = EnterpriceID, ClientInfoID = ciid }); rpExchangeList.DataBind(); txtWdate.Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //----------------绑定 上一个/下一个--------------------- _reservation = MLMGC.COMP.Requests.GetQueryString("s"); DataTable dt = new T_ClientInfoHelper().PrevNext(new E_ClientInfoHelper() { EnterpriseID = EnterpriceID, EPUserTMRID = EPUserTMRID, ClientInfoID = ciid, Status = (ushort)data.Status, IsReservation = _reservation == ""?false:true }); if (dt != null && dt.Rows.Count == 1) { _previousid = Convert.ToInt32(dt.Rows[0]["PrevID"].ToString()); _nextid = Convert.ToInt32(dt.Rows[0]["NextID"].ToString()); } if (_previousid == 0) { btnPrevious.Disabled = true; } if (_nextid == 0) { btnNext.Disabled = true; } Operate1.ClientInfoID = ciid; //----------------绑定预约类型----------------------- MLMGC.COMP.EnumUtil.BindList <EnumReservationType>(ddlReType); }
protected void databind() { string type = Requests.GetQueryString("type"); string ids = Requests.GetQueryString("ids"); //显示邮件配置信息 E_MailConfig data = new T_MailConfig().GetConfig(new E_MailConfig() { EnterpriseID = base.EnterpriceID, UserID = UserID }); if (data == null) { //隐藏发送邮件信息 plSend.Visible = false; return; } else { //隐藏配置信息 plConfig.Visible = false; lbSendUser.Text = data.Name; lbSendUser.ToolTip = "发送邮箱:" + data.Email; } //----------------读取邮件地址---------------- if (StringUtil.IsStringArrayList(ids)) { DataTable dt = new T_ClientInfoHelper().SelectOperate(new E_ClientInfoHelper() { EnterpriseID = EnterpriceID, ClientInfoIDs = ids }); List <string> listEmail = new List <string>(); List <string> listErr = new List <string>(); //--遍历取出邮箱地址 foreach (DataRow dr in dt.Rows) { if (!string.IsNullOrEmpty(dr["Email"].ToString())) { listEmail.Add(dr["Email"].ToString()); } else { listErr.Add(dr["ClientName"].ToString()); } } txtReceiveEmail.Text = string.Join(",", listEmail.ToArray()); if (listErr.Count > 0) { lbErrClient.Text = "部分客户无邮箱地址无法发送邮件";// +string.Join(",", listErr); } } //----------------显示项目资料信息---------------- E_Material dataM = new E_Material(); dataM.EnterpriseID = EnterpriceID; dataM.Page = new MLMGC.DataEntity.E_Page(); dataM.Page.PageSize = 0; dataM.Page.PageIndex = 1; rpList.DataSource = new MLMGC.BLL.Enterprise.Material.T_Material().GetList(dataM); rpList.DataBind(); }
protected void btnSubmit_Click(object sender, EventArgs e) { E_ClientInfo data = new E_ClientInfo(); data.EnterpriseID = EnterpriceID; data.UserID = UserID; data.EPUserTMRID = EPUserTMRID; data.ClientName = txtName.Text.Trim(); data.Address = txtAddress.Text.Trim(); data.ZipCode = txtZipCode.Text.Trim(); data.Position = txtPosition.Text.Trim(); data.Linkman = txtLinkman.Text.Trim(); data.Position = txtPosition.Text.Trim(); data.Tel = txtTel.Text.Trim(); data.Mobile = txtMobile.Text.Trim(); data.Fax = txtFax.Text.Trim(); data.Website = txtWebsite.Text.Trim(); data.QQ = txtQQ.Text.Trim(); data.MSN = txtMSN.Text.Trim(); data.Email = txtEmail.Text.Trim(); data.SourceCode = trSource.Visible?txtSourceCode.Text:string.Empty; data.TradeCode = trTrade.Visible ? txtTradeCode.Text : string.Empty; data.AreaCode = trArea.Visible ? txtAreaCode.Text : string.Empty; data.Remark = txtRemark.Text.Trim(); if (string.IsNullOrWhiteSpace(data.ClientName))//判断是否输入名录名称 { Jscript.ShowMsg("请输入名称", this); txtName.Focus(); return; } //添加之前再次确认名录名称、电话、手机是否唯一 bool flag = true; DataTable dt = new T_ClientInfo().Exists(new E_ClientInfo { EnterpriseID = data.EnterpriseID, ClientInfoID = data.ClientInfoID, ClientName = data.ClientName }); if (dt != null && Convert.ToInt32(dt.Rows[0]["Flag"]) > 0) { flag = false; } //如果手机不为空 if (!string.IsNullOrEmpty(data.Mobile.Trim())) { dt = new T_ClientInfoHelper().ExistsContact(new E_ClientInfoHelper { EnterpriseID = data.EnterpriseID, ClientInfoID = data.ClientInfoID, Type = 1, Value = data.Mobile }); if (dt != null && Convert.ToInt32(dt.Rows[0]["Flag"]) > 0) { flag = false; } } //如果电话不为空 if (!string.IsNullOrEmpty(data.Tel.Trim())) { dt = new T_ClientInfoHelper().ExistsContact(new E_ClientInfoHelper { EnterpriseID = data.EnterpriseID, ClientInfoID = data.ClientInfoID, Type = 2, Value = data.Tel }); if (dt != null && Convert.ToInt32(dt.Rows[0]["Flag"]) > 0) { flag = false; } } if (!flag) { Jscript.ShowMsg("录入失败", this); return; } T_ClientInfo bll = new T_ClientInfo(); bool b = bll.Add(data); if (b) { //添加操作日志 new MLMGC.BLL.Enterprise.T_Log().Add(new MLMGC.DataEntity.Enterprise.E_Log() { EnterpriseID = EnterpriceID, UserID = UserID, LogTitle = "添加名录", IP = MLMGC.COMP.Requests.GetRealIP() }); Jscript.AlertAndRedirect(this, "录入成功", Request.Url.ToString()); } else { Jscript.ShowMsg("录入失败", this); } }