private static Account LoadFromDb(int id_acct, int id_user, bool with_mailing_lists, string dataFolder) { Account newAccount; DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan; if (dataFolder == string.Empty) { dbMan = creator.CreateDbManager(); } else { dbMan = creator.CreateDbManager(dataFolder); } try { dbMan.Connect(); newAccount = dbMan.SelectAccountData(id_acct, id_user, with_mailing_lists); } finally { dbMan.Disconnect(); } return(newAccount); }
public static User CreateUser() { WebmailResourceManager resMan = (new WebmailResourceManagerCreator()).CreateResourceManager(); User newUser = null; DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); try { dbMan.Connect(); WebmailSettings settings = (new WebMailSettingsCreator()).CreateWebMailSettings(); int LicensesNum = Utils.GetLicensesNum(settings.LicenseKey); int Users = dbMan.GetUsersCountNotDel(); bool Deleted = ((LicensesNum > 0) && (Users >= LicensesNum)) ? true : false; if (!Deleted) { newUser = dbMan.CreateUser(Deleted); } else { throw new WebMailException(resMan.GetString("ErrorMaximumUsersLicenseIsExceeded")); } } finally { dbMan.Disconnect(); } return(newUser); }
public static void DeleteGroup(AddressBookGroup groupToDelete) { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); try { dbMan.Connect(); dbMan.CreateAddressBookGroup(groupToDelete); } finally { dbMan.Disconnect(); } }
public void RenameGroup(string newName) { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); try { dbMan.Connect(); dbMan.UpdateAddressBookGroup(this); } finally { dbMan.Disconnect(); } }
public void Update() { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); try { dbMan.Connect(); dbMan.UpdateAddressBookContact(this); } finally { dbMan.Disconnect(); } }
public void UpdateUser() { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); try { dbMan.Connect(); dbMan.UpdateUser(this); } finally { dbMan.Disconnect(); } }
public static void Delete(int id_admin) { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); try { dbMan.Connect(); dbMan.DeleteSubadmin(id_admin); } finally { dbMan.Disconnect(); } }
public void SetSenderSafety(string email, byte safety) { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); try { dbMan.Connect(); dbMan.SetSender(email, safety); } finally { dbMan.Disconnect(); } }
public static void DeleteUserSettings(int id) { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); try { dbMan.Connect(); dbMan.DeleteSettingsData(id); } finally { dbMan.Disconnect(); } }
public byte GetSenderSafety(string email) { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); try { dbMan.Connect(); return(dbMan.GetSenderSafety(email, _id)); } finally { dbMan.Disconnect(); } }
public static void UpdateUsersByLicences(int licences_num) { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); try { dbMan.Connect(); dbMan.MarkUsersAsDeletedByLicences(licences_num); } finally { dbMan.Disconnect(); } }
public static User LoadUser(int id) { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); try { dbMan.Connect(); return(dbMan.SelectUser(id)); } finally { dbMan.Disconnect(); } }
public static void Update(int id_admin, string login, string password, string description, List <string> domains) { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); try { dbMan.Connect(); dbMan.UpdateSubadmin(id_admin, login, password, description, domains); } finally { dbMan.Disconnect(); } }
public static void DeleteContact(AddressBookContact contact) { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); try { dbMan.Connect(); dbMan.DeleteAddressBookContacts(new AddressBookContact[] { contact }); } finally { dbMan.Disconnect(); } }
public static AddressBookGroup CreateGroup(AddressBookGroup groupToCreate) { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); try { dbMan.Connect(); groupToCreate = dbMan.CreateAddressBookGroup(groupToCreate); } finally { dbMan.Disconnect(); } return(groupToCreate); }
public static AddressBookContact CreateContact(AddressBookContact contactToCreate) { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); try { dbMan.Connect(); contactToCreate = dbMan.CreateAddressBookContact(contactToCreate); } finally { dbMan.Disconnect(); } return(contactToCreate); }
public AccountCollection GetUserAccounts() { AccountCollection result = null; DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); try { dbMan.Connect(); result = dbMan.SelectUserAccounts(_id); } finally { dbMan.Disconnect(); } return(result); }
public static int Create(string login, string password, string description, List <string> domains) { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); int result = 0; try { dbMan.Connect(); result = dbMan.CreateSubadmin(login, password, description, domains); } finally { dbMan.Disconnect(); } return(result); }
public static int Count(string condition) { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); int result = 0; try { dbMan.Connect(); result = dbMan.GetSubadminCount(condition); } finally { dbMan.Disconnect(); } return(result); }
public static User CreateUser(bool Deleted) { User newUser = null; DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); try { dbMan.Connect(); newUser = dbMan.CreateUser(Deleted); } finally { dbMan.Disconnect(); } return(newUser); }
public static SubadminCollection GetSubadmins(int page, int pageSize, string orderBy, bool asc, string searchCondition) { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); SubadminCollection result = null; try { dbMan.Connect(); result = dbMan.SelectSubadmins(page, pageSize, orderBy, asc, searchCondition); } finally { dbMan.Disconnect(); } return(result); }
public static Subadmin GetSubadmin(string admin) { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); Subadmin result = null; try { dbMan.Connect(); result = dbMan.SelectSubadmin(admin); } finally { dbMan.Disconnect(); } return(result); }
public static DomainCollection GetDomains(int id_admin) { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); DomainCollection result = new DomainCollection(); try { dbMan.Connect(); result = dbMan.SelectDomainsByAdmin(id_admin); } finally { dbMan.Disconnect(); } return(result); }
public static int GetAllUsersCount() { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); int result = 0; try { dbMan.Connect(); result = dbMan.GetAllUsersCount(); } finally { dbMan.Disconnect(); } return(result); }
public static Domain LoadFromDb(int id) { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); Domain dom = null; try { dbMan.Connect(); dom = dbMan.SelectDomainData(id); } finally { dbMan.Disconnect(); } return(dom); }
public static long GetUserMailboxsSize(int id_user) { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); long result = 0; try { dbMan.Connect(); result = dbMan.GetUserMailboxsSize(id_user); } finally { dbMan.Disconnect(); } return(result); }
public static void DeleteFromDb(Account acct) { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); try { dbMan.Connect(); dbMan.DeleteAccount(acct._id); } catch (WebMailDatabaseException ex) { Log.WriteException(ex); throw new WebMailDatabaseException((new WebmailResourceManagerCreator()).CreateResourceManager().GetString("PROC_CANT_DEL_ACCT_BY_ID"), ex); } finally { dbMan.Disconnect(); } if (acct.MailIncomingProtocol != IncomingMailProtocol.WMServer) { FileSystem fs = new FileSystem(acct._email, acct._id, true); fs.DeleteFolder(""); fs = new FileSystem(acct._email, acct._id, false); fs.DeleteFolder(""); } if (acct.MailIncomingProtocol == IncomingMailProtocol.WMServer) { WebmailSettings settings = (new WebMailSettingsCreator()).CreateWebMailSettings(); try { if (settings.EnableWmServer && settings.WmAllowManageXMailAccounts) { WMServerStorage storage = new WMServerStorage(acct); storage.DeleteUser(EmailAddress.GetDomainFromEmail(acct.Email), EmailAddress.GetAccountNameFromEmail(acct.MailIncomingLogin)); } } catch (Exception ex) { Log.WriteException(ex); } } }
public static Domain LoadDomainFromDb(string domainName) { Domain newDomain; DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); try { dbMan.Connect(); newDomain = dbMan.SelectDomainData(domainName); } finally { dbMan.Disconnect(); } return(newDomain); }
public static Account LoadFromDb(string email, string login, string password) { Account newAccount; DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); try { dbMan.Connect(); newAccount = dbMan.SelectAccountData(email, login, password); } finally { dbMan.Disconnect(); } return(newAccount); }
public static List <int> GetDomainsId(int id_admin) { DbManagerCreator creator = new DbManagerCreator(); DbManager dbMan = creator.CreateDbManager(); List <int> result = new List <int>(); try { dbMan.Connect(); result = dbMan.SelectSubadminDomains(id_admin); } finally { dbMan.Disconnect(); } return(result); }