Exemplo n.º 1
0
    public void Update(DAL.DanhMucPhuCapPhucLoi item)
    {
        var pcpl = dataContext.DanhMucPhuCapPhucLois.Where(p => p.ID == item.ID).SingleOrDefault();

        pcpl.Ten    = item.Ten;
        pcpl.SoTien = item.SoTien;
        pcpl.HeSo   = item.HeSo;
        pcpl.NhomLoaiPhuCapPhucLoi = item.NhomLoaiPhuCapPhucLoi;
        pcpl.IsPhuCap  = item.IsPhuCap;
        pcpl.PhanTram  = item.PhanTram;
        pcpl.TinhVaoBH = item.TinhVaoBH;
        Save();
    }
    protected void btnCapNhat_Click(object sender, DirectEventArgs e)
    {
        var dmc = new DanhMucPhuCapPhucLoiController();

        DAL.DanhMucPhuCapPhucLoi item = new DAL.DanhMucPhuCapPhucLoi();
        item.Ten = txtTenPhuCap.Text;
        if (!string.IsNullOrEmpty(txtHeSo.Text))
        {
            item.HeSo = Convert.ToDouble(txtHeSo.Text.Replace('.', ','));
        }
        if (!string.IsNullOrEmpty(txtSoTien.Text))
        {
            item.SoTien = Convert.ToDouble(txtSoTien.Text);
        }
        if (!string.IsNullOrEmpty(txtPhanTram.Text))
        {
            item.PhanTram = Convert.ToDouble(txtPhanTram.Text.Replace('.', ','));
        }
        item.IsPhuCap = cbbLaPhuCap.SelectedItem.Value == "0" ? false : true;
        item.NhomLoaiPhuCapPhucLoi = hdfNhomLoaiPhuCap.Text;
        item.TinhVaoBH             = ckTinhVaoBH.Checked;
        item.CreatedBy             = CurrentUser.ID;
        item.CreatedDate           = DateTime.Now;
        if (Session["MaDonVi"] != null)
        {
            item.MaDonVi = Session["MaDonVi"].ToString();
        }
        if (e.ExtraParams["Command"] == "Edit")
        {
            item.ID = Convert.ToInt32(Convert.ToInt32(hdfRecordID.Text));
            dmc.Update(item);
            wdAddWindow.Hide();
        }
        else
        {
            dmc.Insert(item);
            if (e.ExtraParams["Close"] == "True")
            {
                wdAddWindow.Hide();
            }
            RM.RegisterClientScriptBlock("adsfasdf", "resetWindowHide();");
        }

        GridPanel1.Reload();
    }
    protected void btnEdit_Click(object sender, DirectEventArgs e)
    {
        var dmc = new DanhMucPhuCapPhucLoiController();

        DAL.DanhMucPhuCapPhucLoi item = new DAL.DanhMucPhuCapPhucLoi();
        DAL.DanhMucPhuCapPhucLoi edit = dmc.Lay1BanGhi(Convert.ToInt32(hdfRecordID.Text));
        txtTenPhuCap.Text      = edit.Ten;
        txtSoTien.Text         = edit.SoTien == null ? "" : edit.SoTien.ToString();
        txtHeSo.Text           = edit.HeSo == null ? "" : edit.HeSo.ToString();
        txtPhanTram.Text       = edit.PhanTram == null ? "" : edit.PhanTram.ToString();
        cbbLaPhuCap.Value      = edit.IsPhuCap == true ? "1" : "0";
        hdfNhomLoaiPhuCap.Text = edit.NhomLoaiPhuCapPhucLoi;
        cbbNhomLoaiPhuCap.SelectedItem.Value = edit.NhomLoaiPhuCapPhucLoi;
        ckTinhVaoBH.Checked = edit.TinhVaoBH == true ? true : false;
        wdAddWindow.Title   = "Sửa phụ cấp phúc lợi";
        wdAddWindow.Icon    = Icon.Pencil;
        RM.RegisterClientScriptBlock("xxx", "cbbNhomLoaiPhuCap.triggers[0].show();");
        wdAddWindow.Show();
    }
Exemplo n.º 4
0
 public void Insert(DAL.DanhMucPhuCapPhucLoi pcpl)
 {
     dataContext.DanhMucPhuCapPhucLois.InsertOnSubmit(pcpl);
     Save();
 }