Example #1
0
        public static bool Insert(mmsgnocEntity item)
        {
            DataTable dt = DBAccess.DataAccess.Miou_GetDataSetBySql(DBAccess.LogUName, string.Format("select * from {0} where {1} = {2} ;", tableName, keyName, item.msgid)).Tables[0];
            DataRow   dr = dt.NewRow();

            dr["msgcode"]      = item.msgcode;
            dr["stopdatetime"] = item.stopdatetime;
            dr["mobileno"]     = item.mobileno;

            dt.Rows.Add(dr);
            return(DBAccess.DataAccess.Miou_UpdateDataSet("", tableName, "*", "1<>1", "", dt).StartsWith("000"));
        }
Example #2
0
        public static bool Update(mmsgnocEntity item)
        {
            DataTable dt = DBAccess.DataAccess.Miou_GetDataSetBySql(DBAccess.LogUName, string.Format("select * from {0} where {1} = {2} ;", tableName, keyName, item.msgid)).Tables[0];

            if (dt.Rows.Count == 1)
            {
                dt.Rows[0]["msgcode"]      = item.msgcode;
                dt.Rows[0]["stopdatetime"] = item.stopdatetime;
                dt.Rows[0]["mobileno"]     = item.mobileno;

                return(DBAccess.DataAccess.Miou_UpdateDataSet("", tableName, "*", "1<>1", "", dt).StartsWith("000"));
            }
            else
            {
                return(true);
            }
        }
        public ActionResult GetTelCode(string tel, string area, string scode, int flag = 0)
        {
            PostResponse _Respone = new PostResponse()
            {
                IsSuccess = false
            };

            try
            {
                if (MvcApplication.Syspar.ContainsKey("AllowReg"))
                {
                    if (MvcApplication.Syspar["AllowReg"].keyvalue == "0")
                    {
                        _Respone.IsSuccess = false;
                        _Respone.Message   = !string.IsNullOrEmpty(MvcApplication.Syspar["AllowReg"].keydes) ? MvcApplication.Syspar["AllowReg"].keydes : "暂停注册,请关注官方通知.";
                        return(Json(_Respone));
                    }
                }

                if (!Common.HeistMon.HMon.GetInstance().AddMon("GetTelCode_" + base.GetRequesterIP(), 20))
                {
                    _Respone.IsSuccess = true;
                    return(Json(_Respone));
                }
                if (flag == 0)
                {
                    if (Common.Cache.User.GetInstance().MapingData.ContainsKey(area + tel))
                    {
                        _Respone.IsSuccess = false;
                        _Respone.Message   = "账号已注册,请进入登录页面登录.";

                        return(Json(_Respone));
                    }
                }

                if (TempData["SecurityCode"] != null &&
                    !string.IsNullOrEmpty(scode) &&
                    TempData["SecurityCode"].Equals(scode))
                {
                    string mobileno = area + tel;
                    int    code     = Common.SMS.SMS.random.Next(100000, 999999);
                    if (Common.SMS.SMS.SMS_sender(area == "86" ? tel : area + tel, code.ToString()))
                    {
                        Common.HeistMon.HMon.GetInstance().AddSendMSGIP("GetTelCode_" + base.GetRequesterIP());
                        string info  = "";
                        var    dlist = mmsgnocDal.GetListByWhere(string.Format("mobileno='{0}'", mobileno), ref info);
                        if (dlist != null && dlist.Count > 0)
                        {
                            mmsgnocEntity noc = dlist[0];
                            noc.mobileno     = mobileno;
                            noc.msgcode      = code.ToString();
                            noc.stopdatetime = DateTime.Now.AddMinutes(10);
                            mmsgnocDal.Update(noc);
                        }
                        else
                        {
                            mmsgnocEntity noc = new mmsgnocEntity();
                            noc.msgid        = -1;
                            noc.mobileno     = mobileno;
                            noc.msgcode      = code.ToString();
                            noc.stopdatetime = DateTime.Now.AddMinutes(10);
                            mmsgnocDal.Insert(noc);
                        }
                    }

                    _Respone.IsSuccess = true;
                }
                else
                {
                    _Respone.IsSuccess = false;
                    _Respone.Message   = "验证码有误.";
                }
            }
            catch { }
            return(Json(_Respone));
        }