Ejemplo n.º 1
0
        public Model_f_user_token DataRowToModel(DataRow row)
        {
            Model_f_user_token _token = new Model_f_user_token();

            if (row != null)
            {
                if (row["user_id"] != null)
                {
                    _token.user_id = row["user_id"].ToString();
                }
                if (row["product_type"] != null)
                {
                    _token.product_type = row["product_type"].ToString();
                }
                if (row["token"] != null)
                {
                    _token.token = row["token"].ToString();
                }
                if ((row["token_time"] != null) && (row["token_time"].ToString() != ""))
                {
                    _token.token_time = new DateTime?(DateTime.Parse(row["token_time"].ToString()));
                }
                if ((row["login_time"] != null) && (row["login_time"].ToString() != ""))
                {
                    _token.login_time = new DateTime?(DateTime.Parse(row["login_time"].ToString()));
                }
                if (row["login_ip"] != null)
                {
                    _token.login_ip = row["login_ip"].ToString();
                }
            }
            return(_token);
        }
Ejemplo n.º 2
0
        public int APPReg(Rc.Model.Resources.Model_F_User model, Model_f_user_token modelToken)
        {
            Dictionary <string, SqlParameter[]> dictionary = new Dictionary <string, SqlParameter[]>();
            StringBuilder builder = new StringBuilder();

            builder = new StringBuilder();
            builder.Append("insert into F_User(");
            builder.Append("UserId,UserName,Password,TrueName,UserIdentity,Birthday,Sex,Email,Mobile,Province,City,County,School,CreateTime,Stoken,StokenTime,Resource_Version,GradeTerm,Subject,UserPost,ExpirationDate)");
            builder.Append(" values (");
            builder.Append("@UserId,@UserName,@Password,@TrueName,@UserIdentity,@Birthday,@Sex,@Email,@Mobile,@Province,@City,@County,@School,@CreateTime,@Stoken,@StokenTime,@Resource_Version,@GradeTerm,@Subject,@UserPost,@ExpirationDate)");
            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@UserId", SqlDbType.Char, 0x24), new SqlParameter("@UserName", SqlDbType.VarChar, 50), new SqlParameter("@Password", SqlDbType.Char, 0x20), new SqlParameter("@TrueName", SqlDbType.NVarChar, 250), new SqlParameter("@UserIdentity", SqlDbType.Char, 1), new SqlParameter("@Birthday", SqlDbType.DateTime), new SqlParameter("@Sex", SqlDbType.Char, 1), new SqlParameter("@Email", SqlDbType.VarChar, 200), new SqlParameter("@Mobile", SqlDbType.VarChar, 20), new SqlParameter("@Province", SqlDbType.NVarChar, 250), new SqlParameter("@City", SqlDbType.NVarChar, 250), new SqlParameter("@County", SqlDbType.NVarChar, 250), new SqlParameter("@School", SqlDbType.NVarChar, 250), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@Stoken", SqlDbType.NVarChar, 50), new SqlParameter("@StokenTime", SqlDbType.DateTime),
                new SqlParameter("@Resource_Version", SqlDbType.Char, 0x24), new SqlParameter("@GradeTerm", SqlDbType.Char, 0x24), new SqlParameter("@Subject", SqlDbType.Char, 0x24), new SqlParameter("@UserPost", SqlDbType.Char, 0x24), new SqlParameter("@ExpirationDate", SqlDbType.DateTime)
            };
            parameterArray[0].Value    = model.UserId;
            parameterArray[1].Value    = model.UserName;
            parameterArray[2].Value    = model.Password;
            parameterArray[3].Value    = model.TrueName;
            parameterArray[4].Value    = model.UserIdentity;
            parameterArray[5].Value    = model.Birthday;
            parameterArray[6].Value    = model.Sex;
            parameterArray[7].Value    = model.Email;
            parameterArray[8].Value    = model.Mobile;
            parameterArray[9].Value    = model.Province;
            parameterArray[10].Value   = model.City;
            parameterArray[11].Value   = model.County;
            parameterArray[12].Value   = model.School;
            parameterArray[13].Value   = model.CreateTime;
            parameterArray[14].Value   = model.Stoken;
            parameterArray[15].Value   = model.StokenTime;
            parameterArray[0x10].Value = model.Resource_Version;
            parameterArray[0x11].Value = model.GradeTerm;
            parameterArray[0x12].Value = model.Subject;
            parameterArray[0x13].Value = model.UserPost;
            parameterArray[20].Value   = model.ExpirationDate;
            dictionary.Add(builder.ToString(), parameterArray);
            builder = new StringBuilder();
            builder.Append("insert into f_user_token(");
            builder.Append("user_id,product_type,token,token_time,login_time,login_ip)");
            builder.Append(" values (");
            builder.Append("@user_id,@product_type,@token,@token_time,@login_time,@login_ip)");
            SqlParameter[] parameterArray2 = new SqlParameter[] { new SqlParameter("@user_id", SqlDbType.Char, 0x24), new SqlParameter("@product_type", SqlDbType.VarChar, 50), new SqlParameter("@token", SqlDbType.VarChar, 50), new SqlParameter("@token_time", SqlDbType.DateTime), new SqlParameter("@login_time", SqlDbType.DateTime), new SqlParameter("@login_ip", SqlDbType.VarChar, 50) };
            parameterArray2[0].Value = modelToken.user_id;
            parameterArray2[1].Value = modelToken.product_type;
            parameterArray2[2].Value = modelToken.token;
            parameterArray2[3].Value = modelToken.token_time;
            parameterArray2[4].Value = modelToken.login_time;
            parameterArray2[5].Value = modelToken.login_ip;
            dictionary.Add(builder.ToString(), parameterArray2);
            return(DbHelperSQL.ExecuteSqlTran(dictionary));
        }
