Example #1
0
 //根据外键进行查询
 public IList<User_InfoEntity> GetAllUser_InfoByring_id(int t_ring_id)
 {
     IList<User_InfoEntity> t_User_Infos = new List<User_InfoEntity>();
        OleDbDataReader sdr = null;
        using(sdr=OLEDBHelp.GetReader("select * from User_Info where ring_id="+t_ring_id))
        {
       while(sdr.Read())
         {
             User_InfoEntity t_User_Info= new User_InfoEntity();
             t_User_Info.User_id=(int)sdr.GetValue(0);
             t_User_Info.Nickname=(string)sdr.GetValue(1);
             t_User_Info.Integral=(int)sdr.GetValue(2);
             t_User_Info.User_create_time=(DateTime)sdr.GetValue(3);
             t_User_Info.Birthday=(DateTime)sdr.GetValue(4);
             t_User_Info.Sex=(string)sdr.GetValue(5);
             t_User_Info.Email=(string)sdr.GetValue(6);
             t_User_Info.Account=(string)sdr.GetValue(7);
             t_User_Info.Password=(string)sdr.GetValue(8);
             t_User_Info.Ring_id=(int)sdr.GetValue(9);
             t_User_Infos.Add(t_User_Info);
         }
         sdr.Close();
     }
     return t_User_Infos;
 }
Example #2
0
 //插入操作
 public int InsertUser_Info(User_InfoEntity t_User_Info)
 {
     //定义插入数据的参数数组
       OleDbParameter[] p=new OleDbParameter[]{
       new OleDbParameter("@User_id",t_User_Info.User_id),
       new OleDbParameter("@Nickname",t_User_Info.Nickname),
       new OleDbParameter("@Integral",t_User_Info.Integral),
       new OleDbParameter("@User_create_time",t_User_Info.User_create_time),
       new OleDbParameter("@Birthday",t_User_Info.Birthday),
       new OleDbParameter("@Sex",t_User_Info.Sex),
       new OleDbParameter("@Email",t_User_Info.Email),
       new OleDbParameter("@Account",t_User_Info.Account),
       new OleDbParameter("@Password",t_User_Info.Password),
       new OleDbParameter("@Ring_id",t_User_Info.Ring_id)
        };
        int i=OLEDBHelp.GetExecute("insert into User_Info values (@User_id,@Nickname,@Integral,@User_create_time,@Birthday,@Sex,@Email,@Account,@Password,@Ring_id)", p) ;
        return i;
 }
Example #3
0
 public int UpdateUser_Info(User_InfoEntity t_User_Info)
 {
     OleDbParameter[] p=new OleDbParameter[]{
     new OleDbParameter("@User_id",t_User_Info.User_id),
     new OleDbParameter("@Nickname",t_User_Info.Nickname),
     new OleDbParameter("@Integral",t_User_Info.Integral),
     new OleDbParameter("@User_create_time",t_User_Info.User_create_time),
     new OleDbParameter("@Birthday",t_User_Info.Birthday),
     new OleDbParameter("@Sex",t_User_Info.Sex),
     new OleDbParameter("@Email",t_User_Info.Email),
     new OleDbParameter("@Account",t_User_Info.Account),
     new OleDbParameter("@Password",t_User_Info.Password),
     new OleDbParameter("@Ring_id",t_User_Info.Ring_id)
     };
     int i=OLEDBHelp.GetExecute("update User_Info set user_id=@User_id,nickname=@Nickname,integral=@Integral,user_create_time=@User_create_time,birthday=@Birthday,sex=@Sex,email=@Email,account=@Account,password=@Password where user_id=@User_id", p) ;
     return i;
 }
Example #4
0
 public User_InfoEntity SelectUser_InfoByID(int t_user_id)
 {
     User_InfoEntity t_User_Info= new User_InfoEntity();
     OleDbDataReader sdr=null;
     using(sdr=OLEDBHelp.GetReader("select * from User_Info where user_id="+t_user_id))
     {
         if(sdr.Read())
         {
             t_User_Info.User_id=(int)sdr.GetValue(0);
             t_User_Info.Nickname=(string)sdr.GetValue(1);
             t_User_Info.Integral=(int)sdr.GetValue(2);
             t_User_Info.User_create_time=(DateTime)sdr.GetValue(3);
             t_User_Info.Birthday=(DateTime)sdr.GetValue(4);
             t_User_Info.Sex=(string)sdr.GetValue(5);
             t_User_Info.Email=(string)sdr.GetValue(6);
             t_User_Info.Account=(string)sdr.GetValue(7);
             t_User_Info.Password=(string)sdr.GetValue(8);
             t_User_Info.Ring_id=(int)sdr.GetValue(9);
         }
     }
     sdr.Close();
     return t_User_Info;
 }
Example #5
0
        public static User_InfoEntity GetUser_InfoByAccount(string account)
        {
            IList<User_InfoEntity> temp = null;
            User_InfoEntity entity = new User_InfoEntity();

            try
            {
                temp = dal.GetAllUser_Info();
                foreach (User_InfoEntity t in temp)
                {
                    if (t.Account.Equals(account))
                    {
                        return t;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return null;
        }
Example #6
0
 public static int UpdateUser_Info(User_InfoEntity t_User_Info)
 {
     int i=-1;
     //定义插入数据的参数数组
     try
     {
         i=dal.UpdateUser_Info(t_User_Info);
     }
     catch(Exception ex)
     {
         throw new Exception(ex.Message);
     }
     return i;
 }
Example #7
0
        public ActionResult Register(string userName, string nickname, string password, string confirmPassword,string sex,string email)
        {
            ViewData["PasswordLength"] = MembershipService.MinPasswordLength;

            if (ValidateRegistration(userName, nickname, password, confirmPassword, sex,email))
            {
                User_InfoEntity t_User_InfoEntity = new User_InfoEntity();
                t_User_InfoEntity.Account = userName;
                t_User_InfoEntity.Password = password;
                t_User_InfoEntity.Nickname = nickname;
                t_User_InfoEntity.Sex = sex;
                t_User_InfoEntity.Email = email;
                t_User_InfoEntity.Ring_id = 3;
                t_User_InfoEntity.Integral = 100;
                //DateTime dt = System.Data.SqlTypes.SqlDateTime.MinValue.Value;
                //dt = birthday;

                int i=User_InfoManager.InsertUser_Info(t_User_InfoEntity);
                if (i > 0)
                {
                    return RedirectToAction("AdminIndex", "Admin");
                }
                else
                {
                    ModelState.AddModelError("_FORM", "创建失败!");
                }
            }
            // If we got this far, something failed, redisplay form
            return View();
        }
Example #8
0
 //插入操作
 public int InsertUser_Info(User_InfoEntity t_User_Info)
 {
     //定义插入数据的参数数组
       SqlParameter[] p=new SqlParameter[]{
       new SqlParameter("@Nickname",t_User_Info.Nickname),
       new SqlParameter("@Integral",t_User_Info.Integral),
       new SqlParameter("@Birthday",t_User_Info.Birthday),
       new SqlParameter("@Sex",t_User_Info.Sex),
       new SqlParameter("@Email",t_User_Info.Email),
       new SqlParameter("@Account",t_User_Info.Account),
       new SqlParameter("@Password",t_User_Info.Password),
       new SqlParameter("@Ring_id",t_User_Info.Ring_id)
        };
       int i = SqlDBHelp.GetExecute("insert into User_Info(Nickname,Integral,Birthday,Sex,Email,Account,Password,Ring_id) values (@Nickname,@Integral,@Birthday,@Sex,@Email,@Account,@Password,@Ring_id)", p);
        return i;
 }