protected ShareOS.Model.Account Parse(SqlDataReader Reader) { DBTable.Account tableAccount = new ShareOS.SQLServerDAL.DBTable.Account(); ShareOS.Model.Account mAccount = new ShareOS.Model.Account(); mAccount.Id = Convert.ToInt32(Reader[tableAccount.Id.Text]); mAccount.UserName = Reader[tableAccount.UserName.Text].ToString().Trim(); mAccount.Password = Reader[tableAccount.Password.Text].ToString().Trim(); mAccount.UserType = Reader[tableAccount.UserType.Text].ToString().Trim(); mAccount.TrueName = Reader[tableAccount.TrueName.Text].ToString().Trim(); return(mAccount); }
public IList <ShareOS.Model.Account> GetAccount() { //´æ´¢¹ý³Ì:Select_Account IList <ShareOS.Model.Account> mAccounts = new List <ShareOS.Model.Account>(); DBProcedure.Select_Account cmdText = new ShareOS.SQLServerDAL.DBProcedure.Select_Account(); using (SqlDataReader reader = SqlHelper.ExecuteReader(ConnectionString.ConnectionStringShares, CommandType.StoredProcedure, cmdText.Text, null)) { while (reader.Read()) { ShareOS.Model.Account mAccount = Parse(reader); mAccounts.Add(mAccount); } } return(mAccounts); }
public ShareOS.Model.Account GetAccountByUserName(string UserName) { ShareOS.Model.Account account; DBProcedure.Select_Account_By_UserName prdCmdText = new ShareOS.SQLServerDAL.DBProcedure.Select_Account_By_UserName(); SQLProcedure prdHelper = new SQLProcedure(ConnectionString.ConnectionStringShares, prdCmdText.Text); prdHelper.SetInputValue(prdCmdText.PARM_UserName.ParameterName, UserName); using (SqlDataReader reader = prdHelper.ExecuteReader()) { if (reader.Read()) { account = Parse(reader); } else { account = new ShareOS.Model.Account(); } } return(account); }