Пример #1
0
    protected void RepeaterMeja_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext())
        {
            if (e.CommandName == "VIP")
            {
                TBMeja meja = db.TBMejas.FirstOrDefault(item => item.IDMeja == e.CommandArgument.ToInt());
                meja.VIP = !meja.VIP;
                db.SubmitChanges();
            }
            else if (e.CommandName == "Status")
            {
                TBMeja meja = db.TBMejas.FirstOrDefault(item => item.IDMeja == e.CommandArgument.ToInt());
                meja.Status = !meja.Status;
                db.SubmitChanges();
            }
            else if (e.CommandName == "Hapus")
            {
                Meja_Class Meja_Class = new Meja_Class();
                if (Meja_Class.Hapus(db, e.CommandArgument.ToInt()))
                {
                    LoadData(db);
                }
                else
                {
                    LiteralWarning.Text = Alert_Class.Pesan(TipeAlert.Danger, "Meja tidak bisa dihapus");
                }
            }

            LoadData(db);
        }
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext())
            {
                Pengguna_Class        ClassPengguna         = new Pengguna_Class(db);
                Tempat_Class          ClassTempat           = new Tempat_Class(db);
                JenisTransaksi_Class  ClassJenisTransaksi   = new JenisTransaksi_Class();
                StatusTransaksi_Class StatusTransaksi_Class = new StatusTransaksi_Class();
                Pelanggan_Class       ClassPelanggan        = new Pelanggan_Class(db);
                Meja_Class            Meja_Class            = new Meja_Class();

                DropDownListCariPenggunaTransaksi.Items.AddRange(ClassPengguna.DropDownList(true));
                DropDownListCariPenggunaUpdate.Items.AddRange(ClassPengguna.DropDownList(true));
                DropDownListCariTempat.Items.AddRange(ClassTempat.DataDropDownList());
                DropDownListCariJenisTransaksi.Items.AddRange(ClassJenisTransaksi.DataDropDownList(db));
                DropDownListCariStatusTransaksi.Items.AddRange(StatusTransaksi_Class.DataDropDownList(db));
                ClassPelanggan.DropDownList(DropDownListCariPelanggan, true);
                DropDownListCariMeja.Items.AddRange(Meja_Class.DataDropDownList(db));

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

                LoadData();
            }
        }
        else
        {
            LinkDownload.Visible = false;
        }
    }
Пример #3
0
    private void LoadData(DataClassesDatabaseDataContext db)
    {
        Meja_Class Meja_Class = new Meja_Class();

        var ListMeja = db.TBMejas
                       .Where(item => item.IDMeja > 2)
                       .Select(item => new
        {
            item.IDMeja,
            item.Nama,
            item.IDStatusMeja,
            Warna = WarnaMeja(item.IDStatusMeja.Value),
            item.VIP,
            item.Status,
        }).ToArray();

        var MejaReguler = ListMeja.Where(item => item.VIP == false);

        if (MejaReguler.Count() > 0)
        {
            int   barisReguler  = (int)Math.Ceiling((double)MejaReguler.Count() / 10);
            int[] resultReguler = new int[barisReguler];

            for (int i = 0; i < barisReguler; i++)
            {
                resultReguler[i] = i + 1;
            }

            RepeaterReguler.DataSource = resultReguler.Select(item => new
            {
                baris = MejaReguler.Skip((item * 10) - 10).Take(10)
            });
            RepeaterReguler.DataBind();
        }

        var MejaVIP = ListMeja.Where(item => item.VIP == true);

        if (MejaVIP.Count() > 0)
        {
            int   barisVIP  = (int)Math.Ceiling((double)MejaReguler.Count() / 5);
            int[] resultVIP = new int[barisVIP];

            for (int i = 0; i < barisVIP; i++)
            {
                resultVIP[i] = i + 1;
            }

            RepeaterVIP.DataSource = resultVIP.Select(item => new
            {
                baris = MejaVIP.Skip((item * 5) - 5).Take(5)
            });
            RepeaterVIP.DataBind();
        }
    }
Пример #4
0
    protected void ButtonSimpan_Click(object sender, EventArgs e)
    {
        using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext())
        {
            Meja_Class Meja_Class = new Meja_Class();

            if (ButtonSimpan.Text == "Tambah")
            {
                Meja_Class.Tambah(db, TextBoxNama.Text, TextBoxJumlahKursi.Text.ToDecimal().ToInt(), CheckBoxVIP.Checked, true);
            }
            else if (ButtonSimpan.Text == "Ubah")
            {
                Meja_Class.Ubah(db, Request.QueryString["id"].ToInt(), TextBoxNama.Text, TextBoxJumlahKursi.Text.ToDecimal().ToInt(), CheckBoxVIP.Checked, true);
            }

            db.SubmitChanges();

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