コード例 #1
0
 protected void btnThem_Click(object sender, EventArgs e)
 {
     try
     {
         string ma              = txtMa.Text;
         string congtac         = ma + "/" + txtCongTac.Text;
         CongTacTimeSheetDAO ct = new CongTacTimeSheetDAO();
         bool kq = ct.KiemTraMa(ma);
         if (kq == false)
         {
             bool them = ct.ThemMoi(ma, congtac, 0);
             if (them == true)
             {
                 lblThongBao.Text = "Thêm thành công!";
                 txtMa.Text       = "";
                 txtCongTac.Text  = "";
             }
             else
             {
                 lblThongBao.Text = "Fail!";
             }
         }
         else
         {
             lblThongBao.Text = "Mã đã tồn tại.";
         }
     }
     catch (Exception ex)
     { lblThongBao.Text = ex.Message; }
 }
コード例 #2
0
        protected void btnThem_Click(object sender, EventArgs e)
        {
            string ma   = txtMa.Text;
            string type = ma + "_" + txtType.Text;
            float  rate = float.Parse(txtRate.Text);

            if (txtMa.Text == "" || txtType.Text == "")
            {
                lblThongBao.Text = "Phải nhập Type timsesheet mới!";
            }
            else
            {
                bool kq = tsdao.ThemMoi(ma, type, rate);
                if (kq == true)
                {
                    loadGR();
                    ClearInputs(Page.Controls);
                }
                else
                {
                    lblThongBao.Text = "Fail!";
                }
            }
        }