Ejemplo n.º 1
0
        public void GetData()
        {
            OffDutyFactory l_factory紀錄 = _context.CFactoryManager.OffDutyFactory;

            DataTable dt = l_factory紀錄.GetData("");

            this.gvOffDuty.DataSource = dt;
            this.gvOffDuty.DataBind();
        }
Ejemplo n.º 2
0
        protected void gvOffDuty_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            OffDutyFactory l_factory紀錄 = _context.CFactoryManager.OffDutyFactory;

            if (e.CommandName == "Delete")
            {
                int    rowIndex = int.Parse(e.CommandArgument.ToString());
                string lKey     = gvOffDuty.DataKeys[rowIndex]["EMPNO"].ToString();

                l_factory紀錄.RemoveData(lKey);
            }
            GetData();
        }
Ejemplo n.º 3
0
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         OffDutyFactory l_factory紀錄 = _context.CFactoryManager.OffDutyFactory;
         l_factory紀錄.AddOffDuty(txtEmp.Text, txtName.Text);
         GetData();
         txtEmp.Text  = "";
         txtName.Text = "";
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterClientScriptBlock(UpdatePanel1, typeof(UpdatePanel), "OK", "alert('新增出錯可能是員工編號重複');", true);
     }
 }