コード例 #1
0
 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());
 }
コード例 #2
0
 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();
 }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
 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);
     }
 }
コード例 #5
0
 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);
     }
 }
コード例 #6
0
 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);
     }
 }