示例#1
0
    protected void ButtonReset_Click(object sender, EventArgs e)
    {
        ViewState["KomposisiProduk"] = new List <StokBahanBaku_Model>();
        ViewState["BiayaProduksi"]   = new List <JenisBiayaProduksi_Model>();

        LoadKomposisiProduk(new List <StokBahanBaku_Model>(), new List <JenisBiayaProduksi_Model>());
        LoadBiayaProduksi(new List <StokBahanBaku_Model>(), new List <JenisBiayaProduksi_Model>());

        DropDownListCariProduk.SelectedValue = "0";
        TextBoxNamaProduk.Text    = string.Empty;
        TextBoxNamaProduk.Enabled = true;

        DropDownListBrand.SelectedValue = "0";
        TextBoxBrand.Text    = string.Empty;
        TextBoxBrand.Enabled = true;

        DropDownListWarna.SelectedValue = "0";
        TextBoxWarna.Text    = string.Empty;
        TextBoxWarna.Enabled = true;

        DropDownListVarian.SelectedValue = "-1";
        TextBoxVarian.Text    = string.Empty;
        TextBoxVarian.Enabled = true;

        TextBoxKode.Text = string.Empty;

        CheckBoxListKategori.ClearSelection();

        TextBoxHargaPokokProduksi.Text = string.Empty;
        TextBoxHargaJual.Text          = string.Empty;

        CollapseBiayaProduksi.Attributes.Add("class", "collapse");
        CollapseKomposisiProduk.Attributes.Add("class", "collapse");
    }
示例#2
0
    protected void DropDownListCariProduk_SelectedIndexChanged(object sender, EventArgs e)
    {
        using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext())
        {
            if (DropDownListCariProduk.SelectedValue != "0")
            {
                var produk = db.TBProduks.FirstOrDefault(item => item.IDProduk == Parse.Int(DropDownListCariProduk.SelectedValue));

                TextBoxNamaProduk.Text    = produk.Nama;
                TextBoxNamaProduk.Enabled = false;

                DropDownListBrand.SelectedValue = produk.IDPemilikProduk.ToString();
                TextBoxBrand.Enabled            = false;
                TextBoxBrand.Text = DropDownListBrand.SelectedItem.Text;

                DropDownListWarna.SelectedValue = produk.IDWarna.ToString();
                TextBoxWarna.Enabled            = false;
                TextBoxWarna.Text = DropDownListWarna.SelectedItem.Text;

                foreach (var item in produk.TBRelasiProdukKategoriProduks)
                {
                    CheckBoxListKategori.Items.FindByValue(item.IDKategoriProduk.ToString()).Selected = true;
                }
            }
            else
            {
                DropDownListCariProduk.SelectedValue = "0";
                TextBoxNamaProduk.Text    = string.Empty;
                TextBoxNamaProduk.Enabled = true;

                DropDownListBrand.SelectedValue = "0";
                TextBoxBrand.Text    = string.Empty;
                TextBoxBrand.Enabled = true;

                DropDownListWarna.SelectedValue = "0";
                TextBoxWarna.Text    = string.Empty;
                TextBoxWarna.Enabled = true;

                DropDownListVarian.SelectedValue = "-1";
                TextBoxVarian.Text    = string.Empty;
                TextBoxVarian.Enabled = true;

                TextBoxKode.Text = string.Empty;

                CheckBoxListKategori.ClearSelection();

                TextBoxHargaJual.Text = string.Empty;
            }
        }

        CollapseBiayaProduksi.Attributes.Add("class", "collapse");
        CollapseKomposisiProduk.Attributes.Add("class", "collapse");
    }