Example #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 = "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;
                }
            }
        }
    }
Example #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 = "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;
            }
        }
    }
 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"));
 }
Example #4
0
        protected void ButtonAddEmployeeRep_Click(object sender, EventArgs e)
        {
            LabelError.Text = "";
            bool hasError = false;

            PanelError.Visible = false;

            if (Convert.ToInt32(DropDownListEmployee.SelectedValue) == 0)
            {
                LabelError.Text   += "Employee is required.\n";
                PanelError.Visible = true;
                hasError           = true;
            }

            //if (TextBoxEmployeeRepFrequency.Text.Length == 0)
            //{
            //    LabelError.Text += "Rep Frequency is required.\n";
            //    PanelError.Visible = true;
            //    hasError = true;
            //}

            if (hasError == false)
            {
                try
                {
                    //EmployeeReportsTo.InsertEmployeeReportsTo(this.employeeId, Convert.ToInt32(DropDownListReportsTo.SelectedValue), 0, "", "", this.Master.LoggedOnAccount, "True", Convert.ToInt32(DropDownListReportsTo.SelectedValue));
                    EmployeeMerchandisingGroupCustomRep employeeMerchandisingGroupCustomRep = new EmployeeMerchandisingGroupCustomRep();
                    employeeMerchandisingGroupCustomRep.StoreId    = this.storeId;
                    employeeMerchandisingGroupCustomRep.EmployeeId = Convert.ToInt32(DropDownListEmployee.SelectedValue);
                    employeeMerchandisingGroupCustomRep.MerchandisingGroupCustomId = this.merchandisingGroupCustomId;
                    employeeMerchandisingGroupCustomRep.FrequencyId  = Convert.ToInt32(DropDownListFrequencyIntervalRep.SelectedValue);
                    employeeMerchandisingGroupCustomRep.CompanyId    = 1;//Only MMS...for now.
                    employeeMerchandisingGroupCustomRep.ModifiedUser = this.Master.LoggedOnAccount;

                    employeeMerchandisingGroupCustomRep.Save();
                    BindEmployeeMerchandisingGroupCustomRep();

                    DropDownListEmployee.ClearSelection();
                    DropDownListEmployee.Items.FindByValue("0").Selected = true;
                    //TextBoxEmployeeRepFrequency.Text = "";
                }
                catch (System.Data.SqlClient.SqlException sqlEx)
                {
                    LabelError.Text = "";
                    for (int i = 0; i < sqlEx.Errors.Count; i++)
                    {
                        LabelError.Text += (sqlEx.Errors[i].Message + "<br />");
                    }
                    PanelError.Visible = true;
                }
            }
        }