private static void Test_Adduser() { PSUser u = new PSUser() { RUser = "******", RPwd = "pwd", PSUserIds = new List<string> { "22", "3333" } }; UserList ul = new UserList(@"C:\Docs\Pers\PSInterface\PSITest\bin\Debug\"); ul.Load(); ul.AddUser(u); ul.Save(); }
private void AddUser(UserList usrs, RRSUser u) { string encPwd = Helper.EncryptString(u.Pwd); string decPwd = Helper.DecryptString(encPwd); int uix = usrs.GetUserIndex(u.User); PSUser n = new PSUser(); n.RUser = u.User; n.RPwd = u.Pwd; n.PSUserIds = null; if (uix < 0) // not found { usrs.AddUser(n); addCnt++; } else { usrs.UpdateUser(n); updCnt++; } }
private void DeleteUser(UserList usrs, RRSUser u) { string user = u.User.TrimStart('-'); PSUser n = new PSUser(); n.RUser = user; n.RPwd =u.Pwd; if (usrs.DeleteUser(n) == 0) delCnt++; }
private bool CheckUserId(string psuser) { bool rc = false; cuser = null; cuser_ix = -1; ul = new UserList(Server.MapPath("~/App_Data/")); if (ul.Load() == 0) { int uix = ul.GetUserIxForPSId(psuser); if (uix >= 0) { rc = true; cuser = ul.USrs[uix]; cuser_ix = uix; } } else litMsg.Text = "Error loading Users"; return rc; }
private bool CheckUser(string uname, string upwd) { bool rc = false; cuser = null; cuser_ix = -1; ul = new UserList(Server.MapPath("~/App_Data/")); if (ul.Load() == 0) { int uix = ul.GetUserIndex(uname); //Log.Write("CheckUser:uix " + uix.ToString()); if (uix >= 0) { Log.Write(Helper.DecryptString(ul.USrs[uix].RPwd)); if (uname == ul.USrs[uix].RUser && upwd == Helper.DecryptString(ul.USrs[uix].RPwd)) { rc = true; cuser = ul.USrs[uix]; cuser_ix = uix; Log.Write("Creds match"); } } } else litMsg.Text = "Error loading Users"; return rc; }
private bool CheckUser(string uname, string upwd) { bool rc = false; cuser = null; cuser_ix = -1; ul = new UserList(Server.MapPath("~/App_Data/")); if (ul.Load() == 0) { int uix = ul.GetUserIndex(uname); if (uix >= 0) { if (uname == ul.USrs[uix].RUser && upwd == ul.USrs[uix].RPwd) { rc = true; cuser = ul.USrs[uix]; cuser_ix = uix; } } } else litMsg.Text = "Error loading Users"; return rc; }
public int UpdateUser(PSUser u) { int rc = -1; if (u == null) return rc; if (u.RUser == null || u.RUser == string.Empty) return rc; int uix = GetUserIndex(u.RUser); if (uix < 0) return rc; if (uix >= 0) // found { string encPwd = Helper.EncryptString(u.RPwd); USrs[uix].RPwd = encPwd; // u.RPwd; rc = 0; } return rc; }
public int DeleteUser(PSUser u) { int rc = -1; if (u == null) return rc; if (u.RUser == null || u.RUser == string.Empty) return rc; int uix = GetUserIndex(u.RUser); if (uix < 0) return rc; if (uix >= 0) // found { USrs.RemoveAt(uix); rc = 0; } return rc; }
public int AddUser(PSUser u) { int rc = -1; if (u == null) return rc; if (u.RUser == null || u.RUser == string.Empty) return rc; int uix = GetUserIndex(u.RUser); if (uix >= 0) return rc; if (uix < 0) // not found { PSUser n = new PSUser(); string encPwd = Helper.EncryptString(u.RPwd); n.RUser = u.RUser; n.RPwd = encPwd; // u.RPwd; n.PSUserIds = u.PSUserIds; USrs.Add(n); rc = 0; } return rc; }