public static ContractAccount GetContractAccountSettings(string contractId, bool internally) { // ContractAccount account = new ContractAccount(); // IDataReader dr = null; // try { int customerId = -1; dr = EcommerceProvider.GetContract(contractId); // if (dr.Read()) { string propertyNames = Convert.ToString(dr["PropertyNames"]); string propertyValues = Convert.ToString(dr["PropertyValues"]); if (dr["CustomerID"] != DBNull.Value) { customerId = Convert.ToInt32(dr["CustomerID"]); } else { SecurityUtils.DeserializeGenericProfile(propertyNames, propertyValues, account); } } // if (customerId > -1) { ES.UserInfo userInfo = (internally) ? ES.UserController.GetUserInternally(customerId) : ES.UserController.GetUser(customerId); // if (internally) { account[ContractAccount.PASSWORD] = userInfo.Password; } // account[ContractAccount.USERNAME] = userInfo.Username; account[ContractAccount.FIRST_NAME] = userInfo.FirstName; account[ContractAccount.LAST_NAME] = userInfo.LastName; account[ContractAccount.EMAIL] = userInfo.Email; account[ContractAccount.COMPANY_NAME] = userInfo.CompanyName; account[ContractAccount.COUNTRY] = userInfo.Country; account[ContractAccount.CITY] = userInfo.City; account[ContractAccount.ADDRESS] = userInfo.Address; account[ContractAccount.FAX_NUMBER] = userInfo.Fax; account[ContractAccount.INSTANT_MESSENGER] = userInfo.InstantMessenger; account[ContractAccount.PHONE_NUMBER] = userInfo.PrimaryPhone; account[ContractAccount.STATE] = userInfo.State; account[ContractAccount.ZIP] = userInfo.Zip; account[ContractAccount.MAIL_FORMAT] = userInfo.HtmlMail ? "HTML" : "PlainText"; } } catch (Exception ex) { throw ex; } finally { if (dr != null) { dr.Close(); } } // return(account); }
public static Contract GetContract(string contractId) { Contract contractInfo = ES.ObjectUtils.FillObjectFromDataReader <Contract>(EcommerceProvider.GetContract(contractId)); // if (contractInfo == null) { throw new Exception("Could not find the contract specified. ContractID: " + contractId); } // return(contractInfo); }