Example #1
0
    protected void btnThem_Click(object sender, EventArgs e)
    {
        try
        {
            if ((txtNgay.Text != "") && (txtSoCa.Text != ""))
            {
                ThemChamCong(DropDownMaNV.SelectedValue.ToString(), txtNgay.Text, txtSoCa.Text);
                DgCong.DataSource = dsChamCong();
                DgCong.DataBind();

                if (DgCong.Rows.Count > 0)
                {
                    DgCong.HeaderRow.Cells[0].Text = "Mã Nhân Viên ";
                    DgCong.HeaderRow.Cells[1].Text = "Ngày ";
                    DgCong.HeaderRow.Cells[2].Text = "Số Ca ";
                }
                txtNgay.Text     = "";
                txtSoCa.Text     = "";
                txtThongBao.Text = "Thêm Thành Công!";
            }
            else
            {
                txtThongBao.Text = "Không được bỏ trống các thuộc tính!";
            }
        }
        catch (Exception)
        { }
    }
Example #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     DgCong.DataSource = dsChamCong();
     DgCong.DataBind();
     if (!IsPostBack)
     {
         DropDownMaNV.DataSource     = NhanVien();
         DropDownMaNV.DataTextField  = "TenNV";
         DropDownMaNV.DataValueField = "MaNV";
         DropDownMaNV.DataBind();
         DgCong.DataBind();
         if (DgCong.Rows.Count > 0)
         {
             DgCong.HeaderRow.Cells[0].Text = "Mã Nhân Viên ";
             DgCong.HeaderRow.Cells[1].Text = "Ngày ";
             DgCong.HeaderRow.Cells[2].Text = "Số Ca ";
         }
     }
 }
Example #3
0
 protected void btnXoa_Click(object sender, EventArgs e)
 {
     if (txtNgay.Text != "")
     {
         XoaChamCong(txtNgay.Text, DropDownMaNV.SelectedValue.ToString());
         DgCong.DataSource = dsChamCong();
         DgCong.DataBind();
         if (DgCong.Rows.Count > 0)
         {
             DgCong.HeaderRow.Cells[0].Text = "Mã Nhân Viên ";
             DgCong.HeaderRow.Cells[1].Text = "Ngày ";
             DgCong.HeaderRow.Cells[2].Text = "Số Ca ";
         }
         txtNgay.Text     = "";
         txtSoCa.Text     = "";
         txtThongBao.Text = "Xóa Thành Công!";
     }
     else
     {
         txtThongBao.Text = "THuộc tính không được xóa !";
     }
 }