Beispiel #1
0
    protected void btnCapNhat_Click(object sender, DirectEventArgs e)
    {
        DAL.DM_LOAI_HDONG loaihd = new DAL.DM_LOAI_HDONG();
        loaihd.MA_LOAI_HDONG           = txtmaloaihd.Text;
        loaihd.TEN_LOAI_HDONG          = txtTenLoaiHopDong.Text;
        loaihd.THOI_HAN_HOPDONG_MONTH_ = int.Parse(txtThoiGian.Text);
        loaihd.GHI_CHU = txtGhiChu.Text;
        loaihd.BHTN    = false;
        loaihd.BHYT    = false;
        loaihd.BHXH    = false;
        if (!string.IsNullOrEmpty(nbfHeSo.Text))
        {
            loaihd.HeSo = double.Parse(nbfHeSo.Text.Replace('.', ','));
        }
        DM_LOAI_HDONGController ctr = new DM_LOAI_HDONGController();

        if (e.ExtraParams["Command"] == "Edit")
        {
            loaihd.MA_LOAI_HDONG = txtmaloaihd.Text;
            ctr.Update(loaihd);
            wdAddWindow.Hide();
        }
        else
        {
            ctr.Insert(loaihd);
            if (e.ExtraParams["Close"] == "True")
            {
                wdAddWindow.Hide();
            }
        }
        GridPanel1.Reload();
        //    RM.RegisterClientScriptBlock("fd", string.Format("addHopDong({0},'{1}','{2}',{3},'{4}')", 0, txtmaloaihd.Text, txtTenLoaiHopDong.Text, txtThoiGian.Text, txtGhiChu.Text));
    }
 public void Update(DAL.DM_LOAI_HDONG a)
 {
     DAL.DM_LOAI_HDONG loaihd = GetByID(a.MA_LOAI_HDONG);
     loaihd.TEN_LOAI_HDONG          = a.TEN_LOAI_HDONG;
     loaihd.THOI_HAN_HOPDONG_MONTH_ = a.THOI_HAN_HOPDONG_MONTH_;
     loaihd.GHI_CHU = a.GHI_CHU;
     loaihd.HeSo    = a.HeSo;
     Save();
 }
Beispiel #3
0
 protected void btnOK_Click(object sender, DirectEventArgs e)
 {
     try
     {
         DAL.DM_LOAI_HDONG loaihd = new DM_LOAI_HDONGController().GetByID(hdfRecordID.Text);
         DAL.DM_LOAI_HDONG copy   = new DAL.DM_LOAI_HDONG();
         copy.MA_LOAI_HDONG           = txtmaloaihdcoppy.Text;
         copy.TEN_LOAI_HDONG          = loaihd.TEN_LOAI_HDONG;
         copy.THOI_HAN_HOPDONG_MONTH_ = loaihd.THOI_HAN_HOPDONG_MONTH_;
         copy.GHI_CHU = loaihd.GHI_CHU;
         wdInputNewPrimaryKey.Hidden = true;
         new DM_LOAI_HDONGController().Insert(copy);
         RM.RegisterClientScriptBlock("fd", string.Format("addHopDong({0},'{1}','{2}',{3},'{4}')", 0, txtmaloaihdcoppy.Text, copy.TEN_LOAI_HDONG, copy.THOI_HAN_HOPDONG_MONTH_, copy.GHI_CHU));
     }
     catch (Exception ex)
     {
         Dialog.ShowNotification("Đã có lỗi xảy ra trong quá trình nhân đôi dữ liệu !");
     }
 }
 public void DeleteLoaiHD(string maloaihd)
 {
     DAL.DM_LOAI_HDONG d = dataContext.DM_LOAI_HDONGs.Where(t => t.MA_LOAI_HDONG == maloaihd).FirstOrDefault();
     dataContext.DM_LOAI_HDONGs.DeleteOnSubmit(d);
     Save();
 }
 public void Insert(DAL.DM_LOAI_HDONG loaihd)
 {
     dataContext.DM_LOAI_HDONGs.InsertOnSubmit(loaihd);
     Save();
 }