Beispiel #1
0
    protected void btnCapNhat_Click(object sender, DirectEventArgs e)
    {
        BHCHEDOBAOHIEMInfo       obj = new BHCHEDOBAOHIEMInfo();
        BHCHEDOBAOHIEMController ctr = new BHCHEDOBAOHIEMController();

        if (!string.IsNullOrEmpty(cboCheDoBH.Text))
        {
            obj.ParentID = Convert.ToInt32(cboCheDoBH.Value);
        }
        obj.MaCheDoBaohiem  = txtMaCheDoBaohiem.Text;
        obj.TenCheDoBaoHiem = txtTenCheDoBaoHiem.Text;
        obj.UserID          = CurrentUser.ID;
        obj.DateCreate      = DateTime.Now;
        obj.MaDonVi         = Session["MaDonVi"].ToString();
        if (e.ExtraParams["Command"] == "Edit")
        {
            obj.IDCheDoBaoHiem = Convert.ToInt32(hdfRecordID.Text);
            //obj.IDCheDoBaoHiem = Convert.ToInt32(hdfIdcha_edit.Text);
            ctr.Update(obj);
            wdAddWindow.Hide();
            hdfIdcha_edit.Text = "";
        }
        else
        {
            if (cboCheDoBH.Value.ToString() == "0")
            {
                obj.ParentID = 0;
            }
            DataTable dt = DataController.DataHandler.GetInstance().ExecuteDataTable("GetCheDoBaoHiem_MaCheDoBaoHiem", "@MaCheDoBaoHiem", txtMaCheDoBaohiem.Text);
            if (dt.Rows.Count > 0)
            {
                X.MessageBox.Alert("Thông báo", "Mã chế độ bảo hiểm đã tồn tại").Show();
                txtMaCheDoBaohiem.Focus();
                return;
            }
            else
            {
                ctr.Insert(obj);
                cboCheDoBH.Reset();
                txtMaCheDoBaohiem.Reset();
                txtTenCheDoBaoHiem.Reset();
            }
            if (e.ExtraParams["Close"] == "True")
            {
                wdAddWindow.Hide();
            }
        }
        GridPanel1.Reload();
    }
Beispiel #2
0
    protected void btnCapNhat_Click_Cha(object sender, DirectEventArgs e)
    {
        BHCHEDOBAOHIEMInfo       obj = new BHCHEDOBAOHIEMInfo();
        BHCHEDOBAOHIEMController ctr = new BHCHEDOBAOHIEMController();

        obj.ParentID        = 0;
        obj.MaCheDoBaohiem  = txtcha_machedobh.Text;
        obj.TenCheDoBaoHiem = txtcha_tenchedobh.Text;
        obj.UserID          = CurrentUser.ID;
        obj.DateCreate      = DateTime.Now;
        obj.MaDonVi         = Session["MaDonVi"].ToString();
        if (e.ExtraParams["Command"] == "Edit")
        {
            obj.IDCheDoBaoHiem = Convert.ToInt32(hdfNhomCha.Text);
            ctr.Update(obj);
            wdNhomCheDoBH.Hide();
        }
        else
        {
            DataTable dt = DataController.DataHandler.GetInstance().ExecuteDataTable("GetCheDoBaoHiem_MaCheDoBaoHiem", "@MaCheDoBaoHiem", txtcha_machedobh.Text);
            if (dt.Rows.Count > 0)
            {
                X.MessageBox.Alert("Thông báo", "Mã chế độ bảo hiểm đã tồn tại").Show();
                txtcha_machedobh.Focus();
                return;
            }
            else
            {
                ctr.Insert(obj);
                txtcha_machedobh.Reset();
                txtcha_tenchedobh.Reset();
            }
        }
        if (e.ExtraParams["Close"] == "True")
        {
            wdNhomCheDoBH.Hide();
        }
        grp_nhombhdcd.Reload();
    }