Esempio n. 1
0
    protected void ButtonSimpan_Click(object sender, EventArgs e)
    {
        using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext())
        {
            Tempat_Class ClassTempat = new Tempat_Class(db);

            if (ButtonSimpan.Text == "Tambah")
            {
                ClassTempat.Tambah(
                    IDKategoriTempat: DropDownListKategoriTempat.SelectedValue.ToInt(),
                    Kode: TextBoxKode.Text,
                    Nama: TextBoxNama.Text,
                    Alamat: TextBoxAlamat.Text,
                    Email: TextBoxEmail.Text,
                    Telepon1: TextBoxTelepon1.Text,
                    Telepon2: TextBoxTelepon2.Text,
                    KeteranganBiayaTambahan1: TextBoxKeteranganBiayaTambahan1.Text,
                    BiayaTambahan1: TextBoxBiayaTambahan1.Text.ToDecimal(),
                    KeteranganBiayaTambahan2: TextBoxKeteranganBiayaTambahan2.Text,
                    BiayaTambahan2: TextBoxBiayaTambahan2.Text.ToDecimal(),
                    KeteranganBiayaTambahan3: TextBoxKeteranganBiayaTambahan3.Text,
                    BiayaTambahan3: TextBoxBiayaTambahan3.Text.ToDecimal(),
                    KeteranganBiayaTambahan4: TextBoxKeteranganBiayaTambahan4.Text,
                    BiayaTambahan4: TextBoxBiayaTambahan4.Text.ToDecimal(),
                    Latitude: TextBoxLatitude.Text,
                    Longitude: TextBoxLongitude.Text,
                    FooterPrint: TextBoxFooterPrint.Text,
                    _IsActive: true
                    );
            }
            else if (ButtonSimpan.Text == "Ubah")
            {
                ClassTempat.Ubah(
                    IDTempat: Request.QueryString["id"].ToInt(),
                    IDKategoriTempat: DropDownListKategoriTempat.SelectedValue.ToInt(),
                    Kode: TextBoxKode.Text,
                    Nama: TextBoxNama.Text,
                    Alamat: TextBoxAlamat.Text,
                    Email: TextBoxEmail.Text,
                    Telepon1: TextBoxTelepon1.Text,
                    Telepon2: TextBoxTelepon2.Text,
                    KeteranganBiayaTambahan1: TextBoxKeteranganBiayaTambahan1.Text,
                    BiayaTambahan1: TextBoxBiayaTambahan1.Text.ToDecimal(),
                    KeteranganBiayaTambahan2: TextBoxKeteranganBiayaTambahan2.Text,
                    BiayaTambahan2: TextBoxBiayaTambahan2.Text.ToDecimal(),
                    KeteranganBiayaTambahan3: TextBoxKeteranganBiayaTambahan3.Text,
                    BiayaTambahan3: TextBoxBiayaTambahan3.Text.ToDecimal(),
                    KeteranganBiayaTambahan4: TextBoxKeteranganBiayaTambahan4.Text,
                    BiayaTambahan4: TextBoxBiayaTambahan4.Text.ToDecimal(),
                    Latitude: TextBoxLatitude.Text,
                    Longitude: TextBoxLongitude.Text,
                    FooterPrint: TextBoxFooterPrint.Text
                    );
            }

            db.SubmitChanges();

            Response.Redirect("Default.aspx");
        }
    }