public bool CapNhat(WeeklyReportDTO w) { string sql = "sp_WeeklyReport_CapNhat"; List<SqlParameter> ds = new List<SqlParameter>(); SqlParameter id = new SqlParameter("@idweekly", SqlDbType.Int); id.Value = w.Ma; ds.Add(id); SqlParameter dx = new SqlParameter("@dexuat",SqlDbType.NVarChar); dx.Value = w.DeXuatGiamDinh; ds.Add(dx); return SqlDataAcessHelper.exNonStoreParas(sql, ds); }
protected void btnCapNhat_Click(object sender, EventArgs e) { if (IsPostBack) { //string maclaim = ""; //if (lblThamChieu.Text != "") // maclaim = lblThamChieu.Text; //if (txtThamChieu.Text != "") // maclaim = txtThamChieu.Text; string maclaim=Session["ThamChieu"].ToString(); bool kq = wrdao.KiemTraWR(maclaim); bool kt = tsdao.KiemTraTimeSheetTonTai(maclaim); if (kq == false)//chua co weekly report { //them moi wr //maclaim = lblThamChieu.Text; wrdto.MaClaim = maclaim; //wrdto.MaGDV = int.Parse(drGDV.SelectedValue); if (kt == true) { float gio = tsdao.TongThoiLuongPhatSinhTheoCliam(maclaim); wrdto.GioTichLuy = gio; } else wrdto.GioTichLuy = (float)0; string dexuatgiamdinh = txtDeXuatGiamDinh.Text; if (dexuatgiamdinh != "") wrdto.DeXuatGiamDinh = dexuatgiamdinh; else wrdto.DeXuatGiamDinh = ""; bool kqt = wrdao.Them(wrdto); if (kqt == true) { //string thamchieu = cldao.TenClaim(maclaim); //Session["ThamChieu"] = thamchieu; int maGDV = int.Parse(Request.Cookies["MaGDV"].Value); string noidung = gdv.LayTenTheoMa(maGDV) + " created a weeklyreport of case" + maclaim + " ."; SaveLogTracking(maGDV, noidung, maclaim); Response.Write("<script> window.parent.closeDialog(); </script>"); Response.Write("<script> window.parent.location.reload();</script>"); } } else { //cap nhat wr wrdto = new WeeklyReportDTO(); wrdto.Ma = wrdao.LayMa(maclaim); //wrdto.DuPhongTonThat = txtDuPhongTonThat.Text.Trim(); wrdto.DeXuatGiamDinh = txtDeXuatGiamDinh.Text.Trim(); //wrdto.GioTichLuy = float.Parse(txtGioTichLuy.Text); bool kqcn = wrdao.CapNhat(wrdto); if (kqcn == true) { // string tc = cldao.TenClaim(maclaim); // Session["ThamChieu"] = tc; int maGDV = int.Parse(Request.Cookies["MaGDV"].Value); string noidung = gdv.LayTenTheoMa(maGDV) + " edited weeklyreport of case" + maclaim + " ."; SaveLogTracking(maGDV, noidung, maclaim); Response.Write("<script> window.parent.closeDialog(); </script>"); Response.Write("<script> window.parent.location.reload();</script>"); } } } }
public bool Them(WeeklyReportDTO w) { string sql = "sp_WeeklyReport_Them"; List<SqlParameter> ds = new List<SqlParameter>(); SqlParameter maclaim = new SqlParameter("@maclaim",SqlDbType.VarChar); maclaim.Value = w.MaClaim; ds.Add(maclaim); SqlParameter gdv = new SqlParameter("@idgdv",SqlDbType.Int); gdv.Value = w.MaGDV; ds.Add(gdv); SqlParameter giotichluy = new SqlParameter("@giotichluy", SqlDbType.Float); giotichluy.Value = w.GioTichLuy; ds.Add(giotichluy); SqlParameter dexuatgiamdinh = new SqlParameter("@dexuatgiamdinh",SqlDbType.NVarChar); dexuatgiamdinh.Value = w.DeXuatGiamDinh; ds.Add(dexuatgiamdinh); return SqlDataAcessHelper.exNonStoreParas(sql, ds); }