示例#1
0
        private void BtnManageAdd_Click(object sender, EventArgs e)
        {
            DAL.RequestClass request = new DAL.RequestClass(txtDescription.Text, int.Parse(cmbStaffCode.SelectedValue.ToString()), int.Parse(cmbStudentCode.SelectedValue.ToString()), int.Parse(cmbTaskTypeCode.SelectedValue.ToString()), Convert.ToDateTime(dateRequest.Text), cmbTime.SelectedItem.ToString(), int.Parse(cmbAssignedStaffCode.SelectedValue.ToString()), cmbStatus.SelectedItem.ToString());

            int x = bll.AddRequest(request);

            if (x > 0)
            {
                txtDescription.Clear();
                cmbTime.ResetText();
                cmbStaffCode.ResetText();
                cmbStudentCode.ResetText();
                cmbTaskTypeCode.ResetText();
                cmbAssignedStaffCode.ResetText();
                dateRequest.ResetText();
                cmbStatus.ResetText();
            }
            else
            {
                MessageBox.Show("Please input valid data.");
            }

            dgvRequest.DataSource = bll.GetRequests();
        }
示例#2
0
        protected void btnManageAdd(object sender, EventArgs e)
        {
            DAL.RequestClass request = new DAL.RequestClass(txtDescription.Text, int.Parse(cmbStaff.SelectedValue.ToString()), int.Parse(cmbStudentCode.SelectedValue.ToString()), int.Parse(cmbTaskTypeCode.SelectedValue.ToString()), Convert.ToDateTime(dateRequest.SelectedDate), cmbTime.SelectedItem.ToString(), int.Parse(cmbAssignedStaffCode.SelectedValue.ToString()), cmbStatus.SelectedItem.ToString());

            int x = bll.AddRequest(request);

            if (x > 0)
            {
                txtDescription.Text       = "";
                cmbTime.Text              = "";
                cmbStaff.Text             = "";
                cmbStudentCode.Text       = "";
                cmbTaskTypeCode.Text      = "";
                cmbAssignedStaffCode.Text = "";
                dateRequest.SelectedDate  = DateTime.Today;
                cmbStatus.Text            = "";
            }
            else
            {
            }

            dgRequest.DataSource = bll.GetRequests();
            dgRequest.DataBind();
        }