using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.OleDb; using System.Data.SqlClient; using System.IO; using System.Text; using System.Drawing; using System.Configuration; using ThoughtWorks.QRCode.Codec; using ThoughtWorks.QRCode.Codec.Data; using ThoughtWorks.QRCode.Codec.Util; namespace Mtxfw.WebSite._Admin { public partial class Admin_Member_business_list : Mtxfw.Utility.MemberBase { public Mtxfw.DAL.business_info daoBus = new Mtxfw.DAL.business_info(); DAL.user_Goods_lb daolb = new DAL.user_Goods_lb(); DAL.P_Product daoProduct = new DAL.P_Product(); DAL.user_info daoUser = new DAL.user_info(); public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config(""); public int gtype = 0; protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (Session["IFPassword"] == null) { Response.Redirect("/Member_IFPassword.aspx?Url=/Admin_Member_business_list.aspx"); } if (IFStores != 1) { Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx"); } if (MemberJS.IndexOf("门店管理") == -1) { Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx"); } if (!IsPostBack) { Select_Bind(); Data_Bind(); } MyPager.PageChanged += delegate(object s, EventArgs ex) { Data_Bind(); }; } protected void Data_Bind() { System.Text.StringBuilder sb = new System.Text.StringBuilder(); String type = Request.QueryString["type"]; String cls = Request.QueryString["cls"]; String key = HttpUtility.UrlDecode(Request.QueryString["key"]); String state = HttpUtility.UrlDecode(Request.QueryString["state"]); String TGYID = HttpUtility.UrlDecode(Request.QueryString["TGYID"]); if (!String.IsNullOrEmpty(type) && type != "-1") { sb.Append(" and companyid='" + type + "'"); Drop_type.SelectedValue = type; } if (!String.IsNullOrEmpty(cls) && cls != "-1") { sb.Append(" and ClsID=" + cls); Drop_Cls.SelectedValue = cls; } if (!String.IsNullOrEmpty(TGYID)) { sb.Append(" and UserID in (select id from user_info b where b.IFStores=0 and b.ActivateBusID=" + TGYID + ")"); } if (!String.IsNullOrEmpty(state) && state != "所有状态") { if (state == "已审核") { sb.Append(" and seef=1"); } if (state == "未审核") { sb.Append(" and seef=0"); } if (state == "不显示预览图片") { sb.Append(" and showpic=1"); } Drop_State.Text = state; } if (!String.IsNullOrEmpty(key)) { if (System.Text.RegularExpressions.Regex.IsMatch(key, @"^[1]+[1,2,3,4,5,6,7,8,9]+\d{9}$")) { sb.Append(" and UserID in (select id from user_info b where b.IFStores=0 and b.UserName like '%" + key + "%')"); } else { sb.Append(" and (CompanyName like '%" + key + "%' or Busroutes like '%" + key + "%' or ContactPeople like '%" + key + "%' or UserId in (select id from user_info b where b.IFStores=0 and b.realname like '%" + key + "%' or b.CompanyCert like '%" + key + "%' or b.CompanyNumber like '%" + key + "%' or b.CompanyPic like '%" + key + "%'))"); } } string strOrder = " Order by ApplyTime desc"; MyPager.PageSize = 50; MyPager.RecordCount = daoBus.GetCount("utype='0'" + sb.ToString()); if (MyPager.RecordCount == 0) { MyPager.Visible = false; } Mtxfw.Utility.Tools.ToBind(Repeater1, daoBus.GetPager(MyPager, "(Select UserName From user_info b Where b.Id=a.UserId) as UserName,(Select realname From user_info b Where b.Id=a.UserId) as realname,(Select thumb_media_id From user_info b Where b.Id=a.UserId) as EWMPic,(Select ActivateBusID From user_info b Where b.Id=a.UserId) as DLRememberID,(Select CompanyNumber From user_info b Where b.Id=a.UserId) as CompanyNumber,(Select CompanyCert From user_info b Where b.Id=a.UserId) as CompanyCert,(Select CompanyPic From user_info b Where b.Id=a.UserId) as CompanyPic,(Select CompanyPic From user_info b Where b.Id=a.UserId) as CompanyPic,(Select CompanyProvince From user_info b Where b.Id=a.UserId) as CompanyProvince,(Select CompanyCity From user_info b Where b.Id=a.UserId) as CompanyCity,(Select umoney42 From user_info b Where b.Id=a.UserId) as umoney42,(Select umoney43 From user_info b Where b.Id=a.UserId) as sjmoney,(Select uLevel40 From user_info b Where b.Id=a.UserId) as uLevel40,", "utype='0'" + sb.ToString() + strOrder)); } protected void Select_Bind() { DataSet ds = daolb.GetList("gtype=" + gtype + " and utype=1 Order By LBLinkID"); foreach (System.Data.DataRow Dr in ds.Tables[0].Rows) { Drop_Cls.Items.Add(new ListItem(Dr["LBName"].ToString(), Dr["id"].ToString())); } ds.Clear(); } protected void Run_Click(object s, System.EventArgs e) { CheckBox Check = new CheckBox(); string strs = seclect_Drop.SelectedItem.Value; FileInfo fileinfo; OleDbConnection myconn = null; string strFile = ""; if (strs == "2") { fileinfo = new FileInfo(Server.MapPath("/App_Data/baobei.xls")); if (fileinfo.Exists) { strFile = ConfigurationManager.AppSettings["Dw_Data"] + "baobeidata" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".xls"; fileinfo.CopyTo(Server.MapPath(strFile), true); string ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Server.MapPath(strFile) + ";" + "Extended Properties=Excel 8.0;"; myconn = new OleDbConnection(ConnStr); //打开数据库的连接 if (myconn.State == 0) { myconn.Open(); } } } foreach (RepeaterItem Item in Repeater1.Items) { //在行中查找到该单选框 Check = (CheckBox)Item.FindControl("checka"); int strID = int.Parse(Check.CssClass); if (Check.Checked == true) { Mtxfw.Model.business_info model = daoBus.GetModel(strID); if (model != null) { if (strs == "0") { if (model.seef == 0) { daoBus.UpdateSel("seef", 1, strID); daoUser.UpdateuLevel("uLevel16", 2, model.UserId); string phone = daoUser.Getzd("UserName", "id=" + model.UserId).ToString(); Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = Card; logmodel.AddTime = DateTime.Now; logmodel.IP = Mtxfw.Utility.Common.GetIP; logmodel.Body = "审核门店" + phone + "-" + model.CompanyName; logmodel.UType = 0; logmodel.gtype = gtype; new DAL.User_CZ_log().Add(logmodel); } var filepath = "/Files/grimage/" + model.Id + "/"; string filename = filepath + "ksjewm.jpg"; if (!File.Exists(Server.MapPath(filepath))) { Directory.CreateDirectory(Server.MapPath(filepath)); } string strurl = config.webUrl; Bitmap bt; string enCodeString = strurl + "/mobile/smpay/?sjid=" + model.UserId; QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(); //设置尺寸 qrCodeEncoder.QRCodeScale = 8; bt = qrCodeEncoder.Encode(enCodeString, Encoding.UTF8); bt.Save(Server.MapPath(filename)); string ewmpic = config.webUrl + filename; daoUser.UpdatePassword("thumb_media_id", ewmpic, model.UserId); } else if (strs == "1") { daoBus.UpdateSel("seef", 0, strID); daoUser.UpdateuLevel("uLevel16", 0, model.UserId); daoUser.UpdatePassword("thumb_media_id", "", model.UserId); string phone = daoUser.Getzd("UserName", "id=" + model.UserId).ToString(); Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = Card; logmodel.AddTime = DateTime.Now; logmodel.IP = Mtxfw.Utility.Common.GetIP; logmodel.Body = "取消审核门店" + phone + "-" + model.CompanyName; logmodel.UType = 0; logmodel.gtype = gtype; new DAL.User_CZ_log().Add(logmodel); } else if (strs == "2") { string hjappid = config.hjpay_ID; string sjname = model.CompanyName; string sjphone = model.ContactPhone; string sjxydm = model.Industry; string sjjszh = "对公账号"; string sjdgzh = model.ClsnName2; string sjkhr = sjname; if (sjdgzh == "") { sjjszh = "个人结算账户"; sjdgzh = model.Busroutes; sjkhr = model.ContactPeople; } string frname = model.frname; string fridcard = model.fridcard; string email = "pmhapp@126.com"; string province = new DAL.province().GetProvince(model.Province); string city = new DAL.city().GetCity(model.City); string county = new DAL.county().GetCounty(model.County); string address = province + city + county + model.Companyaddress; OleDbCommand mycmd = new OleDbCommand("insert into [1、聚合报备$]([平台商户编号],[平台商户名称],[报备商户编号],[报备商户名称],[报备商户简称],[客服电话],[商户主体类型],[商户证件类型],[商户证件编号],[结算账户类型],[结算卡号],[开户人名称],[法人姓名],[法人身份证号],[联系人姓名],[联系邮箱],[联系手机号],[营业地址],[注册地址],[微信支付],[支付宝],[银联],[QQ],[提交时间],[需绑定的公众号APPID],[支付授权目录],[终端类型],[终端布放地址]) values('" + hjappid + "','江苏银花优选数字科技有限公司','','" + sjname + "','" + sjname + "','" + sjphone + "','企业','营业执照','" + sjxydm + "','" + sjjszh + "','" + sjdgzh + "','" + sjkhr + "','" + frname + "','" + fridcard + "','" + frname + "','" + email + "','" + sjphone + "','" + address + "','" + address + "','主扫、公众号','主扫、H5','无','无','" + DateTime.Now.ToLongDateString() + "','" + config.webappKey + "','https://www.pmhapp.cn/mobile/smpay/','11 辅助受理终端','" + province + "-" + city + "-" + county + "-" + model.Companyaddress + "')", myconn); mycmd.CommandType = CommandType.Text; //执行操作(访问数据库) mycmd.ExecuteNonQuery(); } else if (strs == "3") { daoBus.UpdateSel("showpic", 1, strID); } else if (strs == "4") { daoBus.UpdateSel("showpic", 0, strID); } else if (strs == "5") { daoBus.UpdateSel("ifeditbank", 1, strID); } else if (strs == "6") { daoBus.UpdateSel("ifedit", 1, strID); } else if (strs == "14") { string phone = daoUser.Getzd("UserName", "id=" + model.UserId).ToString(); Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = Card; logmodel.AddTime = DateTime.Now; logmodel.IP = Mtxfw.Utility.Common.GetIP; logmodel.Body = "删除门店" + phone + "-" + model.CompanyName; logmodel.UType = 0; logmodel.gtype = gtype; new DAL.User_CZ_log().Add(logmodel); daoUser.UpdateuLevel("uLevel16", 0, model.UserId); daoUser.UpdatePassword("thumb_media_id", "", model.UserId); daoUser.UpdatePassword("PayReason", "", model.UserId); daoBus.Delete(strID); } } } } if (strs == "2") { //关闭数据库的连接 myconn.Close(); } System.Collections.IDictionaryEnumerator CacheEnum = Cache.GetEnumerator(); while (CacheEnum.MoveNext()) { Cache.Remove(CacheEnum.Key.ToString()); } if (strs == "2") { ClientScript.RegisterStartupScript(this.GetType(), "", ""); } else { Data_Bind(); } } public string cuploadimages(string uploadimages) { string str = ""; if (uploadimages != "") { string[] auploadimages = uploadimages.Split('|'); for (int i = 0; i < auploadimages.Length; i++) { if (auploadimages[i] != "") { string src = auploadimages[i], src0 = auploadimages[i]; if (auploadimages[i].IndexOf("https://vip.ksd2023.com") != -1) { src = "https://vip.ksd2023.com/GetFiles.ashx?image=" + auploadimages[i].Replace("https://vip.ksd2023.com", "").Replace("Files/Image/", "") + "&itsize=100x100&itmode=cut"; src0 = "https://vip.ksd2023.com/GetFiles.ashx?image=" + auploadimages[i].Replace("https://vip.ksd2023.com", "").Replace("Files/Image/", "") + "&itsize=10000x10000&itmode=cut"; } else if (auploadimages[i].IndexOf("https://www.pmhapp.cn") != -1) { src = "https://www.pmhapp.cn/GetFiles.ashx?image=" + auploadimages[i].Replace("https://www.pmhapp.cn", "").Replace("Files/Image/", "") + "&itsize=100x100&itmode=cut"; src0 = "https://www.pmhapp.cn/GetFiles.ashx?image=" + auploadimages[i].Replace("https://www.pmhapp.cn", "").Replace("Files/Image/", "") + "&itsize=10000x10000&itmode=cut"; } else { if (auploadimages[i].IndexOf("https://") == -1 && auploadimages[i].IndexOf("http") == -1) { src = "/GetFiles.ashx?image=" + auploadimages[i].Replace("Files/Image/", "") + "&itsize=100x100&itmode=cut"; src0 = "/GetFiles.ashx?image=" + auploadimages[i].Replace("Files/Image/", "") + "&itsize=10000x10000&itmode=cut"; } } str += (""); } } } else { str = "暂无"; } return str; } public string ctgy(int id) { string str = ""; SqlDataReader Dr = daoUser.GetUserName(gtype, id); if (Dr.HasRows) { if (Dr.Read()) { str = Dr["UserName"].ToString() + "
" + Dr["realname"].ToString() + ""; } } Dr.Close(); return str; } public string cfwzx(int id) { string str = ""; string strzd = daoUser.Getzd("DLRememberID", "id=" + id).ToString(); if (strzd != "") { int tgrid = Convert.ToInt32(strzd); SqlDataReader Dr = daoUser.GetUserName(gtype, tgrid); if (Dr.HasRows) { if (Dr.Read()) { str = Dr["UserName"].ToString() + "
" + Dr["realname"].ToString() + ""; } } Dr.Close(); } return str; } } }