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.Globalization; using System.Configuration; using Newtonsoft.Json; using System.Web.Script.Serialization; namespace Mtxfw.VipSite { public partial class Admin_Member_business_editlist : 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_editlist.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 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(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.SJRememberID=" + 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 + "%'))"); } } string strOrder = " Order by ApplyTime desc"; MyPager.PageSize = 50; MyPager.RecordCount = daoBus.GetCount("utype='3' and CompanyId='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,", "utype='3' and CompanyId='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; 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); Mtxfw.Model.user_info umodel = daoUser.GetModel(model.UserId); if (umodel != null) { Mtxfw.Model.business_info bmodel = daoBus.GetModelByUserId(0, model.UserId); if (bmodel != null) { if (bmodel.CompanyName != model.CompanyName) { bmodel.CompanyName = model.CompanyName; } if (bmodel.ClsnName != model.ClsnName) { bmodel.ClsnName = model.ClsnName; } if (bmodel.Province != model.Province) { bmodel.Province = model.Province; } if (bmodel.City != model.City) { bmodel.City = model.City; } if (bmodel.County != model.County) { bmodel.County = model.County; } if (bmodel.IFFill != model.IFFill) { bmodel.IFFill = model.IFFill; } if (bmodel.Agentrading != model.Agentrading) { bmodel.Agentrading = model.Agentrading; } if (bmodel.Industry != model.Industry) { bmodel.Industry = model.Industry; } if (bmodel.Introduction2 != model.Introduction2) { bmodel.Introduction2 = model.Introduction2; } if (bmodel.Introduction3 != model.Introduction3) { bmodel.Introduction3 = model.Introduction3; } if (bmodel.picture != model.picture) { bmodel.picture = model.picture; } if (bmodel.BusinessRange != model.BusinessRange) { bmodel.BusinessRange = model.BusinessRange; } if (bmodel.Businesslicense != model.Businesslicense) { bmodel.Businesslicense = model.Businesslicense; } if (bmodel.TaxRegistration != model.TaxRegistration) { bmodel.TaxRegistration = model.TaxRegistration; } if (bmodel.Companyaddress != model.Companyaddress) { bmodel.Companyaddress = model.Companyaddress; } if (bmodel.InternetSite != model.InternetSite) { bmodel.InternetSite = model.InternetSite; } if (bmodel.Busroutes != model.Busroutes) { bmodel.Busroutes = model.Busroutes; } if (bmodel.Introduction != "" && bmodel.Introduction != model.Introduction) { bmodel.Introduction = model.Introduction; } if (bmodel.ContactPeople != model.ContactPeople) { bmodel.ContactPeople = model.ContactPeople; } if (bmodel.ContactPhone != model.ContactPhone) { bmodel.ContactPhone = model.ContactPhone; } if (bmodel.xcoo != model.xcoo) { bmodel.xcoo = model.xcoo; } if (bmodel.ycoo != model.ycoo) { bmodel.ycoo = model.ycoo; } try { DateTime dt = DateTime.Now; string PayID = dt.ToString("yyMMddHHmmss" + model.Id, DateTimeFormatInfo.InvariantInfo); string sys_id = config.hfpaysys_id; string product_id = config.hfpayproduct_id; string req_date = dt.ToString("yyyyMMdd"); string req_seq_id = PayID; string huifu_id = (umodel.CompanyName != "" ? umodel.CompanyName : umodel.CompanyTel); string notify_url = config.webUrl + "/pay/hfpay_chashnotify_url.aspx"; SortedDictionary pay_dic = new SortedDictionary(); pay_dic.Add("req_date", req_date); pay_dic.Add("req_seq_id", req_seq_id); pay_dic.Add("huifu_id", huifu_id); string get_PaySign = Mtxfw.Utility.Interface_WxPay.BuildRequest0(pay_dic, config.hfpayPrivateKey); string strq0 = "{"; strq0 += "\"sys_id\":\"" + sys_id + "\","; strq0 += "\"product_id\":\"" + product_id + "\","; strq0 += "\"data\":{"; strq0 += "\"req_date\":\"" + req_date + "\","; strq0 += "\"req_seq_id\":\"" + req_seq_id + "\","; strq0 += "\"huifu_id\":\"" + huifu_id + "\""; strq0 += "}"; strq0 += ",\"sign\":\"" + get_PaySign + "\""; strq0 += "}"; string strResult = Mtxfw.Utility.Common.getPage2("https://api.huifu.com/v2/merchant/basicdata/query", "", "utf-8", true, true, strq0); //Mtxfw.Utility.Common.WriteHtml("/weixin/apiajaxquery.txt", strResult + "|" + strq0); huifuresult hr = (huifuresult)FromhuifuresultJson(strResult); if (hr.data.resp_code == "00000000") { huifubasicdataresult hr0 = (huifubasicdataresult)FromhuifubasicdataresultJson(strResult); string strResult0 = hr0.data.qry_cash_card_info_list; //Mtxfw.Utility.Common.WriteHtml("/weixin/apiajaxquery0.txt", strResult0); List hr1 = (List)FromhuifucardlistJson(strResult0); if (hr1[0].status == "N") { bmodel.token_no = hr1[0].token_no; daoBus.Updatetoken_no(bmodel.token_no, bmodel.Id); } } } catch (Exception ex) { Model.User_Errlog mo = new Model.User_Errlog(); mo.DLID = 0; mo.ErrType = "银花优选审核修改门店申请修改token_no错误"; mo.addtime = DateTime.Now; mo.ErrBody = ex.ToString(); mo.ErrBody2 = ex.Message; new DAL.User_Errlog().Add(mo); } daoBus.Update(bmodel); } 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 = "银花优选审核修改门店申请" + umodel.UserName + "-" + model.CompanyName; logmodel.UType = 0; logmodel.gtype = gtype; new DAL.User_CZ_log().Add(logmodel); } } } 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); daoBus.Delete(strID); } } } } 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; } public object Fromhuifupayresult1Json(string json) { JavaScriptSerializer js = new JavaScriptSerializer(); return js.Deserialize(json); } public object FromhuifuresultJson(string json) { JavaScriptSerializer js = new JavaScriptSerializer(); return js.Deserialize(json); } public object FromhuifubasicdataresultJson(string json) { JavaScriptSerializer js = new JavaScriptSerializer(); return js.Deserialize(json); } public object FromhuifucardlistJson(string json) { JavaScriptSerializer js = new JavaScriptSerializer(); return js.Deserialize>(json); } } }