public static UserInfo[] GetAllUsers() { ArrayList al = new ArrayList(); int retValue = -1; //Generated Code for query : dbo.GetAllVendors using (SqlDataReader dr = ProjManagementAdmin.GetAllUsers(out retValue)) //Initialize and retrieve code for Datareader goes here { while (dr.Read()) { UserInfo user = new UserInfo(); user.UserName = dr["user_name"].ToString(); user.UserId = Convert.ToInt32(dr["user_id"]); user.UserEmail = dr["user_email"].ToString(); user.RoleId = Convert.ToInt32(dr["role_id"]); // user.Password = Convert.ToChar(dr["password"]); user.CreatedDate = Convert.ToDateTime(dr["created_date"]); user.ChangedDate = Convert.ToDateTime(dr["changed_date"]); user.ChangedBy = dr["changed_by"].ToString(); al.Add(user); } //dr.Close(); } UserInfo[] allInfo = new UserInfo[al.Count]; al.CopyTo(allInfo); return allInfo; }
public static int AddNewUser(UserInfo user) { if (user == null) throw new ArgumentNullException("user"); int retValue = -1; return ProjManagementAdmin.AddNewUser(user, out retValue); }
public static HttpResponseMessage UpdateUser(UserInfo user) { try { int val = UserDal.UpdateUser(user); return new HttpResponseMessage(HttpStatusCode.OK); } catch (Exception ex) { Console.WriteLine("EXCEPTION: " + ex); return new HttpResponseMessage(HttpStatusCode.BadRequest); } }
public static UserInfo GetUserById(int userId) { int retValue = -1; UserInfo user = new UserInfo(); //Generated Code for query : dbo.GetAllVendors using (SqlDataReader dr = ProjManagementAdmin.GetUserById(userId, out retValue)) //Initialize and retrieve code for Datareader goes here { while (dr.Read()) { user.UserName = dr["user_name"].ToString(); user.UserId = Convert.ToInt32(dr["user_id"]); user.UserEmail = dr["user_email"].ToString(); user.ChangedByName = dr["changed_by"].ToString(); } //dr.Close(); } return user; }
public static UserInfo[] GetAllProjectLeads() { ArrayList al = new ArrayList(); int retValue = -1; using (SqlDataReader dr = ProjManagementAdmin.GetAllProjectLeads(out retValue)) //Initialize and retrieve code for Datareader goes here { while (dr.Read()) { UserInfo user = new UserInfo(); user.UserName = dr["user_name"].ToString(); user.UserId = Convert.ToInt32(dr["user_id"]); user.UserEmail = dr["user_email"].ToString(); user.ChangedByName = dr["changed_by"].ToString(); al.Add(user); } //dr.Close(); } UserInfo[] allInfo = new UserInfo[al.Count]; al.CopyTo(allInfo); return allInfo; }
private static SqlParameter[] GetAddUserParams(UserInfo user) { SqlParameter[] sqlParms = new SqlParameter[100]; sqlParms = SQLHelper.GetCachedParameters(PROC_ADDNEWUSER); if (sqlParms == null) { sqlParms = new SqlParameter[] { new SqlParameter(PARAM_RETURN, SqlDbType.Int), new SqlParameter(PARAM_USER_NAME, SqlDbType.NVarChar, 100), new SqlParameter(PARAM_USER_EMAIL, SqlDbType.NVarChar, 100), new SqlParameter(PARAM_CHANGEDBY, SqlDbType.NVarChar, 100) }; sqlParms[0].Direction = ParameterDirection.ReturnValue; SQLHelper.CacheParameters(PROC_ADDNEWUSER, sqlParms); } //Assigning values to parameter sqlParms[0].Value = -1; sqlParms[1].Value = user.UserName; sqlParms[2].Value = user.UserEmail; sqlParms[3].Value = "sanyam"; return sqlParms; }
public static int UpdateUser(UserInfo user, out int retValue) { retValue = -1; SqlParameter[] parms = GetUpdateUserParams(user); return ExecuteNonQuery(PROC_UPDATEUSER, parms, out retValue); }
public static int AddNewUser(UserInfo user, out int retValue) { retValue = -1; SqlParameter[] parms = GetAddUserParams(user); return ExecuteNonQuery(PROC_ADDNEWUSER, parms, out retValue); }
public static int UpdateUser(UserInfo user) { int retValue = -1; return ProjManagementAdmin.UpdateUser(user, out retValue); }
public HttpResponseMessage Post(UserInfo user) { return UserBl.UpdateUser(user); }
public UserInfo Get(int id) { UserInfo user = new UserInfo(); user = UserBl.GetUserById(id); return user; }
public static int AddNewUser(UserInfo user) { return UserDal.AddNewUser(user); }