public HttpResponseMessage Resetpaypassword(string marehid) { string result = string.Empty; try { using (YYPlayContext db = new YYPlayContext()) { RulePayBehavior rulePay = new RulePayBehavior(); tbleMerchant info = (from c in db.tbleMerchant where c.fldMerchID == marehid select c).Single(); info.fldPayPass = rulePay.EncryptionMd5(DateTime.Now.Year + info.fldIdCare.Substring(info.fldIdCare.Length - 6, 6), "x2"); //身份证后6位,为初始密码 int ret = db.SaveChanges(); if (ret < 0) { result = rule.JsonStr("error", "重置失败!", ret); } else { result = rule.JsonStr("ok", "", ret); } } } catch (Exception e) { result = rule.JsonStr("error", e.Message, ""); } return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); }
public HttpResponseMessage Updatepass(param param) { string result = string.Empty; try { using (YYPlayContext db = new YYPlayContext()) { tbleMerchant merchant = (from x in db.tbleMerchant where x.fldMaPass == param.pass && x.fldMerchID == param.MerchantID select x).Single(); merchant.fldMaPass = param.newpass; int count = db.SaveChanges(); if (count > 0) { result = rule.JsonStr("ok", "", true); } else { result = rule.JsonStr("error", "", false); } } } catch (Exception e) { result = rule.JsonStr("error", "", e.Message); } return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); }
/// <summary> /// 功能描述:手工代付 /// 创建时间:20190321 /// 创建 人:周文卿 /// </summary> /// <param name="MerchantId"></param> /// <param name="order_no"></param> /// <param name="cheanlname"></param> /// <returns></returns> public HttpResponseMessage ManualQuery(string MerchantId, string order_no, string cheanlname) { string result = string.Empty; //根据商户ID 查询Key using (YYPlayContext db = new YYPlayContext()) { tbleMerchant merchant = (from x in db.tbleMerchant where x.fldMerchID == MerchantId select x).First(); result = rule.JsonStr("ok", "", merchant); } return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); }
/// <summary> /// 到数据库进行校验登录信息 /// </summary> /// <param name="username">用户名</param> /// <param name="password">密码</param> /// <param name="massge">提示信息</param> /// <returns></returns> private bool CheckUser(string username, string password, ref string massge) { bool bOk = true; RuletblFW_User ruleUser = new RuletblFW_User(); using (YYPlayContext db = new YYPlayContext()) { tbleMerchant tbleMerchant = (from x in db.tbleMerchant where x.fldMerchID == username && x.fldMaPass == password select x).SingleOrDefault(); if (tbleMerchant == null) { bOk = false; } return(bOk); } }
public HttpResponseMessage UpdateMerchantList(pram prams) { string result = string.Empty; try { using (YYPlayContext db = new YYPlayContext()) { tbleMerchant info = (from c in db.tbleMerchant where c.fldAutoID == prams.fldAutoID select c).Single(); info.fldMerchName = prams.fldMerchName; info.fldIdCare = prams.fldIdCare; info.fldIPaddress = prams.fldIPaddress; info.fldPhone = prams.fldPhone; info.fldRemark = ""; info.fldContacts = prams.fldContacts; info.fldAgent = prams.fldAgent; int ret = db.SaveChanges(); if (ret <= 0) { result = rule.JsonStr("error", "更新失败!", ret); } else { result = rule.JsonStr("ok", "", info); } } } catch (Exception e) { result = rule.JsonStr("error", e.Message, ""); } return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); }
public HttpResponseMessage AddDMerchantList(pram tbleMerchantpram) { string result = string.Empty; try { using (YYPlayContext db = new YYPlayContext()) { RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(); Random random = new Random(); string nowid = "100" + random.Next(100, 1000);; tbleMerchant maxid = (from x in db.tbleMerchant orderby x.fldMerchID descending select x).FirstOrDefault(); RulePayBehavior rulePay = new RulePayBehavior(); string fldSecretKey = Guid.NewGuid().ToString("N").ToUpper(); tbleMerchant info = new tbleMerchant(); info.fldMerchID = nowid.ToString();//当前时间加上身份证后四位组成商户ID info.fldMerchName = tbleMerchantpram.fldMerchName; info.fldCreateTime = DateTime.Now; info.fldIdCare = tbleMerchantpram.fldIdCare; info.fldIPaddress = tbleMerchantpram.fldIPaddress; info.fldMaPass = rulePay.EncryptionMd5(tbleMerchantpram.fldIdCare.Substring(tbleMerchantpram.fldIdCare.Length - 6, 6), "x2");//身份证后6位,为初始密码 info.fldPhone = tbleMerchantpram.fldPhone; info.fldRemark = ""; info.fldPayPass = rulePay.EncryptionMd5(DateTime.Now.Year + tbleMerchantpram.fldIdCare.Substring(tbleMerchantpram.fldIdCare.Length - 6, 6), "x2"); info.fldContacts = tbleMerchantpram.fldContacts; info.fldAgent = tbleMerchantpram.fldAgent; info.fldSecretKey = fldSecretKey; db.tbleMerchant.Add(info); int ret = db.SaveChanges(); if (ret <= 0) { result = rule.JsonStr("error", "添加失败!", ret); } else { int count = 0; DataTable dt = rule.getpaging("tbleMerchant", "[fldAutoID],[fldMerchID],[fldMerchName],[fldContacts],[fldPhone],[fldCreateTime],[fldIPaddress],[fldIdCare],[fldAgent],[fldRemark],fldisstand", "1=1" + tbleMerchantpram.where, tbleMerchantpram.page, tbleMerchantpram.limit, tbleMerchantpram.sort, out count); getdata getdatas = new getdata(); getdatas.total = count; getdatas.Table = dt; //查询所有的数据 用于前端筛选 List <tbleMerchant> tbleMerchants = (from x in db.tbleMerchant select x).ToList(); getdatas.tbleMerchants = tbleMerchants; result = rule.JsonStr("ok", "", getdatas); } } } catch (Exception e) { result = rule.JsonStr("error", e.Message, ""); } return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); }