public static void AddControlAccount(AdminPanelControlAccount cAccount) { List <AdminPanelControlAccount> cAccounts = GetControlAccounts(); cAccounts.Add(cAccount); SetControlAccounts(cAccounts); }
public static void DeleteControlAccount(AdminPanelControlAccount cAccount) { List <AdminPanelControlAccount> cAccounts = GetControlAccounts(); List <AdminPanelControlAccount> cAccountsNew = new List <AdminPanelControlAccount>(); foreach (AdminPanelControlAccount ca in cAccounts) { if (ca.Name != cAccount.Name) { cAccountsNew.Add(ca); } } SetControlAccounts(cAccountsNew); }
public static void SetControlAccountPassword(string Name, string Password) { List <AdminPanelControlAccount> cAccountsNew = new List <AdminPanelControlAccount>(); AdminPanelControlAccount cAccount = new AdminPanelControlAccount(); List <AdminPanelControlAccount> cAccounts = GetControlAccounts(); foreach (AdminPanelControlAccount ca in cAccounts) { cAccount = ca; if (ca.Name == Name) { cAccount.Password = Password; } cAccountsNew.Add(cAccount); } SetControlAccounts(cAccountsNew); }
public static List <AdminPanelControlAccount> GetControlAccounts() { List <AdminPanelControlAccount> cAccounts = new List <AdminPanelControlAccount>(); try { XMLayer xm = XMServer.CreateXMLayer(); string raw = string.Empty; string line; xm.Login(); raw = xm.GetCtrlAccounts(); xm.Logout(); using (StringReader sr = new StringReader(raw)) { string[] data; AdminPanelControlAccount cAccount = new AdminPanelControlAccount(); while ((line = sr.ReadLine()) != null) { line = line.Trim(); if (line == ".") { break; } data = extractCtrlAccounts(line); cAccount.Name = data[0]; cAccount.Password = AdminPanelUtils.DecryptPassword(data[1]); cAccounts.Add(cAccount); } } } catch (Exception error) { Log.WriteException(error); throw new WebMail.WebMailException(error); } return(cAccounts); }