Ejemplo n.º 1
0
Archivo: register.cs Proyecto: Hcq/Rain
 protected override void ShowPage()
 {
     this.action   = DTRequest.GetQueryString("action");
     this.username = DTRequest.GetQueryString("username");
     this.username = Utils.DropHTML(this.username);
     if (this.action == "" && this.uconfig.regstatus == 0)
     {
         HttpContext.Current.Response.Redirect(this.linkurl(nameof(register), (object)"?action=close"));
     }
     else
     {
         if (!(this.action == "checkmail"))
         {
             return;
         }
         string               queryString = DTRequest.GetQueryString("code");
         Rain.BLL.user_code   userCode    = new Rain.BLL.user_code();
         Rain.Model.user_code model       = userCode.GetModel(queryString);
         if (model == null)
         {
             HttpContext.Current.Response.Redirect(this.linkurl(nameof(register), (object)"?action=checkerror"));
         }
         else
         {
             model.status = 1;
             userCode.Update(model);
             new Rain.BLL.users().UpdateField(model.user_id, "status=0");
         }
     }
 }
Ejemplo n.º 2
0
        public int Add(Rain.Model.user_code model)
        {
            int maxId;

            using (OleDbConnection oleDbConnection = new OleDbConnection(DbHelperOleDb.connectionString))
            {
                oleDbConnection.Open();
                using (OleDbTransaction trans = oleDbConnection.BeginTransaction())
                {
                    try
                    {
                        StringBuilder stringBuilder = new StringBuilder();
                        stringBuilder.Append("insert into " + this.databaseprefix + "user_code(");
                        stringBuilder.Append("user_id,user_name,[type],str_code,[count],status,user_ip,eff_time,add_time)");
                        stringBuilder.Append(" values (");
                        stringBuilder.Append("@user_id,@user_name,@type,@str_code,@count,@status,@user_ip,@eff_time,@add_time)");
                        OleDbParameter[] oleDbParameterArray = new OleDbParameter[9]
                        {
                            new OleDbParameter("@user_id", OleDbType.Integer, 4),
                            new OleDbParameter("@user_name", OleDbType.VarChar, 100),
                            new OleDbParameter("@type", OleDbType.VarChar, 20),
                            new OleDbParameter("@str_code", OleDbType.VarChar, (int)byte.MaxValue),
                            new OleDbParameter("@count", OleDbType.Integer, 4),
                            new OleDbParameter("@status", OleDbType.Integer, 4),
                            new OleDbParameter("@user_ip", OleDbType.VarChar, 20),
                            new OleDbParameter("@eff_time", OleDbType.Date),
                            new OleDbParameter("@add_time", OleDbType.Date)
                        };
                        oleDbParameterArray[0].Value = (object)model.user_id;
                        oleDbParameterArray[1].Value = (object)model.user_name;
                        oleDbParameterArray[2].Value = (object)model.type;
                        oleDbParameterArray[3].Value = (object)model.str_code;
                        oleDbParameterArray[4].Value = (object)model.count;
                        oleDbParameterArray[5].Value = (object)model.status;
                        oleDbParameterArray[6].Value = (object)model.user_ip;
                        oleDbParameterArray[7].Value = (object)model.eff_time;
                        oleDbParameterArray[8].Value = (object)model.add_time;
                        DbHelperOleDb.ExecuteSql(oleDbConnection, trans, stringBuilder.ToString(), oleDbParameterArray);
                        maxId = this.GetMaxId(oleDbConnection, trans);
                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        return(-1);
                    }
                }
            }
            return(maxId);
        }
Ejemplo n.º 3
0
 public Rain.Model.user_code DataRowToModel(DataRow row)
 {
     Rain.Model.user_code userCode = new Rain.Model.user_code();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             userCode.id = int.Parse(row["id"].ToString());
         }
         if (row["user_id"] != null && row["user_id"].ToString() != "")
         {
             userCode.user_id = int.Parse(row["user_id"].ToString());
         }
         if (row["user_name"] != null)
         {
             userCode.user_name = row["user_name"].ToString();
         }
         if (row["type"] != null)
         {
             userCode.type = row["type"].ToString();
         }
         if (row["str_code"] != null)
         {
             userCode.str_code = row["str_code"].ToString();
         }
         if (row["count"] != null && row["count"].ToString() != "")
         {
             userCode.count = int.Parse(row["count"].ToString());
         }
         if (row["status"] != null && row["status"].ToString() != "")
         {
             userCode.status = int.Parse(row["status"].ToString());
         }
         if (row["user_ip"] != null)
         {
             userCode.user_ip = row["user_ip"].ToString();
         }
         if (row["eff_time"] != null && row["eff_time"].ToString() != "")
         {
             userCode.eff_time = DateTime.Parse(row["eff_time"].ToString());
         }
         if (row["add_time"] != null && row["add_time"].ToString() != "")
         {
             userCode.add_time = DateTime.Parse(row["add_time"].ToString());
         }
     }
     return(userCode);
 }
Ejemplo n.º 4
0
        public bool Update(Rain.Model.user_code model)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("update " + this.databaseprefix + "user_code set ");
            stringBuilder.Append("user_id=@user_id,");
            stringBuilder.Append("user_name=@user_name,");
            stringBuilder.Append("[type]=@type,");
            stringBuilder.Append("str_code=@str_code,");
            stringBuilder.Append("[count]=@count,");
            stringBuilder.Append("status=@status,");
            stringBuilder.Append("user_ip=@user_ip,");
            stringBuilder.Append("eff_time=@eff_time,");
            stringBuilder.Append("add_time=@add_time");
            stringBuilder.Append(" where id=@id");
            OleDbParameter[] oleDbParameterArray = new OleDbParameter[10]
            {
                new OleDbParameter("@user_id", OleDbType.Integer, 4),
                new OleDbParameter("@user_name", OleDbType.VarChar, 100),
                new OleDbParameter("@type", OleDbType.VarChar, 20),
                new OleDbParameter("@str_code", OleDbType.VarChar, (int)byte.MaxValue),
                new OleDbParameter("@count", OleDbType.Integer, 4),
                new OleDbParameter("@status", OleDbType.Integer, 4),
                new OleDbParameter("@user_ip", OleDbType.VarChar, 20),
                new OleDbParameter("@eff_time", OleDbType.Date),
                new OleDbParameter("@add_time", OleDbType.Date),
                new OleDbParameter("@id", OleDbType.Integer, 4)
            };
            oleDbParameterArray[0].Value = (object)model.user_id;
            oleDbParameterArray[1].Value = (object)model.user_name;
            oleDbParameterArray[2].Value = (object)model.type;
            oleDbParameterArray[3].Value = (object)model.str_code;
            oleDbParameterArray[4].Value = (object)model.count;
            oleDbParameterArray[5].Value = (object)model.status;
            oleDbParameterArray[6].Value = (object)model.user_ip;
            oleDbParameterArray[7].Value = (object)model.eff_time;
            oleDbParameterArray[8].Value = (object)model.add_time;
            oleDbParameterArray[9].Value = (object)model.id;
            return(DbHelperOleDb.ExecuteSql(stringBuilder.ToString(), oleDbParameterArray) > 0);
        }
Ejemplo n.º 5
0
 public bool Update(Rain.Model.user_code model)
 {
     return(this.dal.Update(model));
 }
Ejemplo n.º 6
0
 public int Add(Rain.Model.user_code model)
 {
     return(this.dal.Add(model));
 }