public static bool CompareAccountDetails(Models.MyAccountViewModel mv) { //returns true if same false if different bool r = true; if (mv.accountDetails.EmailOnly != mv.StaticaccountDetails.EmailOnly) { return(false); } if (mv.accountDetails.PostOnly != mv.StaticaccountDetails.PostOnly) { return(false); } if (mv.accountDetails.PostAndEmail != mv.StaticaccountDetails.PostAndEmail) { return(false); } Models.AccountDetails NewAccount = mv.accountDetails; Models.AccountDetails OldAccount = mv.StaticaccountDetails; if (OldAccount.ContactAdd1 != NewAccount.ContactAdd1) { return(false); } if (OldAccount.ContactAdd2 != NewAccount.ContactAdd2) { return(false); } if (OldAccount.ContactAdd3 != NewAccount.ContactAdd3) { return(false); } if (OldAccount.ContactAdd4 != NewAccount.ContactAdd4) { return(false); } if (OldAccount.ContactAdd5 != NewAccount.ContactAdd5) { return(false); } if (OldAccount.phoneNumber != NewAccount.phoneNumber) { return(false); } if (OldAccount.Email != NewAccount.Email) { return(false); } return(r); }
//Account Level Contact Prefs private Models.MyAccountViewModel GetAccountDetails(Models.MyAccountViewModel mv) { Models.AccountDetails ad = Models.AccountDetailsMethods.OwnerAccountDetails((int)Session["CustomerID"]); ad.NumberOfOwnedProperties = Models.AccountDetailsMethods.NumberOfOwnedProperties((int)Session["CustomerID"]); mv.accountDetails = ad; mv.StaticaccountDetails = ad; mv.StaticaccountDetails.ContactPref = ad.ContactPref; return(mv); }
//Property Level Contact Pref private Models.MyAccountViewModel GetAccountDetails(Models.MyAccountViewModel mv, int UnitID) { Models.AccountDetails ad = Models.AccountDetailsMethods.OwnerAccountDetails((int)Session["CustomerID"], UnitID); ad.NumberOfOwnedProperties = 1; mv.accountDetails = ad; mv.StaticaccountDetails = ad; mv.StaticaccountDetails.ContactPref = mv.accountDetails.ContactPref; mv.GuidanceHeader = "Property Level Contact Preferences"; mv.Guidance = " are the specific contact preferences for " + Session["SelectedProperty"].ToString() + ". This is where service charge " + "invoices and general correspondence will be sent for " + Session["SelectedProperty"].ToString() + ".These contact preferences can be set to an Agent if one " + "is employed to manage the property."; return(mv); }
public static void UpdateContactPreferences(Models.AccountDetails Account, int customerID) { bool post = false; bool email = false; bool postandemail = false; if (Account.ContactPref == AccountDetails.ContactPreferences.Post) { post = true; } if (Account.ContactPref == AccountDetails.ContactPreferences.email) { email = true; } if (Account.ContactPref == AccountDetails.ContactPreferences.postandemail) { postandemail = true; } List <string> colnames = new List <string>(); colnames.Add("PostOnly"); colnames.Add("Emailonly"); colnames.Add("PostandEmail"); List <string> PList = new List <string>(); PList.Add("@PostOnly"); PList.Add("@Emailonly"); PList.Add("@PostandEmail"); List <object> values = new List <object>(); values.Add(post); values.Add(email); values.Add(postandemail); DBConnectionObject db = GlobalVariables.GetConnection(); DataTable dt = db.Connection.UpdateCommand("core.LeaseholderContactPreferences", colnames, PList, values, " where customerID = " + customerID.ToString()); }
//for updating single property contact preferences public static void UpdatePropertyAccountPreferences(Models.AccountDetails Account, int customerID, int propertyID = 0) { //if PropertyID = 0 then will update contact prefs for all properties. bool post = false; bool email = false; bool postandemail = false; if (Account.ContactPref == AccountDetails.ContactPreferences.Post) { post = true; } if (Account.ContactPref == AccountDetails.ContactPreferences.email) { email = true; } if (Account.ContactPref == AccountDetails.ContactPreferences.postandemail) { postandemail = true; } List <string> colnames = new List <string>(); colnames.Add("PostOnly"); colnames.Add("Emailonly"); colnames.Add("PostandEmail"); colnames.Add("Address_1"); colnames.Add("Address_2"); colnames.Add("Address_3"); colnames.Add("Address_4"); colnames.Add("Address_5"); colnames.Add("email"); colnames.Add("contactnumer"); List <string> PList = new List <string>(); PList.Add("@PostOnly"); PList.Add("@Emailonly"); PList.Add("@PostandEmail"); PList.Add("@Address_1"); PList.Add("@Address_2"); PList.Add("@Address_3"); PList.Add("@Address_4"); PList.Add("@Address_5"); PList.Add("@email"); PList.Add("@contactnumer"); List <object> values = new List <object>(); values.Add(post); values.Add(email); values.Add(postandemail); values.Add(Account.ContactAdd1); if (Account.ContactAdd2 == null) { values.Add(""); } else { values.Add(Account.ContactAdd2); } if (Account.ContactAdd3 == null) { values.Add(""); } else { values.Add(Account.ContactAdd3); } if (Account.ContactAdd4 == null) { values.Add(""); } else { values.Add(Account.ContactAdd4); } values.Add(Account.ContactAdd5); if (Account.Email == null) { values.Add(""); } else { values.Add(Account.Email); } if (Account.phoneNumber == null) { values.Add(""); } else { values.Add(Account.phoneNumber); } DBConnectionObject db = GlobalVariables.GetConnection(); if (propertyID > 0) { DataTable dt = db.Connection.UpdateCommand("core.LeaseholderContactPreferences", colnames, PList, values, " where customerID = " + customerID.ToString() + " and unitId = " + propertyID.ToString()); } else { DataTable dt = db.Connection.UpdateCommand("core.LeaseholderContactPreferences", colnames, PList, values, " where customerID = " + customerID.ToString()); } }
//updates mian user account contact preferences public static void UpdateUserAccountPreferences(Models.AccountDetails Account, int customerID) { List <string> colnames = new List <string>(); colnames.Add("Address_1"); colnames.Add("Address_2"); colnames.Add("Address_3"); colnames.Add("Address_4"); colnames.Add("Address_5"); colnames.Add("Email_1"); colnames.Add("ContactNumber_1"); colnames.Add("emailonly"); colnames.Add("postonly"); colnames.Add("postandemail"); List <string> PList = new List <string>(); PList.Add("@Address_1"); PList.Add("@Address_2"); PList.Add("@Address_3"); PList.Add("@Address_4"); PList.Add("@Address_5"); PList.Add("@email_1"); PList.Add("@ContactNumber_1"); PList.Add("@emailonly"); PList.Add("@postonly"); PList.Add("@postandemail"); List <object> values = new List <object>(); values.Add(Account.ContactAdd1); if (Account.ContactAdd2 == null) { values.Add(""); } else { values.Add(Account.ContactAdd2); } if (Account.ContactAdd3 == null) { values.Add(""); } else { values.Add(Account.ContactAdd3); } if (Account.ContactAdd4 == null) { values.Add(""); } else { values.Add(Account.ContactAdd4); } values.Add(Account.ContactAdd5); if (Account.Email == null) { values.Add(""); } else { values.Add(Account.Email); } if (Account.phoneNumber == null) { values.Add(""); } else { values.Add(Account.phoneNumber); } values.Add(Account.EmailOnly); values.Add(Account.PostOnly); values.Add(Account.PostAndEmail); DBConnectionObject db = GlobalVariables.GetConnection(); DataTable dt = db.Connection.UpdateCommand("core.Leaseholders", colnames, PList, values, " where ID = " + customerID.ToString()); }