Ejemplo n.º 3
0
        public bool Add(Model_f_user_token model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into f_user_token(");
            builder.Append("user_id,product_type,token,token_time,login_time,login_ip)");
            builder.Append(" values (");
            builder.Append("@user_id,@product_type,@token,@token_time,@login_time,@login_ip)");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@user_id", SqlDbType.Char, 0x24), new SqlParameter("@product_type", SqlDbType.VarChar, 50), new SqlParameter("@token", SqlDbType.VarChar, 50), new SqlParameter("@token_time", SqlDbType.DateTime), new SqlParameter("@login_time", SqlDbType.DateTime), new SqlParameter("@login_ip", SqlDbType.VarChar, 50) };
            cmdParms[0].Value = model.user_id;
            cmdParms[1].Value = model.product_type;
            cmdParms[2].Value = model.token;
            cmdParms[3].Value = model.token_time;
            cmdParms[4].Value = model.login_time;
            cmdParms[5].Value = model.login_ip;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
Ejemplo n.º 4
0
        public List <Model_f_user_token> DataTableToList(DataTable dt)
        {
            List <Model_f_user_token> list = new List <Model_f_user_token>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    Model_f_user_token item = this.dal.DataRowToModel(dt.Rows[i]);
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }
            }
            return(list);
        }
Ejemplo n.º 5
0
        public bool Update(Model_f_user_token model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update f_user_token set ");
            builder.Append("token=@token,");
            builder.Append("token_time=@token_time,");
            builder.Append("login_time=@login_time,");
            builder.Append("login_ip=@login_ip");
            builder.Append(" where user_id=@user_id and product_type=@product_type ");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@token", SqlDbType.VarChar, 50), new SqlParameter("@token_time", SqlDbType.DateTime), new SqlParameter("@login_time", SqlDbType.DateTime), new SqlParameter("@login_ip", SqlDbType.VarChar, 50), new SqlParameter("@user_id", SqlDbType.Char, 0x24), new SqlParameter("@product_type", SqlDbType.VarChar, 50) };
            cmdParms[0].Value = model.token;
            cmdParms[1].Value = model.token_time;
            cmdParms[2].Value = model.login_time;
            cmdParms[3].Value = model.login_ip;
            cmdParms[4].Value = model.user_id;
            cmdParms[5].Value = model.product_type;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
Ejemplo n.º 6
0
 public bool Add(Model_f_user_token model)
 {
     return(this.dal.Add(model));
 }
Ejemplo n.º 7
0
 public bool Update(Model_f_user_token model)
 {
     return(this.dal.Update(model));
 }
Ejemplo n.º 8
0
 public int APPReg(Model_F_User model, Model_f_user_token modelToken)
 {
     return(this.dal.APPReg(model, modelToken));
 }