public List<FaxTypeDB> GetAllFaxTypeByAccountTypeName(string accountTypeString) { DBManager db = new DBManager(); return db.GetAllFaxTypeByAccountTypeName(accountTypeString); }
// Contact public int SelfAddContact(string firstName, string middleName, string lastName, string email, string fax) { DBManager db = new DBManager(); AccountDB selfAccount = db.GetSelfAccount(); ContactDB contact = new ContactDB(); contact.FirstName = firstName; contact.MiddleName = middleName; contact.LastName = lastName; contact.AccountId = selfAccount.Id; if (!String.IsNullOrEmpty(email)) { List<EmailDB> listEmail = new List<EmailDB>(); EmailDB emailDB = new EmailDB(); emailDB.Value = email; List<EmailTypeDB> listEmailType = db.GetAllEmailTypeByAccountTypeName(AccountTypeDB.TYPE_SELF_STRING); if (listEmailType.Count() > 0) { emailDB.EmailType = listEmailType[0]; } listEmail.Add(emailDB); contact.ListEmail = listEmail; } if (!String.IsNullOrEmpty(fax)) { List<FaxDB> listFax = new List<FaxDB>(); FaxDB faxDB = new FaxDB(); faxDB.Value = fax; List<FaxTypeDB> listFaxType = db.GetAllFaxTypeByAccountTypeName(AccountTypeDB.TYPE_SELF_STRING); if (listFaxType.Count() > 0) { faxDB.FaxType = listFaxType[0]; } listFax.Add(faxDB); contact.ListFax = listFax; } List<ContactDB> list = new List<ContactDB>(); list.Add(contact); return db.AddOrUpdateContacts(list); }