Пример #1
0
        /// <summary>
        /// 发送注册验证短信
        /// </summary>
        /// <param name="phone"></param>
        /// <returns></returns>
        public string SendRegisterSms(string phone)
        {
            string smscontent = SysAdminConfigDAL.GetConfigsByID(18);//得到短信模板
            Random ran        = new Random();
            int    RandKey    = ran.Next(100000, 999999);
            int    id         = AddVerification(RandKey.ToString());
            string content    = string.Format(smscontent, RandKey.ToString());
            string result     = SendSMSClass.SendSMS(phone, content);

            UpdateVerification(result.Substring(1), id);
            if (result.StartsWith("s"))
            {
                return(id.ToString());
            }
            else
            {
                return("0");
            }
        }
Пример #2
0
 /// <summary>
 /// 单据匹配方法4
 /// </summary>
 /// <returns></returns>
 public int OperateMatchOrder(int hid, int aid)
 {
     int result = 0;
     decimal money = 0;
     HelpeOrderModel help = HelpeOrderDAL.GetHelpOrderInfo(hid);
     AcceptHelpOrderModel accept = AcceptHelpOrderDAL.GetAcceptOrderInfo(aid);
     string helpsmscontent = SysAdminConfigDAL.GetConfigsByID(19);
     string acceptsmscontent = SysAdminConfigDAL.GetConfigsByID(20);
     string issendsms = SysAdminConfigDAL.GetConfigsByID(21);
     if (help == null || accept == null)
     {
         return 0;
     }
     if (help.HStatus == 3 || help.HStatus == 5)
     {
         return 0;
     }
     if (accept.AStatus == 3 || accept.AStatus == 5)
     {
         return 0;
     }
     if (help.DiffAmount == 0 || accept.DiffAmount == 0)
     {
         return 0;
     }
     //系统计算匹配金额
     if (help.DiffAmount < accept.DiffAmount)
     {
         money = help.DiffAmount;
     }
     else if (help.DiffAmount > accept.DiffAmount)
     {
         money = accept.DiffAmount;
     }
     else
     {
         money = help.DiffAmount;
     }
     using (TransactionScope scope = new TransactionScope())
     {
         //插入匹配表
         MatchOrderModel matchmodel = new MatchOrderModel();
         matchmodel.AcceptMemberID = accept.MemberID;
         matchmodel.AcceptMemberName = accept.MemberName;
         matchmodel.AcceptMemberPhone = accept.MemberPhone;
         matchmodel.AcceptOrderCode = accept.OrderCode;
         matchmodel.AcceptOrderID = aid;
         matchmodel.HelperMemberID = help.MemberID;
         matchmodel.HelperMemberName = help.MemberName;
         matchmodel.HelperMemberPhone = help.MemberPhone;
         matchmodel.HelperOrderCode = help.OrderCode;
         matchmodel.HelperOrderID = hid;
         matchmodel.MatchedMoney = money;
         matchmodel.MatchTime = DateTime.Now;
         int rowcount = MatchOrderDAL.AddMatchOrder(matchmodel);
         if (rowcount < 1)
         {
             return 0;
         }
         //更新提供订单表状态
         rowcount = HelpeOrderDAL.UpdateHelpOrderMatch(hid, money);
         if (rowcount < 1)
         {
             return 0;
         }
         //更新接受订单表状态
         rowcount = AcceptHelpOrderDAL.UpdateAcceptOrderMatch(aid, money);
         if (rowcount < 1)
         {
             return 0;
         }
         #region 发送短信
         if (issendsms == "1")
         {
             string helpsms = string.Format(helpsmscontent, help.OrderCode);
             string acceptsms = string.Format(acceptsmscontent, accept.OrderCode);
             string resule = SendSMSClass.SendSMS(help.MemberPhone, helpsms);
             resule = SendSMSClass.SendSMS(accept.MemberPhone, acceptsms);
         }
         #endregion
         scope.Complete();
         result = 1;
     }
     return result;
 }