protected void btnSave_Click(object sender, EventArgs e)
        {
            String Street1 = txtStreet1.Text;
            String Street2 = txtStreet2.Text;
            String City = txtCity.Text;
            String State = txtState.Text;
            String Zip = txtZip.Text;
            int AddressTypeID = Convert.ToInt32(ddlAddressTypeID.Text);

            //bool DoNotText;
            //bool DoNotCall;
            // int PhoneID = Convert.ToInt32(txtPhID.Text);
            int AddressID;

            DataManager.DataAccess da = new DataManager.DataAccess();
            switch (Request.QueryString["Mode"])
            {
                case "Edit":

                    this.txtAID.Text = Request.QueryString["AddressID"];
                    txtAID.Enabled = true;
                    AddressID = Convert.ToInt32(txtAID.Text);
                    Street1 = txtStreet1.Text;
                    Street2 = txtStreet2.Text;
                    City = txtCity.Text;
                    State = txtState.Text;
                    Zip = txtZip.Text;
                    AddressTypeID = Convert.ToInt32(ddlAddressTypeID.Text);
                    int CompanyID = Convert.ToInt32(txtID.Text);
                    String Description = txtDescription.Text;
                    String Notes = txtNotes.Text;

                    // da.UpdateAddress(AddressID, Street1, Street2, City, State, Zip); //UpdatePhone(int PhoneID, int AreaCode, int PhoneNumber, String Extension, int PhoneTypeID)
                    //da.UpdatePersonAddress(PersonID, AddressID, AddressTypeID, Description, Notes);
                    da.UpdateAddress(AddressID, Street1, Street2, City, State, Zip); //UpdatePhone(int PhoneID, int AreaCode, int PhoneNumber, String Extension, int PhoneTypeID)
                    da.UpdateCompanyAddresses(CompanyID, AddressID, AddressTypeID, Description, Notes);
                    Response.Redirect("EditCompany.aspx?Mode=Edit&CompanyID=" + this.txtID.Text);

                    btnDone.Enabled = true;

                    btnDone.Visible = false;

                    // Response.Redirect("EditPerson.aspx?Mode=Edit&PersonID=" + this.txtID.Text);

                    break;

                case "New":

                    Street1 = txtStreet1.Text;
                    Street2 = txtStreet2.Text;
                    City = txtCity.Text;
                    State = txtState.Text;
                    Zip = txtZip.Text;
                   // AddressTypeID = Convert.ToInt32(ddlAddressTypeID.SelectedValue);

                    //PersonID = Convert.ToInt32(txtID.Text);
                    // PhoneID = Convert.ToInt32(txtPhID.Text);

                    Description = txtDescription.Text;
                    Notes = txtNotes.Text;

                    CompanyID = Convert.ToInt32(txtID.Text);

                    object oAddressID = da.InsertAddress(Street1, Street2, City, State, Zip);
                    txtAID.Text = oAddressID.ToString();

                    AddressID = Convert.ToInt32(oAddressID.ToString());

                    //da.InsertPhoneNumber(AreaCode, PhoneNumber, Extension, PhoneTypeID);
                    //txtPhID.Text = phoneNumberID.ToString();
                    //AddressID = Convert.ToInt32(txtAID.Text.ToString());
                    // txtNotes.Text = PhoneID.ToString();
                    da.InsertCompanyAddress(CompanyID, AddressID, Description, Notes);

                    // I need to send the PersonID and the PhoneID to the Edit Page

                    Response.Redirect("EditCompany.aspx?Mode=Edit&CompanyID=" + this.txtID.Text);
                    //           Response.Redirect("EditPersonPhoneNumber.aspx?PersonID=" +
                    //this.txtID.Text + "&Mode=Edit&PhoneID=" + this.txtPhID.Text);

                    break;

            }
        }
示例#2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            String Street1       = txtStreet1.Text;
            String Street2       = txtStreet2.Text;
            String City          = txtCity.Text;
            String State         = txtState.Text;
            String Zip           = txtZip.Text;
            int    AddressTypeID = Convert.ToInt32(ddlAddressTypeID.Text);

            //bool DoNotText;
            //bool DoNotCall;
            // int PhoneID = Convert.ToInt32(txtPhID.Text);
            int AddressID;

            DataManager.DataAccess da = new DataManager.DataAccess();
            switch (Request.QueryString["Mode"])
            {
            case "Edit":

                this.txtAID.Text = Request.QueryString["AddressID"];
                txtAID.Enabled   = true;
                AddressID        = Convert.ToInt32(txtAID.Text);
                Street1          = txtStreet1.Text;
                Street2          = txtStreet2.Text;
                City             = txtCity.Text;
                State            = txtState.Text;
                Zip           = txtZip.Text;
                AddressTypeID = Convert.ToInt32(ddlAddressTypeID.Text);
                int    CompanyID   = Convert.ToInt32(txtID.Text);
                String Description = txtDescription.Text;
                String Notes       = txtNotes.Text;


                // da.UpdateAddress(AddressID, Street1, Street2, City, State, Zip); //UpdatePhone(int PhoneID, int AreaCode, int PhoneNumber, String Extension, int PhoneTypeID)
                //da.UpdatePersonAddress(PersonID, AddressID, AddressTypeID, Description, Notes);
                da.UpdateAddress(AddressID, Street1, Street2, City, State, Zip);     //UpdatePhone(int PhoneID, int AreaCode, int PhoneNumber, String Extension, int PhoneTypeID)
                da.UpdateCompanyAddresses(CompanyID, AddressID, AddressTypeID, Description, Notes);
                Response.Redirect("EditCompany.aspx?Mode=Edit&CompanyID=" + this.txtID.Text);

                btnDone.Enabled = true;

                btnDone.Visible = false;



                // Response.Redirect("EditPerson.aspx?Mode=Edit&PersonID=" + this.txtID.Text);

                break;


            case "New":

                Street1 = txtStreet1.Text;
                Street2 = txtStreet2.Text;
                City    = txtCity.Text;
                State   = txtState.Text;
                Zip     = txtZip.Text;
                // AddressTypeID = Convert.ToInt32(ddlAddressTypeID.SelectedValue);

                //PersonID = Convert.ToInt32(txtID.Text);
                // PhoneID = Convert.ToInt32(txtPhID.Text);

                Description = txtDescription.Text;
                Notes       = txtNotes.Text;



                CompanyID = Convert.ToInt32(txtID.Text);

                object oAddressID = da.InsertAddress(Street1, Street2, City, State, Zip);
                txtAID.Text = oAddressID.ToString();

                AddressID = Convert.ToInt32(oAddressID.ToString());


                //da.InsertPhoneNumber(AreaCode, PhoneNumber, Extension, PhoneTypeID);
                //txtPhID.Text = phoneNumberID.ToString();
                //AddressID = Convert.ToInt32(txtAID.Text.ToString());
                // txtNotes.Text = PhoneID.ToString();
                da.InsertCompanyAddress(CompanyID, AddressID, Description, Notes);

                // I need to send the PersonID and the PhoneID to the Edit Page

                Response.Redirect("EditCompany.aspx?Mode=Edit&CompanyID=" + this.txtID.Text);
                //           Response.Redirect("EditPersonPhoneNumber.aspx?PersonID=" +
                //this.txtID.Text + "&Mode=Edit&PhoneID=" + this.txtPhID.Text);

                break;
            }
        }