コード例 #1
0
    protected void lnkbtnUpdate_Click(object sender, EventArgs e)
    {
        // int stateId = OrganizationInfo.getStateId(OrganizationID);
        //int  organizationIdWithSimilerEmail = OrganizationInfo.getOrganizationIdByEmail(txtPrimaryEmail.Text.Trim(), stateId);
        //if (organizationIdWithSimilerEmail > 0)
        //{
        //    lblemailalreadyexists.Text = "Email already exists for this state. Choose another";
        //    lblemailalreadyexists.Visible = true;
        //    return;
        //}
        DataTable dt      = null;
        double    stateId = OrganizationInfo.getStateId(OrganizationID);

        dt = OrganizationInfo.GetCityStateAndCountryByZipCode(txtZipCode.Text.Trim(), GlobalCountryID, stateId);

        if (dt.Rows.Count > 0)
        {
        }
        else
        {
            txtZipCode.Text = "";
            txtZipCode.Focus();
            lblBusinessZipCode.Text = "* Zipcode does not exist in this state.";
            return;
        }
        OrganizationInfo objOrg = new OrganizationInfo(OrganizationID);

        if (dddlcelltextmsgs.SelectedValue == "1")
        {
            objOrg.CellAcceptTextMessages = true;
        }
        else
        {
            objOrg.CellAcceptTextMessages = false;
        }
        if (ddlbusinesstextmsgs.SelectedValue == "1")
        {
            objOrg.AcceptTextMessages = true;
        }
        else
        {
            objOrg.AcceptTextMessages = false;
        }
        objOrg.OrganizationId = OrganizationID;
        //     objOrg.Fax = txtFax.Text.Trim();
        //       objOrg.Address = txtAddress.Text.Trim();
        //  objOrg.BusinessType = txtBusinessType.Text.Trim();
        //       objOrg.BillMailAddress = txtBillingMailAddress.Text.Trim();
        //      objOrg.BillingContact = txtBillingContact.Text.Trim();
        //       objOrg.CellExtension = txtCellPhoneExtension.Text.Trim();
        objOrg.LegalName        = txtBusinessName.Text.Trim();
        objOrg.DBAName          = txtDBAName.Text.Trim();
        objOrg.Website          = txtWebsite.Text.Trim();
        objOrg.IsActive         = true;
        objOrg.IsOrganization   = true;
        objOrg.LanguageId       = LanguageId;
        objOrg.ContactTitleName = txtContactTitle.Text.Trim();
        objOrg.RoleId           = Conversion.ParseInt(UserInfo.UserRole.Stewardship);
        objOrg.UpdateOrganizationInfo();
        ContactInfo objPrimaryContact = new ContactInfo();

        objPrimaryContact.FirstName = txtFirstName.Text.Trim();
        objPrimaryContact.LastName  = txtLastName.Text.Trim();
        objPrimaryContact.Email     = txtPrimaryEmail.Text.Trim();

        objPrimaryContact.IsActive      = true;
        objPrimaryContact.IsPrimary     = true;
        objPrimaryContact.LanguageId    = LanguageId;
        objPrimaryContact.ContactTypeId = Convert.ToInt32(LookupsManagement.LookupType.ContactTypes_Business);

        Phones objPrimaryContactBusinessPhone = new Phones();

        objPrimaryContactBusinessPhone.Number      = txtPhoneNumber.Text.Trim().ToString();
        objPrimaryContactBusinessPhone.Extension   = txtPhoneExtension.Text.Trim().ToString();
        objPrimaryContactBusinessPhone.IsActive    = true;
        objPrimaryContactBusinessPhone.PhoneTypeId = Convert.ToInt32(LookupsManagement.LookupType.PhoneType_Business);

        Phones objPrimaryContactCellPhone = new Phones();

        objPrimaryContactCellPhone.Number      = txtCellPhoneNumber.Text.Trim();
        objPrimaryContactCellPhone.IsActive    = true;
        objPrimaryContactCellPhone.PhoneTypeId = Convert.ToInt32(LookupsManagement.LookupType.PhoneType_Cell);

        ContactInfo objBillingContact = new ContactInfo();

        //      objBillingContact.Email = txtBillingMailAddress.Text.Trim();
        objBillingContact.IsActive      = true;
        objBillingContact.IsPrimary     = false;
        objBillingContact.LanguageId    = LanguageId;
        objBillingContact.ContactTypeId = Convert.ToInt32(ContactInfo.ContactTypes.Billing);
        objBillingContact.ContactTypeId = Convert.ToInt32(LookupsManagement.LookupType.ContactTypes_Billing);

        Phones objBillingContactBusinessPhone = new Phones();

        objBillingContactBusinessPhone.IsActive    = true;
        objBillingContactBusinessPhone.PhoneTypeId = Convert.ToInt32(LookupsManagement.LookupType.PhoneType_Business);

        Phones objBillingContactCellPhone = new Phones();

        objBillingContactCellPhone.IsActive    = true;
        objBillingContactCellPhone.PhoneTypeId = Convert.ToInt32(LookupsManagement.LookupType.PhoneType_Cell);

        OrganizationInfo.Organization_Address objBusinessOrganization_Address = new OrganizationInfo.Organization_Address();

        objBusinessOrganization_Address.ZipCodeID     = Convert.ToInt32(hdnBusinessZipCodeId.Value);
        objBusinessOrganization_Address.ZipPostalCode = txtZipCode.Text.Trim().ToString();
        objBusinessOrganization_Address.Address1      = txtBusinessAddress1.Text.Trim();
        objBusinessOrganization_Address.Address2      = txtBusinessAddress2.Text.Trim();
        objBusinessOrganization_Address.City          = txtCity.Text.Trim().ToString();
        objBusinessOrganization_Address.StateID       = Convert.ToInt32(ddlState.SelectedValue);
        objBusinessOrganization_Address.CountryID     = Convert.ToInt32(ddlCountry.SelectedValue);
        objBusinessOrganization_Address.DateCreated   = DateTime.Now;
        objBusinessOrganization_Address.IsActive      = true;
        objBusinessOrganization_Address.Organization_AddressTypeId = Convert.ToInt32(LookupsManagement.LookupType.OrganizationAddressType_Business);

        OrganizationInfo.Organization_Address objMailingOrganization_Address = new OrganizationInfo.Organization_Address();
        objMailingOrganization_Address.DateCreated = DateTime.Now;
        objMailingOrganization_Address.IsActive    = true;
        objMailingOrganization_Address.Organization_AddressTypeId = Convert.ToInt32(LookupsManagement.LookupType.OrganizationAddressType_Mailing);

        OrganizationInfo.UpdateStewardshipInfo(objOrg, objPrimaryContact, objPrimaryContactBusinessPhone, objPrimaryContactCellPhone, objBillingContact, objBillingContactBusinessPhone, objBillingContactCellPhone, objBusinessOrganization_Address, objMailingOrganization_Address);
        lblinfo.Visible = true;
        lblinfo.Text    = "Successfully updated";
        viewStakeholdersForApproval();
        pnlDisplay.Visible = true;
        pnlEdit.Visible    = false;
    }