public string GetUserRole() { MonamurDBDataSetTableAdapters.V_usersTableAdapter v_usersTableAdapter = new MonamurDBDataSetTableAdapters.V_usersTableAdapter(); MonamurDBDataSet.V_usersDataTable v_usersDataTable = new MonamurDBDataSet.V_usersDataTable(); v_usersTableAdapter.FillById(v_usersDataTable, ID); return(v_usersDataTable.Rows[0]["role"].ToString()); }
public void UpdateProfile() { MonamurDBDataSetTableAdapters.V_usersTableAdapter v_usersTableAdap = new MonamurDBDataSetTableAdapters.V_usersTableAdapter(); MonamurDBDataSet.V_usersDataTable v_usersDT = new MonamurDBDataSet.V_usersDataTable(); v_usersTableAdap.FillById(v_usersDT, ID); Login = v_usersDT.Rows[0]["login"].ToString(); }
public bool AddUser(int roleId) { MonamurDBDataSetTableAdapters.V_usersTableAdapter v_usersTableAdap = new MonamurDBDataSetTableAdapters.V_usersTableAdapter(); MonamurDBDataSet.V_usersDataTable v_usersDT = new MonamurDBDataSet.V_usersDataTable(); v_usersTableAdap.FillByLogin(v_usersDT, Login); if (v_usersDT.Rows.Count == 0) { MonamurDBDataSetTableAdapters.UsersTableAdapter t_usersTableAdap = new MonamurDBDataSetTableAdapters.UsersTableAdapter(); t_usersTableAdap.InsertUser(Login, Password, roleId); return(true); } else { return(false); } }
public bool ChangeProfilePassword(string oldPassword, string newPassword) { MonamurDBDataSetTableAdapters.V_usersTableAdapter v_usersTableAdap = new MonamurDBDataSetTableAdapters.V_usersTableAdapter(); MonamurDBDataSet.V_usersDataTable v_usersDT = new MonamurDBDataSet.V_usersDataTable(); v_usersTableAdap.FillById(v_usersDT, ID); if (oldPassword == v_usersDT.Rows[0]["password"].ToString()) { MonamurDBDataSetTableAdapters.UsersTableAdapter t_usersTableAdap = new MonamurDBDataSetTableAdapters.UsersTableAdapter(); t_usersTableAdap.UpdateUserPassword(newPassword, ID); return(true); } else { return(false); } }
public bool ChangeProfileLogin(string newLogin) { MonamurDBDataSetTableAdapters.V_usersTableAdapter v_usersTableAdap = new MonamurDBDataSetTableAdapters.V_usersTableAdapter(); MonamurDBDataSet.V_usersDataTable v_usersDT = new MonamurDBDataSet.V_usersDataTable(); v_usersTableAdap.FillByLogin(v_usersDT, newLogin); if (v_usersDT.Rows.Count == 0) { MonamurDBDataSetTableAdapters.UsersTableAdapter t_usersTableAdap = new MonamurDBDataSetTableAdapters.UsersTableAdapter(); t_usersTableAdap.UpdateUserProfile(newLogin, ID); return(true); } else { return(false); } }
public bool EditUser(string newLogin, int newRoleId) { MonamurDBDataSetTableAdapters.V_usersTableAdapter v_usersTableAdap = new MonamurDBDataSetTableAdapters.V_usersTableAdapter(); MonamurDBDataSet.V_usersDataTable v_usersDT = new MonamurDBDataSet.V_usersDataTable(); v_usersTableAdap.FillByLogin(v_usersDT, newLogin); if ((v_usersDT.Rows.Count == 0) || ((v_usersDT.Rows.Count == 1) && (Convert.ToInt32(v_usersDT.Rows[0]["id"]) == ID))) { MonamurDBDataSetTableAdapters.UsersTableAdapter t_usersTableAdap = new MonamurDBDataSetTableAdapters.UsersTableAdapter(); t_usersTableAdap.UpdateUserAllParams(newLogin, newRoleId, ID); return(true); } else { return(false); } }