Esempio n. 1
0
        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")
            });
        }
Esempio n. 2
0
        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")
            });
        }
Esempio n. 3
0
        public HttpResponseMessage UpdateSubroute(uppram reparm)
        {
            string result = string.Empty;

            try
            {
                using (YYPlayContext yYPlay = new YYPlayContext())
                {
                    tblSubroute tbls = (from x in yYPlay.tblSubroute
                                        where x.fldAutoID == reparm.fldAutoID
                                        select x).FirstOrDefault();

                    tbls.fldState            = reparm.fldState == "0" ? false : true;
                    tbls.fldWeight           = reparm.fldWeight;
                    tbls.fldMinmoney         = reparm.fldMinmoney;
                    tbls.fldMaxmoney         = reparm.fldMaxmoney;
                    tbls.fldProhibitMerchant = reparm.fldProhibitMerchant;



                    int i = yYPlay.SaveChanges();



                    if (i > 0)
                    {
                        result = rule.JsonStr("ok", "成功", i);
                    }
                    else
                    {
                        result = rule.JsonStr("error", "失败", i);
                    }
                }
            }
            catch (Exception e)
            {
                //错误保存日志
                throw new InsertException(e.Message, "Subroute", "GetSubroute", "");
            }
            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
Esempio n. 4
0
        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 addorupdateMerchantList(addorupdat pram)
        {
            string result = string.Empty;

            try
            {
                using (YYPlayContext db = new YYPlayContext())
                {
                    //如果为空 就插入,否则修改
                    if (pram.isnull)
                    {
                        List <tblMerchantRate> tblMerchantRates = pram.tbl;
                        for (int i = 0; i < tblMerchantRates.Count; i++)
                        {
                            string   fldENName = tblMerchantRates[i].fldENName;
                            tbleRate tbleRate  = (from x in db.tbleRate
                                                  where x.fldENName == fldENName
                                                  select x).Single();
                            if (fldENName != "pay")
                            {
                                tblMerchantRates[i].fldRate = tblMerchantRates[i].fldRate / 100;
                            }
                            tblMerchantRates[i].fldRateCode = tbleRate.fldRateCode;
                        }
                        db.tblMerchantRate.AddRange(tblMerchantRates);
                        db.SaveChanges();
                        result = rule.JsonStr("ok", "更新成功", "");
                    }
                    else
                    {
                        List <tblMerchantRate> rates = pram.tbl;
                        for (int i = 0; i < rates.Count; i++)
                        {
                            string          fldENName  = rates[i].fldENName;
                            string          fldMerchID = rates[i].fldMerchID;
                            tblMerchantRate tbls       = (from x in db.tblMerchantRate
                                                          where x.fldENName == fldENName &&
                                                          x.fldMerchID == fldMerchID
                                                          select x).Single();
                            if (fldENName != "pay")
                            {
                                tbls.fldRate = rates[i].fldRate / 100;
                            }
                            else
                            {
                                tbls.fldRate = rates[i].fldRate;
                            }
                            db.SaveChanges();
                        }
                        result = rule.JsonStr("ok", "更新成功", "");
                    }
                }
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }
            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
Esempio n. 6
0
        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")
            });
        }