Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext())
            {
                PenggunaLogin pengguna = (PenggunaLogin)Session["PenggunaLogin"];

                DropDownListEmployee.DataSource     = db.TBPenggunas.OrderBy(item => item.NamaLengkap).ToArray();
                DropDownListEmployee.DataTextField  = "NamaLengkap";
                DropDownListEmployee.DataValueField = "IDPengguna";
                DropDownListEmployee.DataBind();
                DropDownListEmployee.Items.Insert(0, new ListItem {
                    Value = "0", Text = "Pilih Pegawai"
                });

                int index = 0;
                for (int i = DateTime.Now.Year - 5; i <= DateTime.Now.Year + 5; i++)
                {
                    DropDownListTahun.Items.Insert(index, new ListItem(i.ToString(), i.ToString()));
                    index++;
                }
                DropDownListTahun.SelectedIndex = 5;
            }
        }
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext())
            {
                PenggunaLogin pengguna = (PenggunaLogin)Session["PenggunaLogin"];

                DropDownListEmployee.DataSource     = db.TBPenggunas.OrderBy(item => item.NamaLengkap).ToArray();
                DropDownListEmployee.DataTextField  = "NamaLengkap";
                DropDownListEmployee.DataValueField = "IDPengguna";
                DropDownListEmployee.DataBind();
                DropDownListEmployee.Items.Insert(0, new ListItem {
                    Value = "0", Text = "All Employees"
                });

                //DropDownListFilterGender.Items.Insert(0, new ListItem { Value = "0", Text = "All Gender" });
                //DropDownListFilterGender.Items.Insert(1, new ListItem { Value = "1", Text = "Male" });
                //DropDownListFilterGender.Items.Insert(2, new ListItem { Value = "2", Text = "Female" });

                TextBoxTanggalAwal.Text  = DateTime.Now.ToString("d MMMM yyyy");
                TextBoxTanggalAkhir.Text = DateTime.Now.ToString("d MMMM yyyy");

                if (TextBoxTanggalAwal.Text == TextBoxTanggalAkhir.Text)
                {
                    LabelPeriode.Text = TextBoxTanggalAwal.Text;
                }
                else
                {
                    LabelPeriode.Text = TextBoxTanggalAwal.Text + " - " + TextBoxTanggalAkhir.Text;
                }
            }
        }
    }
 private void BindEmployee()
 {
     DropDownListEmployee.DataSource     = Employee.GetEmployeeList(Account.GetAccountByUserName(Page.User.Identity.Name.ToString()).CompanyId);
     DropDownListEmployee.DataTextField  = "FormattedNameNumber";
     DropDownListEmployee.DataValueField = "EmployeeId";
     DropDownListEmployee.DataBind();
     DropDownListEmployee.Items.Insert(0, new ListItem("Please select", "0"));
 }