protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { thamchieu = Request.QueryString["viewthamchieu"]; lblThongBaoTS.Visible = false; if (thamchieu != null) { string matc = cldao.LayMaTheoTen(thamchieu); ClaimID = matc; chitietwr(thamchieu); loadTimeSheet(matc); loadLoaiDR(matc); } else { thamchieu = Session["ThamChieu"].ToString(); ClaimID = thamchieu; string tenclaim = cldao.TenClaim(thamchieu); chitietwr(tenclaim); loadTimeSheet(thamchieu); loadLoaiDR(thamchieu); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { HttpCookie ck = Request.Cookies["MaGDV"]; if (ck == null) { Response.Redirect("~/Pages/Login.aspx"); } else { mathamchieu = Request.QueryString["ThamChieu"]; string thamchieu = Request.QueryString["Claim"]; if (thamchieu != null) { loadClaim(thamchieu); string maclaim = cl.LayMaTheoTen(thamchieu); LoadTienDoXuLy(maclaim); loadDeXuatBoiThuong(maclaim); KiemMaLinhVuc(maclaim); } else { thamchieu = cl.TenClaim(mathamchieu); loadClaim(thamchieu); LoadTienDoXuLy(mathamchieu); loadDeXuatBoiThuong(mathamchieu); KiemMaLinhVuc(mathamchieu); } } } }
protected void btnTim_Click(object sender, EventArgs e) { int magdv = int.Parse(drGDV0.SelectedItem.Value.ToString()); //GiamDinhVienDAO gdvdao = new GiamDinhVienDAO(); //DataTable dtgdv = gdvdao.MaGiamDinhVienTheoTen(tengdv); //int idgdv = 0; //if (dtgdv.Rows.Count > 0) //{ // DataRow dr = dtgdv.Rows[0]; // idgdv = int.Parse(dr[0].ToString()); //} ClaimDAO cdao = new ClaimDAO(); string matc = txtMaThamChieuT.Text; string thamchieu = cdao.TenClaim(matc); //DataTable dtc = cdao.ClaimTheoTen(thamchieu); if (matc != "") { bool kt = cl.KiemTraThamChieu(matc); if (kt == true) { loadDSTimeSheet(magdv, matc); gvDSTimeSheet.Visible = true; } } //if (matc == "") //{ // LoadTSTheoThamchieu(matc); //} if (matc == "") { loadTheoGDV(magdv); } //if (dtgdv.Rows.Count == 0) //{ // loadTheoThamChieu(matc); //} }
protected void Page_Load(object sender, EventArgs e) { //else //{ // mathamchieu = Request.QueryString["IDClaim"]; //} if (!this.IsPostBack) { if (Session["ThamChieu"] == null) { Response.Redirect("~/Pages/Home.aspx"); } if (Session["ThamChieu"] != null) { thamchieu = Session["ThamChieu"].ToString(); string ten = cl.TenClaim(thamchieu); lblThamChieu.Text = ten; loadInfo(thamchieu); loadCK(); } } }
protected void btnCapNhat_Click(object sender, EventArgs e) { if (IsPostBack) { string maclaim = ""; if (lblThamChieu.Text != "") { maclaim = lblThamChieu.Text; } if (txtThamChieu.Text != "") { maclaim = txtThamChieu.Text; } bool kq = wrdao.KiemTraWR(maclaim); bool kt = tsdao.KiemTraTimeSheetTonTai(maclaim); if (kq == false) //chua co weekly report { //them moi wr maclaim = txtThamChieu.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 = ckDeXuatGiamDinh.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; Response.Redirect("~/Pages/XemWeeklyReport.aspx?viewthamchieu=" + thamchieu); } } else { //cap nhat wr wrdto = new WeeklyReportDTO(); wrdto.Ma = wrdao.LayMa(maclaim); //wrdto.DuPhongTonThat = txtDuPhongTonThat.Text.Trim(); wrdto.DeXuatGiamDinh = ckDeXuatGiamDinh.Text.Trim(); //wrdto.GioTichLuy = float.Parse(txtGioTichLuy.Text); bool kqcn = wrdao.CapNhat(wrdto); if (kqcn == true) { string tc = cldao.TenClaim(maclaim); Session["ThamChieu"] = tc; Response.Redirect("~/Pages/XemWeeklyReport.aspx?viewthamchieu=" + tc); //Response.RedirectLocation("~/Pages/ViewWR.aspx"); } } //} //else // lblThongBao.Text = "Sai tham chiếu."; //} //else // lblThongBao.Text = "Chưa nhập tham chiếu."; } }