protected void Page_Load(object sender, EventArgs e) { var id = Request["ID"]; var idNull = string.IsNullOrEmpty(id); using (var con = DAL.con()) { var thuChi = ThuChiDal.SelectById(con, Convert.ToInt64(id)); Item = PhoiDal.SelectById(con, thuChi.PHOI_ID); var Xe = XeDal.SelectById(con, Item.XE_ID); var LaiXe = LaiXeDal.SelectById(con, Item.LAIXE_ID); var LoaiBieuDo = LoaiBieuDoDal.SelectById(con, Xe.BIEUDO_ID); var Tuyen = TuyenDal.SelectById(con, Xe.TUYEN_ID); var TruyThuItem = TruyThuDal.SelectByPhoiId(con, Convert.ToInt64(Item.ID)); var XeVaoBen = XeVaoBenDal.SelectByPhoiId(con, Item.ID); Item.TruyThuItem = TruyThuItem; Item.XeVaoBen = XeVaoBen; Xe.LaiXe = LaiXe; Item.LaiXe = LaiXe; Xe.LoaiBieuDo = LoaiBieuDo; Xe.Tuyen = Tuyen; Item.Xe = Xe; PhoiNgoaiTinh.Item = Item; } }
protected void Page_Load(object sender, EventArgs e) { var id = Request["ID"]; var act = Request["act"]; var idNull = string.IsNullOrEmpty(id); using (var con = DAL.con()) { if (idNull) { Item = PhoiDal.SelectLastest(Security.CqId.ToString()); Item.CQ_ID = Security.CqId; Item.Xe = new Xe() { Tuyen = new Tuyen(), LoaiBieuDo = new LoaiBieuDo() }; Item.LaiXe = new LaiXe(); Item.ChamCongList = new List <ChamCong>(); Item.ChamCongListCurrent = new List <ChamCong>(); Item.TruyThuItem = new TruyThu(); Item.XeVaoBen = new XeVaoBen(); } else { Item = PhoiDal.SelectById(con, Convert.ToInt32(id)); var Xe = XeDal.SelectById(con, Item.XE_ID); var LaiXe = LaiXeDal.SelectById(con, Item.LAIXE_ID); var LoaiBieuDo = LoaiBieuDoDal.SelectById(con, Xe.BIEUDO_ID); var Tuyen = TuyenDal.SelectById(con, Xe.TUYEN_ID); var TruyThuItem = TruyThuDal.SelectByPhoiId(con, Item.ID); var XeVaoBen = XeVaoBenDal.SelectByPhoiId(con, Item.ID); Item.XeVaoBen = XeVaoBen; Item.TruyThuItem = TruyThuItem; Xe.LaiXe = LaiXe; Item.LaiXe = LaiXe; Xe.LoaiBieuDo = LoaiBieuDo; Xe.Tuyen = Tuyen; Item.Xe = Xe; var month = DateTime.Now.Month; var year = DateTime.Now.Year; var prevMonth = month == 1 ? 12 : month - 1; var tuNgay = new DateTime(year, prevMonth, 1).AddDays(-1); var chamCongList = ChamCongDal.SelectByXeTuNgay(id, tuNgay.ToString("dd/MM/yyyy"), Xe.ID).Where(x => x.Ngay < Item.NgayTao).ToList(); var chamCongListCurrent = ChamCongDal.SelectByTruyThuId(TruyThuItem.ID); Item.ChamCongList = chamCongList; Item.ChamCongListCurrent = chamCongListCurrent; // Duyệt truy thu nên đẩy XeVaoBen sang thu ngân if (act == "approvedTruyThu") { //var xvb = XeVaoBenDal.SelectByPhoiId(con, Item.ID); //xvb.TrangThai = 400; //xvb.NgayCapNhat = DateTime.Now; //xvb = XeVaoBenDal.Update(xvb); } } } Add.Item = Item; }
protected void Page_Load(object sender, EventArgs e) { var loggedIn = Security.IsAuthenticated(); var Id = Request["Id"]; var soChuyenDuocDuyet = Request["SoChuyenDuocDuyet"]; var yKienChiDao = Request["YKienChiDao"]; var KienNghi = Request["KienNghi"]; var PHI_ConNo = Request["PHI_ConNo"]; var PHI_Nop = Request["PHI_Nop"]; switch (subAct) { case "duyet": if (loggedIn && !string.IsNullOrEmpty(Id)) { using (var con = DAL.con()) { var item = TruyThuDal.SelectById(con, Convert.ToInt64(Id)); item.Duyet = true; item.NgayDuyet = DateTime.Now; item.LanhDaoDuyet = Security.Username; item.SoChuyenDuocDuyet = Convert.ToInt16(soChuyenDuocDuyet); item.YKienChiDao = yKienChiDao; item.NgayCapNhat = item.NgayDuyet; item.TrangThai = 2; item = TruyThuDal.Update(item); var phoi = PhoiDal.SelectById(con, item.PHOI_ID); phoi.PHI_TruyThuGiam = phoi.PhiMotChuyenTruyThu * (phoi.ChuyenTruyThu - Convert.ToInt16(soChuyenDuocDuyet)); //phoi.PHI_Tong = phoi.PHI_Tong - phoi.PHI_TruyThuGiam; phoi.NgayCapNhat = item.NgayDuyet; PhoiDal.Update(phoi); var xvb = XeVaoBenDal.SelectByPhoiId(con, phoi.ID); xvb.TrangThai = 510; xvb.NgayCapNhat = DateTime.Now; xvb.NguoiDuyetTruyThu = Security.Username; xvb.NgayLanhDaoDuyetTruyThu = item.NgayDuyet; xvb = XeVaoBenDal.Update(xvb); rendertext(Id); } } break; case "nhaXeChapNhan": if (loggedIn && !string.IsNullOrEmpty(Id)) { using (var con = DAL.con()) { var item = TruyThuDal.SelectById(con, Convert.ToInt64(Id)); item.TrangThai = 4; item.NgayCapNhat = DateTime.Now; item = TruyThuDal.Update(item); // Duyệt toàn bộ chấm công ChamCongDal.UpdateDuyetByTruyThuId(con, item.ID); var phoi = PhoiDal.SelectById(con, item.PHOI_ID); if (!string.IsNullOrEmpty(PHI_ConNo)) { phoi.PHI_ConNo = Convert.ToDouble(PHI_ConNo); } if (!string.IsNullOrEmpty(PHI_Nop)) { phoi.PHI_Nop = Convert.ToDouble(PHI_Nop); } phoi.NgayCapNhat = DateTime.Now; PhoiDal.Update(phoi); var xvb = XeVaoBenDal.SelectByPhoiId(con, item.PHOI_ID); xvb.TrangThai = 400; xvb.NgayCapNhat = DateTime.Now; xvb.NguoiDuyetTruyThu = Security.Username; xvb.NgayLanhDaoDuyetTruyThu = item.NgayDuyet; xvb = XeVaoBenDal.Update(xvb); rendertext(Id); } } break; case "khongDuyet": if (loggedIn && !string.IsNullOrEmpty(Id)) { using (var con = DAL.con()) { var item = TruyThuDal.SelectById(con, Convert.ToInt64(Id)); item.Duyet = true; item.NgayDuyet = DateTime.Now; item.LanhDaoDuyet = Security.Username; item.SoChuyenDuocDuyet = Convert.ToInt16(soChuyenDuocDuyet); item.YKienChiDao = yKienChiDao; item.NgayCapNhat = DateTime.Now; item.TrangThai = 2; item = TruyThuDal.Update(item); var phoi = PhoiDal.SelectById(con, item.PHOI_ID); phoi.NgayCapNhat = item.NgayDuyet; PhoiDal.Update(phoi); var xvb = XeVaoBenDal.SelectByPhoiId(con, phoi.ID); xvb.TrangThai = 510; xvb.NgayCapNhat = DateTime.Now; xvb.NguoiDuyetTruyThu = Security.Username; xvb.NgayLanhDaoDuyetTruyThu = item.NgayDuyet; xvb = XeVaoBenDal.Update(xvb); rendertext(Id); } } break; case "nhaXeKienNghi": if (loggedIn && !string.IsNullOrEmpty(Id)) { using (var con = DAL.con()) { var item = TruyThuDal.SelectById(con, Convert.ToInt64(Id)); item.NgayCapNhat = DateTime.Now; item.TrangThai = 3; item.Duyet = false; item.KienNghi = KienNghi; item = TruyThuDal.Update(item); var phoi = PhoiDal.SelectById(item.PHOI_ID); phoi.PHI_TruyThuGiam = 0; phoi.NgayCapNhat = DateTime.Now; PhoiDal.Update(phoi); var xvb = XeVaoBenDal.SelectByPhoiId(con, item.PHOI_ID); xvb.TrangThai = 500; xvb.NgayCapNhat = DateTime.Now; xvb = XeVaoBenDal.Update(xvb); rendertext(Id); } } break; case "huyTruyThu": if (loggedIn && !string.IsNullOrEmpty(Id)) { using (var con = DAL.con()) { var item = TruyThuDal.SelectById(con, Convert.ToInt64(Id)); item.NgayCapNhat = DateTime.Now; item.TrangThai = 5; item.Duyet = false; item = TruyThuDal.Update(item); // Xóa bỏ hết chấm công ChamCongDal.DeleteByTruyThuId(item.ID); PhoiDal.DeleteById(item.PHOI_ID); var xvb = XeVaoBenDal.SelectByPhoiId(con, item.PHOI_ID); xvb.TrangThai = 200; xvb.NgayCapNhat = DateTime.Now; xvb = XeVaoBenDal.Update(xvb); rendertext(Id); } } break; case "remove": #region remove if (loggedIn) { var Item = TruyThuDal.SelectById(Convert.ToInt32(Id)); if (Item.Username == Security.Username) { TruyThuDal.DeleteById(Item.ID); rendertext("0"); } } rendertext("-1"); break; #endregion default: break; } }