public static void UpdateStewardshipInfo(OrganizationInfo objOrg, ContactInfo objPrimaryContact, Phones objPrimaryContactBusinessPhone, Phones objPrimaryContactCellPhone, ContactInfo objBillingContact, Phones objBillingContactBusinessPhone, Phones objBillingContactCellPhone, Organization_Address objBusinessOrganization_Address, Organization_Address objMailingOrganization_Address) { try { using (DbManager DB = DbManager.GetDbManager()) { List<SqlParameter> prm = new List<SqlParameter>(); #region Organization Info if (objOrg.OrganizationId > 0) prm.Add(DB.MakeInParam("@OrganizationId", SqlDbType.Int, 4, objOrg.OrganizationId)); else prm.Add(DB.MakeInParam("@OrganizationId", SqlDbType.Int, 4, DBNull.Value)); prm.Add(DB.MakeInParam("@LegalName", SqlDbType.NVarChar, 255, objOrg.LegalName)); prm.Add(DB.MakeInParam("@DBAName", SqlDbType.NVarChar, 255, objOrg.DBAName)); // prm.Add(DB.MakeInParam("@OrganizationTypeId", SqlDbType.Int, 4, objOrg.OrganizationTypeId)); prm.Add(DB.MakeInParam("@Website", SqlDbType.NVarChar, 255, objOrg.Website)); prm.Add(DB.MakeInParam("@OrgIsActive", SqlDbType.Bit, 1, objOrg.IsActive)); //prm.Add(DB.MakeInParam("@AcceptTextMessage", SqlDbType.Bit, 1, objOrg.AcceptTextMessages)); //prm.Add(DB.MakeInParam("@CellAcceptTextMessages", SqlDbType.Bit, 1, objOrg.CellAcceptTextMessages)); prm.Add(DB.MakeInParam("@OrgLanguageId", SqlDbType.Int, 4, objOrg.LanguageId)); // prm.Add(DB.MakeInParam("@RoleId", SqlDbType.Int, 4, objOrg.RoleId)); #endregion #region Primary Contact Info // prm.Add(DB.MakeInParam("@PrimaryContactTypeId", SqlDbType.Int, 4, objPrimaryContact.ContactTypeId)); prm.Add(DB.MakeInParam("@PrimaryContactFirstName", SqlDbType.NVarChar, 255, objPrimaryContact.FirstName)); prm.Add(DB.MakeInParam("@PrimaryContactLastName", SqlDbType.NVarChar, 255, objPrimaryContact.LastName)); // prm.Add(DB.MakeInParam("@PrimaryContactTitleId", SqlDbType.Int, 4, objPrimaryContact.ContactTitleId)); prm.Add(DB.MakeInParam("@PrimaryContactEmail", SqlDbType.NVarChar, 200, objPrimaryContact.Email)); prm.Add(DB.MakeInParam("@PrimaryContactIsActive", SqlDbType.Bit, 1, objPrimaryContact.IsActive)); prm.Add(DB.MakeInParam("@PrimaryContactIsPrimary", SqlDbType.Bit, 1, objPrimaryContact.IsPrimary)); // prm.Add(DB.MakeInParam("@PrimaryContactLanguageId", SqlDbType.Int, 4, objPrimaryContact.LanguageId)); #endregion #region Primary Contact Business Phone Info prm.Add(DB.MakeInParam("@PrimaryContactBusinessPhoneNumber", SqlDbType.NVarChar, 15, objPrimaryContactBusinessPhone.Number)); prm.Add(DB.MakeInParam("@PrimaryContactBusinessPhoneExtension", SqlDbType.NVarChar, 7, objPrimaryContactBusinessPhone.Extension)); // prm.Add(DB.MakeInParam("@PrimaryContactBusinessPhoneTypeId", SqlDbType.Int, 4, objPrimaryContactBusinessPhone.PhoneTypeId)); prm.Add(DB.MakeInParam("@PrimaryContactBusinessPhoneIsActive", SqlDbType.Bit, 1, objPrimaryContactBusinessPhone.IsActive)); #endregion //#region Primary Contact Cell Phone Info //prm.Add(DB.MakeInParam("@PrimaryContactCellPhoneNumber", SqlDbType.NVarChar, 15, objPrimaryContactCellPhone.Number)); //prm.Add(DB.MakeInParam("@PrimaryContactCellPhoneIsAcceptTextMessages", SqlDbType.Bit, 1, objPrimaryContactCellPhone.IsAcceptTextMessages)); //prm.Add(DB.MakeInParam("@PrimaryContactCellPhoneTypeId", SqlDbType.Int, 4, objPrimaryContactCellPhone.PhoneTypeId)); //prm.Add(DB.MakeInParam("@PrimaryContactCellPhoneIsActive", SqlDbType.Bit, 1, objPrimaryContactCellPhone.IsActive)); //#endregion //#region Billing Contact Info //prm.Add(DB.MakeInParam("@BillingContactTypeId", SqlDbType.Int, 4, objBillingContact.ContactTypeId)); //prm.Add(DB.MakeInParam("@BillingContactFirstName", SqlDbType.NVarChar, 255, objBillingContact.FirstName)); //prm.Add(DB.MakeInParam("@BillingContactLastName", SqlDbType.NVarChar, 255, objBillingContact.LastName)); //prm.Add(DB.MakeInParam("@BillingContactTitleId", SqlDbType.Int, 4, objBillingContact.ContactTitleId)); //prm.Add(DB.MakeInParam("@BillingContactEmail", SqlDbType.NVarChar, 200, objBillingContact.Email)); //prm.Add(DB.MakeInParam("@BillingContactIsActive", SqlDbType.Bit, 1, objBillingContact.IsActive)); //prm.Add(DB.MakeInParam("@BillingContactIsPrimary", SqlDbType.Bit, 1, objBillingContact.IsPrimary)); //prm.Add(DB.MakeInParam("@BillingContactLanguageId", SqlDbType.Int, 4, objBillingContact.LanguageId)); //#endregion //#region Billing Contact Business Phone Info //prm.Add(DB.MakeInParam("@BillingContactBusinessPhoneNumber", SqlDbType.NVarChar, 15, objBillingContactBusinessPhone.Number)); //prm.Add(DB.MakeInParam("@BillingContactBusinessPhoneExtension", SqlDbType.NVarChar, 7, objBillingContactBusinessPhone.Extension)); //prm.Add(DB.MakeInParam("@BillingContactBusinessPhoneTypeId", SqlDbType.Int, 4, objBillingContactBusinessPhone.PhoneTypeId)); //prm.Add(DB.MakeInParam("@BillingContactBusinessPhoneIsActive", SqlDbType.Bit, 1, objBillingContactBusinessPhone.IsActive)); //#endregion //#region Billing Contact Cell Phone Info //prm.Add(DB.MakeInParam("@BillingContactCellPhoneNumber", SqlDbType.NVarChar, 15, objBillingContactCellPhone.Number)); //prm.Add(DB.MakeInParam("@BillingContactCellPhoneIsAcceptTextMessages", SqlDbType.Bit, 1, objBillingContactCellPhone.IsAcceptTextMessages)); //prm.Add(DB.MakeInParam("@BillingContactCellPhoneTypeId", SqlDbType.Int, 4, objBillingContactCellPhone.PhoneTypeId)); //prm.Add(DB.MakeInParam("@BillingContactCellPhoneIsActive", SqlDbType.Bit, 1, objBillingContactCellPhone.IsActive)); //#endregion #region Business Organization Address Info prm.Add(DB.MakeInParam("@BusinessOrganization_AddressZipCodeId", SqlDbType.Int, 4, objBusinessOrganization_Address.ZipCodeID)); prm.Add(DB.MakeInParam("@BusinessOrganization_AddressZipCode", SqlDbType.NVarChar, 100, objBusinessOrganization_Address.ZipPostalCode)); prm.Add(DB.MakeInParam("@BusinessOrganizationAddress1", SqlDbType.NVarChar, 250, objBusinessOrganization_Address.Address1)); prm.Add(DB.MakeInParam("@BusinessOrganizationAddress2", SqlDbType.NVarChar, 250, objBusinessOrganization_Address.Address2)); prm.Add(DB.MakeInParam("@BusinessOrganization_AddressCity", SqlDbType.NVarChar, 100, objBusinessOrganization_Address.City)); prm.Add(DB.MakeInParam("@BusinessOrganization_AddressStateId", SqlDbType.Int, 4, objBusinessOrganization_Address.StateID)); prm.Add(DB.MakeInParam("@BusinessOrganization_AddressCountryID", SqlDbType.Int, 4, objBusinessOrganization_Address.CountryID)); prm.Add(DB.MakeInParam("@BusinessOrganization_AddressIsActive", SqlDbType.Bit, 1, objBusinessOrganization_Address.IsActive)); prm.Add(DB.MakeInParam("@BusinessOrganization_AddressDateCreated", SqlDbType.DateTime, 8, objBusinessOrganization_Address.DateCreated)); prm.Add(DB.MakeInParam("@BusinessOrganization_AddressTypeId", SqlDbType.Int, 4, objBusinessOrganization_Address.Organization_AddressTypeId)); #endregion //#region Mailing Organization Address Info //prm.Add(DB.MakeInParam("@MailingOrganization_AddressZipCodeId", SqlDbType.Int, 4, objMailingOrganization_Address.ZipCodeID)); //prm.Add(DB.MakeInParam("@MailingOrganization_AddressZipCode", SqlDbType.NVarChar, 100, objMailingOrganization_Address.ZipPostalCode)); //prm.Add(DB.MakeInParam("@MailingOrganizationAddress1", SqlDbType.NVarChar, 250, objMailingOrganization_Address.Address1)); //prm.Add(DB.MakeInParam("@MailingOrganizationAddress2", SqlDbType.NVarChar, 250, objMailingOrganization_Address.Address2)); //prm.Add(DB.MakeInParam("@MailingOrganization_AddressCity", SqlDbType.NVarChar, 100, objMailingOrganization_Address.City)); //prm.Add(DB.MakeInParam("@MailingOrganization_AddressStateId", SqlDbType.Int, 4, objMailingOrganization_Address.StateID)); //prm.Add(DB.MakeInParam("@MailingOrganization_AddressCountryID", SqlDbType.Int, 4, objMailingOrganization_Address.CountryID)); //prm.Add(DB.MakeInParam("@MailingOrganization_AddressIsActive", SqlDbType.Bit, 1, objMailingOrganization_Address.IsActive)); //prm.Add(DB.MakeInParam("@MailingOrganization_AddressDateCreated", SqlDbType.DateTime, 8, objMailingOrganization_Address.DateCreated)); //prm.Add(DB.MakeInParam("@MailingOrganization_AddressTypeId", SqlDbType.Int, 4, objMailingOrganization_Address.Organization_AddressTypeId)); //#endregion objOrg.OrganizationId = DB.RunProc("up_updateStewardshipByOrgId", prm.ToArray()); } } catch (Exception ex) { new SqlLog().InsertSqlLog(0, "OrganizationInfo.UpdateStewardshipInfo", ex); } }
public static void SavePrimaryInfo(OrganizationInfo objOrg, ContactInfo objPrimaryContact, Phones objPrimaryContactBusinessPhone, Phones objPrimaryContactCellPhone, ContactInfo objBillingContact, Phones objBillingContactBusinessPhone, Phones objBillingContactCellPhone, Organization_Address objBusinessOrganization_Address, Organization_Address objMailingOrganization_Address, string catIds) { try { using (DbManager DB = DbManager.GetDbManager()) { List<SqlParameter> prm = new List<SqlParameter>(); #region Organization Info if (objOrg.OrganizationId > 0) prm.Add(DB.MakeInParam("@OrganizationId", SqlDbType.Int, 4, objOrg.OrganizationId)); else prm.Add(DB.MakeInParam("@OrganizationId", SqlDbType.Int, 4, DBNull.Value)); prm.Add(DB.MakeInParam("@LegalName", SqlDbType.NVarChar, 255, objOrg.LegalName)); prm.Add(DB.MakeInParam("@DBAName", SqlDbType.NVarChar, 255, objOrg.DBAName)); prm.Add(DB.MakeInParam("@OrganizationTypeId", SqlDbType.Int, 4, objOrg.OrganizationTypeId)); prm.Add(DB.MakeInParam("@OrganizationSubTypeId", SqlDbType.Int, 0, objOrg.OrganizationSubTypeID)); prm.Add(DB.MakeInParam("@Website", SqlDbType.NVarChar, 255, objOrg.Website)); prm.Add(DB.MakeInParam("@AccountingInterfaceId", SqlDbType.Int, 4, objOrg.AccountingInterfaceId)); prm.Add(DB.MakeInParam("@InventoryInterfaceId", SqlDbType.Int, 4, objOrg.InventoryInterfaceId)); prm.Add(DB.MakeInParam("@IsAutoFundTransfer", SqlDbType.Bit, 1, objOrg.IsAutoFundTransfer)); prm.Add(DB.MakeInParam("@OrgIsActive", SqlDbType.Bit, 1, objOrg.IsActive)); prm.Add(DB.MakeInParam("@OrgLanguageId", SqlDbType.Int, 4, objOrg.LanguageId)); prm.Add(DB.MakeInParam("@RoleId", SqlDbType.Int, 4, objOrg.RoleId)); #endregion #region Primary Contact Info prm.Add(DB.MakeInParam("@PrimaryContactTypeId", SqlDbType.Int, 4, objPrimaryContact.ContactTypeId)); prm.Add(DB.MakeInParam("@PrimaryContactFirstName", SqlDbType.NVarChar, 255, objPrimaryContact.FirstName)); prm.Add(DB.MakeInParam("@PrimaryContactLastName", SqlDbType.NVarChar, 255, objPrimaryContact.LastName)); prm.Add(DB.MakeInParam("@PrimaryContactTitleId", SqlDbType.Int, 4, objPrimaryContact.ContactTitleId)); prm.Add(DB.MakeInParam("@PrimaryContactEmail", SqlDbType.NVarChar, 200, objPrimaryContact.Email)); prm.Add(DB.MakeInParam("@PrimaryContactIsActive", SqlDbType.Bit, 1, objPrimaryContact.IsActive)); prm.Add(DB.MakeInParam("@PrimaryContactIsPrimary", SqlDbType.Bit, 1, objPrimaryContact.IsPrimary)); prm.Add(DB.MakeInParam("@PrimaryContactLanguageId", SqlDbType.Int, 4, objPrimaryContact.LanguageId)); #endregion #region Primary Contact Business Phone Info prm.Add(DB.MakeInParam("@PrimaryContactBusinessPhoneNumber", SqlDbType.NVarChar, 15, objPrimaryContactBusinessPhone.Number)); prm.Add(DB.MakeInParam("@PrimaryContactBusinessPhoneExtension", SqlDbType.NVarChar, 7, objPrimaryContactBusinessPhone.Extension)); prm.Add(DB.MakeInParam("@PrimaryContactBusinessPhoneTypeId", SqlDbType.Int, 4, objPrimaryContactBusinessPhone.PhoneTypeId)); prm.Add(DB.MakeInParam("@PrimaryContactBusinessPhoneIsActive", SqlDbType.Bit, 1, objPrimaryContactBusinessPhone.IsActive)); #endregion #region Primary Contact Cell Phone Info prm.Add(DB.MakeInParam("@PrimaryContactCellPhoneNumber", SqlDbType.NVarChar, 15, objPrimaryContactCellPhone.Number)); prm.Add(DB.MakeInParam("@PrimaryContactCellPhoneIsAcceptTextMessages", SqlDbType.Bit, 1, objPrimaryContactCellPhone.IsAcceptTextMessages)); prm.Add(DB.MakeInParam("@PrimaryContactCellPhoneTypeId", SqlDbType.Int, 4, objPrimaryContactCellPhone.PhoneTypeId)); prm.Add(DB.MakeInParam("@PrimaryContactCellPhoneIsActive", SqlDbType.Bit, 1, objPrimaryContactCellPhone.IsActive)); #endregion #region Billing Contact Info prm.Add(DB.MakeInParam("@BillingContactTypeId", SqlDbType.Int, 4, objBillingContact.ContactTypeId)); prm.Add(DB.MakeInParam("@BillingContactFirstName", SqlDbType.NVarChar, 255, objBillingContact.FirstName)); prm.Add(DB.MakeInParam("@BillingContactLastName", SqlDbType.NVarChar, 255, objBillingContact.LastName)); prm.Add(DB.MakeInParam("@BillingContactTitleId", SqlDbType.Int, 4, objBillingContact.ContactTitleId)); prm.Add(DB.MakeInParam("@BillingContactEmail", SqlDbType.NVarChar, 200, objBillingContact.Email)); prm.Add(DB.MakeInParam("@BillingContactIsActive", SqlDbType.Bit, 1, objBillingContact.IsActive)); prm.Add(DB.MakeInParam("@BillingContactIsPrimary", SqlDbType.Bit, 1, objBillingContact.IsPrimary)); prm.Add(DB.MakeInParam("@BillingContactLanguageId", SqlDbType.Int, 4, objBillingContact.LanguageId)); #endregion #region Billing Contact Business Phone Info prm.Add(DB.MakeInParam("@BillingContactBusinessPhoneNumber", SqlDbType.NVarChar, 15, objBillingContactBusinessPhone.Number)); prm.Add(DB.MakeInParam("@BillingContactBusinessPhoneExtension", SqlDbType.NVarChar, 7, objBillingContactBusinessPhone.Extension)); prm.Add(DB.MakeInParam("@BillingContactBusinessPhoneTypeId", SqlDbType.Int, 4, objBillingContactBusinessPhone.PhoneTypeId)); prm.Add(DB.MakeInParam("@BillingContactBusinessPhoneIsActive", SqlDbType.Bit, 1, objBillingContactBusinessPhone.IsActive)); #endregion #region Billing Contact Cell Phone Info prm.Add(DB.MakeInParam("@BillingContactCellPhoneNumber", SqlDbType.NVarChar, 15, objBillingContactCellPhone.Number)); prm.Add(DB.MakeInParam("@BillingContactCellPhoneIsAcceptTextMessages", SqlDbType.Bit, 1, objBillingContactCellPhone.IsAcceptTextMessages)); prm.Add(DB.MakeInParam("@BillingContactCellPhoneTypeId", SqlDbType.Int, 4, objBillingContactCellPhone.PhoneTypeId)); prm.Add(DB.MakeInParam("@BillingContactCellPhoneIsActive", SqlDbType.Bit, 1, objBillingContactCellPhone.IsActive)); #endregion #region Business Organization Address Info prm.Add(DB.MakeInParam("@BusinessOrganization_AddressZipCodeId", SqlDbType.Int, 4, objBusinessOrganization_Address.ZipCodeID)); prm.Add(DB.MakeInParam("@BusinessOrganization_AddressZipCode", SqlDbType.NVarChar, 100, objBusinessOrganization_Address.ZipPostalCode)); prm.Add(DB.MakeInParam("@BusinessOrganizationAddress1", SqlDbType.NVarChar, 250, objBusinessOrganization_Address.Address1)); prm.Add(DB.MakeInParam("@BusinessOrganizationAddress2", SqlDbType.NVarChar, 250, objBusinessOrganization_Address.Address2)); prm.Add(DB.MakeInParam("@BusinessOrganization_AddressCity", SqlDbType.NVarChar, 100, objBusinessOrganization_Address.City)); prm.Add(DB.MakeInParam("@BusinessOrganization_AddressStateId", SqlDbType.Int, 4, objBusinessOrganization_Address.StateID)); prm.Add(DB.MakeInParam("@BusinessOrganization_AddressCountryID", SqlDbType.Int, 4, objBusinessOrganization_Address.CountryID)); prm.Add(DB.MakeInParam("@BusinessOrganization_CityId", SqlDbType.BigInt, 10, objBusinessOrganization_Address.CityId)); prm.Add(DB.MakeInParam("@BusinessOrganization_AddressIsActive", SqlDbType.Bit, 1, objBusinessOrganization_Address.IsActive)); prm.Add(DB.MakeInParam("@BusinessOrganization_AddressDateCreated", SqlDbType.DateTime, 8, objBusinessOrganization_Address.DateCreated)); prm.Add(DB.MakeInParam("@BusinessOrganization_AddressTypeId", SqlDbType.Int, 4, objBusinessOrganization_Address.Organization_AddressTypeId)); #endregion #region Mailing Organization Address Info prm.Add(DB.MakeInParam("@MailingOrganization_AddressZipCodeId", SqlDbType.Int, 4, objMailingOrganization_Address.ZipCodeID)); prm.Add(DB.MakeInParam("@MailingOrganization_AddressZipCode", SqlDbType.NVarChar, 100, objMailingOrganization_Address.ZipPostalCode)); prm.Add(DB.MakeInParam("@MailingOrganizationAddress1", SqlDbType.NVarChar, 250, objMailingOrganization_Address.Address1)); prm.Add(DB.MakeInParam("@MailingOrganizationAddress2", SqlDbType.NVarChar, 250, objMailingOrganization_Address.Address2)); prm.Add(DB.MakeInParam("@MailingOrganization_AddressCity", SqlDbType.NVarChar, 100, objMailingOrganization_Address.City)); prm.Add(DB.MakeInParam("@MailingOrganization_CityId", SqlDbType.BigInt, 10, objMailingOrganization_Address.CityId)); prm.Add(DB.MakeInParam("@MailingOrganization_AddressStateId", SqlDbType.Int, 4, objMailingOrganization_Address.StateID)); prm.Add(DB.MakeInParam("@MailingOrganization_AddressCountryID", SqlDbType.Int, 4, objMailingOrganization_Address.CountryID)); prm.Add(DB.MakeInParam("@MailingOrganization_AddressIsActive", SqlDbType.Bit, 1, objMailingOrganization_Address.IsActive)); prm.Add(DB.MakeInParam("@MailingOrganization_AddressDateCreated", SqlDbType.DateTime, 8, objMailingOrganization_Address.DateCreated)); prm.Add(DB.MakeInParam("@MailingOrganization_AddressTypeId", SqlDbType.Int, 4, objMailingOrganization_Address.Organization_AddressTypeId)); #endregion //For making application generalized prm.Add(DB.MakeInParam("@CategoryIds", SqlDbType.VarChar, 50, catIds)); objOrg.OrganizationId = DB.RunProc("up_OrganizationInsertUpdatePrimaryInfo", prm.ToArray()); } } catch (Exception ex) { new SqlLog().InsertSqlLog(0, "OrganizationInfo.SaveBasicInfo", ex); } }