Ejemplo n.º 1
0
 public void Insert(UserInfo userInfo)
 {
     string sql = string.Format(@"Insert into tb_UserInfo ({0},{1},{2},{3},{4},{5},{6},{7}) values(@{0},@{1},@{2},@{3},@{4},@{5},@{6},@{7})",
         UserInfo.USERID, UserInfo.PASSWORD, UserInfo.NAME, UserInfo.STATE, UserInfo.GIVENCREDIT, UserInfo.AVAILABLEGIVENCREDIT, UserInfo.SHARERATE, UserInfo.EMAIL);
     base.ExecuteNonQuery(sql,
     new SqlParameter(UserInfo.USERID, userInfo.UserId),
     new SqlParameter(UserInfo.PASSWORD, userInfo.Password),
     new SqlParameter(UserInfo.NAME, userInfo.Name),
     new SqlParameter(UserInfo.STATE, (int)userInfo.State),
     new SqlParameter(UserInfo.GIVENCREDIT, userInfo.GivenCredit),
     new SqlParameter(UserInfo.AVAILABLEGIVENCREDIT, userInfo.AvailableGivenCredit),
     new SqlParameter(UserInfo.SHARERATE, userInfo.ShareRate),
     new SqlParameter(UserInfo.EMAIL, userInfo.Email));
 }
Ejemplo n.º 2
0
 public void Update(UserInfo userInfo)
 {
     string sql = string.Format(@"UPDATE {0} SET {1}=@{1},{2}=@{2},{3}=@{3},{4}=@{4},{5}=@{5},{6}=@{6},{7}=@{7},{8}=@{8} WHERE {9}=@{9}",
         UserInfo.TABLENAME, UserInfo.PASSWORD, UserInfo.NAME, UserInfo.STATE,
         UserInfo.GIVENCREDIT, UserInfo.AVAILABLEGIVENCREDIT, UserInfo.SHARERATE, UserInfo.EMAIL, UserInfo.LASTCHANGEPWD, UserInfo.USERID);
     base.ExecuteNonQuery(sql,
         new SqlParameter(UserInfo.USERID, userInfo.UserId),
         new SqlParameter(UserInfo.PASSWORD, userInfo.Password),
         new SqlParameter(UserInfo.NAME, userInfo.Name),
         new SqlParameter(UserInfo.STATE, (int)userInfo.State),
         new SqlParameter(UserInfo.GIVENCREDIT, userInfo.GivenCredit),
         new SqlParameter(UserInfo.AVAILABLEGIVENCREDIT, userInfo.AvailableGivenCredit),
         new SqlParameter(UserInfo.SHARERATE, userInfo.ShareRate),
         new SqlParameter(UserInfo.EMAIL, userInfo.Email),
         new SqlParameter(UserInfo.LASTCHANGEPWD, userInfo.LastChangePwd));
 }