private void Bind(int pageIndex = 1) { CustomerInfoPara aip = new CustomerInfoPara(); aip.PageIndex = pageIndex - 1; aip.PageSize = 10; aip.IsDelete = 0; aip.OrderBy = " id desc "; aip.CpsUserId = Account.UserId; aip.LikeKey = txtSerchTitle.Text; if (!string.IsNullOrEmpty(ddlAd.SelectedValue)) { aip.AdId = int.Parse(ddlAd.SelectedValue); } if (!string.IsNullOrEmpty(ddlExport.SelectedValue)) { aip.IsExport = int.Parse(ddlExport.SelectedValue); } var list = CustomerInfoBLL.Instance.GetModels(ref aip); rptTables.DataSource = list; rptTables.DataBind(); apPager.RecordCount = aip.Recount.Value; }
public override List <CustomerInfoVO> GetModels(ref CustomerInfoPara mp) { string where = GetConditionByPara(mp); int pStart = mp.PageIndex.Value * mp.PageSize.Value; int pEnd = mp.PageSize.Value; string cmd = QUERYPAGE .Replace("@PAGESIZE", pEnd.ToString()) .Replace("@PTOP", pStart.ToString()) .Replace("@WHERE", where) .Replace("@ORDER", GetOrderByPara(mp)); CodeCommand command = new CodeCommand(); command.CommandText = cmd; var table = DbProxyFactory.Instance.Proxy.ExecuteTable(command); List <CustomerInfoVO> list = new List <CustomerInfoVO>(); for (int i = 0; i < table.Rows.Count; i++) { list.Add(new CustomerInfoVO(table.Rows[i])); } if (!mp.Recount.HasValue) { mp.Recount = GetRecords(mp); } return(list); }
public override string GetOrderByPara(CustomerInfoPara mp) { if (!string.IsNullOrEmpty(mp.OrderBy)) { return(string.Format(" order by {0}", mp.OrderBy)); } return(""); }
public override CustomerInfoVO GetSingle(CustomerInfoPara mp) { var list = GetModels(mp); if (list.Count == 1) { return(list[0]); } return(null); }
public override int GetRecords(CustomerInfoPara mp) { string where = GetConditionByPara(mp); CodeCommand command = new CodeCommand(); command.CommandText = QUERYCOUNT + where; var result = DbProxyFactory.Instance.Proxy.ExecuteScalar(command); return(int.Parse(result.ToString())); }
protected void btnExport_Click(object sender, EventArgs e) { CustomerInfoPara aip = new CustomerInfoPara(); aip.OrderBy = " id desc "; aip.IsDelete = 0; aip.LikeKey = txtSerchTitle.Text; var list = CustomerInfoBLL.Instance.GetModels(aip); DataTable table = new DataTable(); table.Columns.Add("广告ID"); table.Columns.Add("产品"); table.Columns.Add("姓名"); table.Columns.Add("电话"); table.Columns.Add("地址"); table.Columns.Add("备注"); table.Columns.Add("时间"); foreach (var item in list) { DataRow row = table.NewRow(); row["广告ID"] = item.AdId; row["产品"] = item.Color + item.Size; row["姓名"] = item.RealName; row["电话"] = item.Phone; row["地址"] = string.Format("{0}-{1}-{2}-{3}", item.UserRegion, item.UserCity, item.UserCountry, item.Address); row["备注"] = item.Remark; row["时间"] = item.CreateDate.ToString(); table.Rows.Add(row); } string url = string.Format("/Resources/Customer/{0}-{1}.xlsx", DateTime.Now.ToString("yyyyMMdd"), Guid.NewGuid().ToString()); string filename = Server.MapPath(url); DN.Framework.Utility.ExcelHelper helper = new DN.Framework.Utility.ExcelHelper(filename); helper.DataTableToExcel(table, DateTime.Now.ToString("yyyyMMdd"), true); //Response.Write("<script>window.open('" + url + "','','','')</script>"); string fname = Path.GetFileName(filename); Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); Response.ContentType = "application/vnd.ms-excel"; Response.AppendHeader("Content-Disposition", "attachment; filename=" + fname); Response.WriteFile(filename); Response.Flush(); Response.End(); }
private void Bind(int pageIndex = 1) { CustomerInfoPara aip = new CustomerInfoPara(); aip.PageIndex = pageIndex - 1; aip.PageSize = 10; aip.OrderBy = " id desc "; aip.IsDelete = 0; aip.LikeKey = txtSerchTitle.Text; var list = CustomerInfoBLL.Instance.GetModels(ref aip); rptTables.DataSource = list; rptTables.DataBind(); apPager.RecordCount = aip.Recount.Value; }
public override bool Delete(CustomerInfoPara mp) { string where = GetConditionByPara(mp); CodeCommand command = new CodeCommand(); command.CommandText = DELETE + where; int result = DbProxyFactory.Instance.Proxy.ExecuteNonQuery(command); if (result >= 1) { return(true); } return(false); }
public static string GetConditionByPara(CustomerInfoPara mp) { StringBuilder sb = new StringBuilder(); if (mp.CpsUserId.HasValue) { if (mp.CpsUserId.HasValue) { sb.AppendFormat(" AND AdId IN (select AdId from [dbo].[CpsUserInfo] where CpsUserId={0})", mp.CpsUserId); } } if (!string.IsNullOrEmpty(mp.LikeKey)) { sb.AppendFormat(" AND ([AdUrl] like '%{0}%' or [RealName] like '%{0}%' or [ProducteName] like '%{0}%' or [Phone] like '%{0}%')", mp.LikeKey); } return(sb.ToString()); }
public override List <CustomerInfoVO> GetModels(CustomerInfoPara mp) { string where = GetConditionByPara(mp); CodeCommand command = new CodeCommand(); string cmd = LOAD .Replace("@WHERE", where) .Replace("@ORDER", GetOrderByPara(mp)); command.CommandText = cmd; var table = DbProxyFactory.Instance.Proxy.ExecuteTable(command); List <CustomerInfoVO> list = new List <CustomerInfoVO>(); for (int i = 0; i < table.Rows.Count; i++) { list.Add(new CustomerInfoVO(table.Rows[i])); } return(list); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/json"; string realname = context.Request.Params["rname"] ?? ""; string phone = context.Request.Params["phone"] ?? ""; string wxname = context.Request.Params["wxname"] ?? ""; string address = context.Request.Params["address"] ?? ""; string url = context.Request.Params["__url"] ?? ""; string remark = context.Request.Params["remark"] ?? ""; string province = context.Request.Params["province"] ?? ""; string city = context.Request.Params["city"] ?? ""; string area = context.Request.Params["area"] ?? ""; string size = context.Request.Params["size"] ?? ""; string color = context.Request.Params["color"] ?? ""; string productname = context.Request.Params["productname"] ?? ""; string num = context.Request.Params["num"] ?? ""; string price = context.Request.Params["price"] ?? ""; int adid = int.Parse(context.Request.Params["adid"] ?? "0"); int aduserid = int.Parse(context.Request.Params["aduserid"] ?? "0"); ApiResult result = new ApiResult(); CustomerInfoVO info = new CustomerInfoVO(); try { info.Size = size; info.Color = color; info.ProducteName = productname; info.Num = int.Parse(num); info.Price = decimal.Parse(price); info.Address = address; info.AdId = adid; info.AdUserId = aduserid; info.AdUrl = url; info.BrowseName = DN.Framework.Utility.ClientHelper.GetBrowseName(); info.BrowseVersion = DN.Framework.Utility.ClientHelper.GetBrowseVersion(); info.ClientId = GetClentId(context.Request, context.Response); info.ClientIp = DN.Framework.Utility.ClientHelper.ClientIP(); info.ExportDate = DateTime.Now; //IP相关信息 info.Country = ""; info.County = ""; info.IpSource = ""; info.Isp = ""; info.Region = ""; info.Area = ""; info.CreateDate = DateTime.Now; info.IsMobile = DN.Framework.Utility.ClientHelper.GetIsMobileDevice() ? 1 : 0; info.OsName = DN.Framework.Utility.ClientHelper.GetOsName(); info.Phone = phone; info.RealName = realname; info.ReferrerUrl = DN.Framework.Utility.ClientHelper.GetReferer(); info.Remark = remark; info.UserCity = city; info.UserCountry = area; info.UserRegion = province; info.WeiXinNum = wxname; CustomerInfoPara cip = new CustomerInfoPara(); cip.RealName = info.RealName; cip.Phone = info.Phone; cip.AdUrl = info.AdUrl; cip.Address = info.Address; var count = CustomerInfoBLL.Instance.GetRecords(cip); if (count == 0) { CustomerInfoBLL.Instance.Add(info); result.code = 1; result.msg = "您的信息己提交成功,稍后销售客服马上联系您。"; } else { result.code = 0; result.msg = "您的信息己提交成功,销售顾问将会与您联系。"; } } catch (Exception ex) { result.msg = "客户提交异常。管理员正在处理中。"; result.code = 0; DN.Framework.Utility.LogHelper.Write(ex.Message, "addcus"); } string json = DN.Framework.Utility.Serializer.SerializeObject(result); context.Response.ClearContent(); context.Response.Write(json); context.Response.End(); }
public override string GetOtherConditionByPara(CustomerInfoPara mp) { return(""); }
public override string GetConditionByPara(CustomerInfoPara mp) { StringBuilder sb = new StringBuilder(); if (mp.Id.HasValue) { sb.AppendFormat(" AND [Id]='{0}' ", mp.Id); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.AdUrl))) { sb.AppendFormat(" AND [AdUrl]='{0}' ", mp.AdUrl); } if (mp.AdId.HasValue) { sb.AppendFormat(" AND [AdId]='{0}' ", mp.AdId); } if (mp.AdUserId.HasValue) { sb.AppendFormat(" AND [AdUserId]='{0}' ", mp.AdUserId); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.RealName))) { sb.AppendFormat(" AND [RealName]='{0}' ", mp.RealName); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.Phone))) { sb.AppendFormat(" AND [Phone]='{0}' ", mp.Phone); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.WeiXinNum))) { sb.AppendFormat(" AND [WeiXinNum]='{0}' ", mp.WeiXinNum); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.Remark))) { sb.AppendFormat(" AND [Remark]='{0}' ", mp.Remark); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.Address))) { sb.AppendFormat(" AND [Address]='{0}' ", mp.Address); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.UserCountry))) { sb.AppendFormat(" AND [UserCountry]='{0}' ", mp.UserCountry); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.UserRegion))) { sb.AppendFormat(" AND [UserRegion]='{0}' ", mp.UserRegion); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.UserCity))) { sb.AppendFormat(" AND [UserCity]='{0}' ", mp.UserCity); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.ClientIp))) { sb.AppendFormat(" AND [ClientIp]='{0}' ", mp.ClientIp); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.ClientId))) { sb.AppendFormat(" AND [ClientId]='{0}' ", mp.ClientId); } if (mp.IsMobile.HasValue) { sb.AppendFormat(" AND [IsMobile]='{0}' ", mp.IsMobile); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.ReferrerUrl))) { sb.AppendFormat(" AND [ReferrerUrl]='{0}' ", mp.ReferrerUrl); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.BrowseName))) { sb.AppendFormat(" AND [BrowseName]='{0}' ", mp.BrowseName); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.BrowseVersion))) { sb.AppendFormat(" AND [BrowseVersion]='{0}' ", mp.BrowseVersion); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.OsName))) { sb.AppendFormat(" AND [OsName]='{0}' ", mp.OsName); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.Country))) { sb.AppendFormat(" AND [Country]='{0}' ", mp.Country); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.Area))) { sb.AppendFormat(" AND [Area]='{0}' ", mp.Area); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.Region))) { sb.AppendFormat(" AND [Region]='{0}' ", mp.Region); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.City))) { sb.AppendFormat(" AND [City]='{0}' ", mp.City); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.County))) { sb.AppendFormat(" AND [County]='{0}' ", mp.County); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.Isp))) { sb.AppendFormat(" AND [Isp]='{0}' ", mp.Isp); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.IpSource))) { sb.AppendFormat(" AND [IpSource]='{0}' ", mp.IpSource); } if (mp.CreateDate.HasValue) { sb.AppendFormat(" AND convert(varchar(10), [CreateDate], 120) = convert(varchar(10), '{0}',120) ", mp.CreateDate.Value.ToString("yyyy-MM-dd")); } if (mp.Num.HasValue) { sb.AppendFormat(" AND [Num]='{0}' ", mp.Num); } if (mp.Price.HasValue) { sb.AppendFormat(" AND [Price]='{0}' ", mp.Price); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.ProducteName))) { sb.AppendFormat(" AND [ProducteName]='{0}' ", mp.ProducteName); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.Color))) { sb.AppendFormat(" AND [Color]='{0}' ", mp.Color); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.Size))) { sb.AppendFormat(" AND [Size]='{0}' ", mp.Size); } if (mp.IsDelete.HasValue) { sb.AppendFormat(" AND [IsDelete]='{0}' ", mp.IsDelete); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.UserAttr))) { sb.AppendFormat(" AND [UserAttr]='{0}' ", mp.UserAttr); } if (mp.CheckState.HasValue) { sb.AppendFormat(" AND [CheckState]='{0}' ", mp.CheckState); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.CheckRemark))) { sb.AppendFormat(" AND [CheckRemark]='{0}' ", mp.CheckRemark); } if (mp.IsExport.HasValue) { sb.AppendFormat(" AND [IsExport]='{0}' ", mp.IsExport); } if (mp.ExportUserId.HasValue) { sb.AppendFormat(" AND [ExportUserId]='{0}' ", mp.ExportUserId); } if (mp.ExportDate.HasValue) { sb.AppendFormat(" AND convert(varchar(10), [ExportDate], 120) = convert(varchar(10), '{0}',120) ", mp.ExportDate.Value.ToString("yyyy-MM-dd")); } sb.Append(CustomerInfoAccessOther.GetConditionByPara(mp)); sb.Insert(0, " WHERE 1=1 "); return(sb.ToString()); }