Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserID"] == null || Session["SellerID"] == null)
        {
            Response.Redirect("Login.aspx");
        }
        else
        {
            LabelWelcome.Text = "欢迎经销商 " + Session["SellerName"] + " 的用户 " + Session["UserName"] + " 登录本系统!";
        }
        if (!IsPostBack)
        {
            DropDownListBrand.DataSource     = (new BLL_Brand()).SelectAll();
            DropDownListBrand.DataValueField = "BrandID";
            DropDownListBrand.DataTextField  = "BrandName";
            DropDownListBrand.DataBind();
            if (DropDownListBrand.Items.Count != 0)
            {
                DropDownListModelDataRefresh();
                if (DropDownListModel.Items.Count != 0)
                {
                    LableStockDataRefresh();
                }
            }
            DropDownListSunSeller.DataSource     = (new BLL_SellerInfo()).SelectByParentSellerID(Int32.Parse(Session["SellerID"].ToString()));
            DropDownListSunSeller.DataValueField = "SellerID";
            DropDownListSunSeller.DataTextField  = "Name";
            DropDownListSunSeller.DataBind();

            GridView1.DataSource = (new BLL_SellerOpreateLog()).SelectBySellerID(Int32.Parse(Session["SellerID"].ToString()));
            GridView1.DataBind();
        }
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext())
            {
                PenggunaLogin pengguna = (PenggunaLogin)Session["PenggunaLogin"];

                TextBoxTanggalProyeksi.Text = DateTime.Now.ToString("d MMMM yyyy");
                TextBoxTanggalTarget.Text   = DateTime.Now.ToString("d MMMM yyyy");
                TextBoxPegawai.Text         = pengguna.NamaLengkap;

                DropDownListBrand.DataSource     = db.TBPemilikProduks.OrderBy(item => item.Nama).ToArray();
                DropDownListBrand.DataTextField  = "Nama";
                DropDownListBrand.DataValueField = "IDPemilikProduk";
                DropDownListBrand.DataBind();
                DropDownListBrand.Items.Insert(0, new ListItem {
                    Text = "-All Brand-", Value = "0"
                });

                DropDownListStokProduk.DataSource = db.TBStokProduks
                                                    .Where(item =>
                                                           item.IDTempat == pengguna.IDTempat &&
                                                           item.TBKombinasiProduk.TBProduk._IsActive)
                                                    .Select(item => new
                {
                    item.IDStokProduk,
                    item.TBKombinasiProduk.Nama
                })
                                                    .OrderBy(item => item.Nama)
                                                    .ToArray();

                DropDownListStokProduk.DataTextField  = "Nama";
                DropDownListStokProduk.DataValueField = "IDStokProduk";
                DropDownListStokProduk.DataBind();

                ViewState["ViewStateListDetail"]      = new List <ProyeksiDetail_Model>();
                ViewState["ViewStateKomposisiProduk"] = new List <KomposisiProduk_Model>();

                if (DropDownListStokProduk.Items.Count == 0)
                {
                    ButtonSimpanDetail.Enabled = false;
                    ButtonSimpan.Enabled       = false;
                }
            }
        }
    }
Ejemplo n.º 3
0
        void Yukle()
        {
            if (Request.QueryString["MarkaID"] == null)
            {
                GridView1.DataSource = repoProduct.GetAll().AsEnumerable().OrderBy(o => o.Name).Select(s => new { s.ID, s.Name, s.Picture, s.Price, Marka = s.Brand.Name, StokBilgi = s.Stock <= 0 ? "TÜKENDİ" : s.Stock.ToString(), Kategorileri = string.Join(",", s.ProductCategory.Select(pc => pc.Category.Name)) }).ToList();
            }
            else
            {
                int BrandID = Convert.ToInt32(Request.QueryString["MarkaID"]);
                GridView1.DataSource = repoProduct.GetAll().AsEnumerable().OrderBy(o => o.Name).Where(w => w.BrandID == BrandID).Select(s => new { s.ID, s.Name, s.Picture, s.Price, Marka = s.Brand.Name, StokBilgi = s.Stock <= 0 ? "TÜKENDİ" : s.Stock.ToString(), Kategorileri = string.Join(",", s.ProductCategory.Select(pc => pc.Category.Name)) }).ToList();
                h1Baslik.InnerText   = Request.QueryString["MarkaAd"].ToUpper() + " ÜRÜNLERİ";
            }
            GridView1.DataBind();
            DropDownListBrand.DataSource = repoBrand.GetAll().OrderBy(o => o.Name).ToList();
            DropDownListBrand.DataBind();

            CheckBoxListKategori.DataSource = repoCategory.GetAll().OrderBy(o => o.Name).ToList();
            CheckBoxListKategori.DataBind();
        }
Ejemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext())
            {
                PenggunaLogin Pengguna = (PenggunaLogin)Session["PenggunaLogin"];

                Tempat_Class        ClassTempat        = new Tempat_Class(db);
                PemilikProduk_Class ClassPemilikProduk = new PemilikProduk_Class(db);

                DropDownListTempat.DataSource     = ClassTempat.Data();
                DropDownListTempat.DataValueField = "IDTempat";
                DropDownListTempat.DataTextField  = "Nama";
                DropDownListTempat.DataBind();
                DropDownListTempat.Items.Insert(0, new ListItem {
                    Value = "0", Text = "- Semua -"
                });
                DropDownListTempat.SelectedValue = Pengguna.IDTempat.ToString();

                ViewState["TanggalAwal"]  = Pengaturan.HariIni()[0];
                ViewState["TanggalAkhir"] = Pengaturan.HariIni()[1];

                TextBoxTanggalAwal.Text = ((DateTime)ViewState["TanggalAwal"]).ToString("d MMMM yyyy");

                DropDownListBrand.DataSource     = ClassPemilikProduk.Data();
                DropDownListBrand.DataValueField = "IDPemilikProduk";
                DropDownListBrand.DataTextField  = "Nama";
                DropDownListBrand.DataBind();
                DropDownListBrand.Items.Insert(0, new ListItem {
                    Value = "0", Text = "- Semua -"
                });
            }

            LoadData();
        }
        else
        {
            LinkDownload.Visible = false;
        }
    }
        private void ShowBrand()
        {
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["dbcon"].ConnectionString); //Create connection b/w .net and database

            con.Open();                                                                                              //open db connection

            string     qry = "Select * from tblBrand";                                                               //Sql Query
            SqlCommand cmd = new SqlCommand(qry, con);                                                               //send query execution

            SqlDataAdapter sda = new SqlDataAdapter(cmd);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);                                                         // fill sda data into dt
            if (dt.Rows.Count != 0)                                               //if data is more then zero
            {
                DropDownListBrand.DataSource     = dt;                            // dropdown source is dt
                DropDownListBrand.DataTextField  = "Name";                        // Cat name will show in dropdown
                DropDownListBrand.DataValueField = "BrandId";                     // sub category database will store only Catid
                DropDownListBrand.DataBind();                                     // binding data
                DropDownListBrand.Items.Insert(0, new ListItem("-Select-", "0")); //0th index of dropdown list
            }
        }
Ejemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext())
            {
                PenggunaLogin Pengguna = (PenggunaLogin)Session["PenggunaLogin"];

                Warna_Class ClassWarna = new Warna_Class(db);

                var listKombinasiProduk = db.TBStokProduks.Where(item => item.IDTempat == Pengguna.IDTempat).Select(item => new { item.TBKombinasiProduk.IDKombinasiProduk, item.TBKombinasiProduk.Nama, item.TBKombinasiProduk.TBProduk }).ToArray();

                #region Komposisi Produk
                DropDownListCariKomposisiProduk.DataSource     = listKombinasiProduk;
                DropDownListCariKomposisiProduk.DataTextField  = "Nama";
                DropDownListCariKomposisiProduk.DataValueField = "IDKombinasiProduk";
                DropDownListCariKomposisiProduk.DataBind();
                DropDownListCariKomposisiProduk.Items.Insert(0, new ListItem {
                    Text = "-Pilih Produk-", Value = "0"
                });

                var listStokBahanBaku = db.TBStokBahanBakus.ToArray();
                DropDownListBahanBaku.DataSource     = listStokBahanBaku.Where(item => item.IDTempat == Pengguna.IDTempat).Select(item => item.TBBahanBaku).ToArray();
                DropDownListBahanBaku.DataTextField  = "Nama";
                DropDownListBahanBaku.DataValueField = "IDBahanBaku";
                DropDownListBahanBaku.DataBind();

                LabelSatuan.Text             = listStokBahanBaku.FirstOrDefault() == null ? string.Empty : listStokBahanBaku.FirstOrDefault().TBBahanBaku.TBSatuan.Nama;
                ViewState["KomposisiProduk"] = new List <StokBahanBaku_Model>();
                #endregion

                #region Biaya Produksi
                DropDownListCariBiayaProduksi.DataSource     = listKombinasiProduk;
                DropDownListCariBiayaProduksi.DataTextField  = "Nama";
                DropDownListCariBiayaProduksi.DataValueField = "IDKombinasiProduk";
                DropDownListCariBiayaProduksi.DataBind();
                DropDownListCariBiayaProduksi.Items.Insert(0, new ListItem {
                    Text = "-Pilih Produk-", Value = "0"
                });

                DropDownListJenisBiayaProduksi.DataSource     = db.TBJenisBiayaProduksis.ToArray();
                DropDownListJenisBiayaProduksi.DataTextField  = "Nama";
                DropDownListJenisBiayaProduksi.DataValueField = "IDJenisBiayaProduksi";
                DropDownListJenisBiayaProduksi.DataBind();
                DropDownListJenisBiayaProduksi.Items.Insert(0, new ListItem {
                    Text = "-Tambah Baru-", Value = "0"
                });

                ViewState["BiayaProduksi"] = new List <JenisBiayaProduksi_Model>();
                #endregion

                #region Produk
                DropDownListCariProduk.DataSource     = listKombinasiProduk.Select(item => item.TBProduk).Distinct().ToArray();
                DropDownListCariProduk.DataTextField  = "Nama";
                DropDownListCariProduk.DataValueField = "IDProduk";
                DropDownListCariProduk.DataBind();
                DropDownListCariProduk.Items.Insert(0, new ListItem {
                    Text = "-Produk Baru-", Value = "0"
                });

                DropDownListBrand.DataSource     = db.TBPemilikProduks.OrderBy(item => item.Nama).ToArray();
                DropDownListBrand.DataTextField  = "Nama";
                DropDownListBrand.DataValueField = "IDPemilikProduk";
                DropDownListBrand.DataBind();
                DropDownListBrand.Items.Insert(0, new ListItem {
                    Text = "-Tambah Baru-", Value = "0"
                });

                DropDownListWarna.DataSource     = ClassWarna.Data();
                DropDownListWarna.DataTextField  = "Nama";
                DropDownListWarna.DataValueField = "IDWarna";
                DropDownListWarna.DataBind();
                DropDownListWarna.Items.Insert(0, new ListItem {
                    Text = "-Tambah Baru-", Value = "0"
                });

                DropDownListVarian.DataSource     = db.TBAtributProduks.OrderBy(item => item.Nama).ToArray();
                DropDownListVarian.DataTextField  = "Nama";
                DropDownListVarian.DataValueField = "IDAtributProduk";
                DropDownListVarian.DataBind();
                DropDownListVarian.Items.Insert(0, new ListItem {
                    Text = "-Tidak Ada-", Value = "-1"
                });
                DropDownListVarian.Items.Insert(1, new ListItem {
                    Text = "-Tambah Baru-", Value = "0"
                });


                CheckBoxListKategori.DataSource     = db.TBKategoriProduks.Select(item => new { item.IDKategoriProduk, Nama = item.Nama }).OrderBy(item => item.Nama).ToArray();
                CheckBoxListKategori.DataValueField = "IDKategoriProduk";
                CheckBoxListKategori.DataTextField  = "Nama";
                CheckBoxListKategori.DataBind();
                #endregion
            }

            if (!string.IsNullOrEmpty(Request.QueryString["Status"]))
            {
                if (Request.QueryString["Status"] == "true")
                {
                    LiteralInformasi.Text = "<div class=\"alert alert-success\" role=\"alert\"><strong>Berhasil.</strong> Data produk telah tersimpan.</div>";
                }
            }
        }
    }