protected void btnSave_Click(object sender, EventArgs e)
        {
            String Name = txtName.Text;
            String Notes = txtNotes.Text;
            DataManager.DataAccess da = new DataManager.DataAccess();
            switch (Request.QueryString["Mode"])
            {

                case "Edit":
                    txtID.Enabled = true;
                    int CompanyID = Convert.ToInt32(txtID.Text);
                    Name = txtName.Text;
                    Notes = txtNotes.Text;

                    da.UpdateCompany(CompanyID, Name, Notes);
                    Response.Redirect("EditCompany.aspx?CompanyID=" +
            this.txtID.Text + "&Mode=Edit");

                    //Response.Redirect("EditPerson.aspx?Mode=Edit");
                    btnDone.Enabled = true;
                    btnDone.Visible = true;
                    break;

                case "New":

                    Name = txtName.Text;
                    Notes = txtNotes.Text;
                    DataManager.DataAccess da2 = new DataManager.DataAccess();
                    object companyID = da2.InsertCompany2(Name, Notes);

                    txtID.Text = companyID.ToString();
                    CompanyID = Convert.ToInt32(txtID.Text);
                    txtName.Text = Name;
                    txtNotes.Text = Notes;

                    Response.Redirect("EditCompany.aspx?CompanyID=" +
              this.txtID.Text + "&Mode=Edit");
                    break;

            }
        }
Esempio n. 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            String Name  = txtName.Text;
            String Notes = txtNotes.Text;

            DataManager.DataAccess da = new DataManager.DataAccess();
            switch (Request.QueryString["Mode"])
            {
            case "Edit":
                txtID.Enabled = true;
                int CompanyID = Convert.ToInt32(txtID.Text);
                Name  = txtName.Text;
                Notes = txtNotes.Text;

                da.UpdateCompany(CompanyID, Name, Notes);
                Response.Redirect("EditCompany.aspx?CompanyID=" +
                                  this.txtID.Text + "&Mode=Edit");

                //Response.Redirect("EditPerson.aspx?Mode=Edit");
                btnDone.Enabled = true;
                btnDone.Visible = true;
                break;


            case "New":

                Name  = txtName.Text;
                Notes = txtNotes.Text;
                DataManager.DataAccess da2 = new DataManager.DataAccess();
                object companyID           = da2.InsertCompany2(Name, Notes);

                txtID.Text    = companyID.ToString();
                CompanyID     = Convert.ToInt32(txtID.Text);
                txtName.Text  = Name;
                txtNotes.Text = Notes;

                Response.Redirect("EditCompany.aspx?CompanyID=" +
                                  this.txtID.Text + "&Mode=Edit");
                break;
            }
        }