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 xeId = Request["XE_ID"]; var idNull = string.IsNullOrEmpty(id); var chamCongs = new List <ChamCong>(); using (var con = DAL.con()) { if (!idNull) { var thuNo = ThuNoDal.SelectById(con, Convert.ToInt64(id)); chamCongs = ChamCongDal.NoByXeTuNgay(con, null, id, thuNo.XE_ID); Item = ThuNoDal.SelectById(Convert.ToInt64(id)); var xe = XeDal.SelectById(con, Convert.ToInt64(Item.XE_ID)); Item.XE_BienSo = xe.BienSoStr; Item.XE_ID = xe.ID; } else { Item = ThuNoDal.SelectByLastest(con, Security.CqId); if (!string.IsNullOrEmpty(xeId)) { chamCongs = ChamCongDal.NoByXeTuNgay(con, null, null, Convert.ToInt64(xeId)); var xe = XeDal.SelectById(con, Convert.ToInt64(xeId)); Item.XE_BienSo = xe.BienSoStr; Item.XE_ID = xe.ID; } } ThuNoItem.ChamCongs = chamCongs; ThuNoItem.Item = Item; } }
protected void Page_Load(object sender, EventArgs e) { var id = Request["ID"]; Item = string.IsNullOrEmpty(id) ? new Xe() : XeDal.SelectById(Convert.ToInt32(id)); Add.Item = Item; }
protected void Page_Load(object sender, EventArgs e) { var XE_ID = Request["XE_ID"]; var PHOI_ID = Request["PHOI_ID"]; if (!string.IsNullOrEmpty(XE_ID)) { var month = DateTime.Now.Month; var year = DateTime.Now.Year; var prevMonth = month == 1 ? 12 : month - 1; var tuNgay = new DateTime(year, prevMonth, 1).AddMonths(-2); var Xe = XeDal.SelectById(Convert.ToInt64(XE_ID)); var loaiBieuDo = LoaiBieuDoDal.SelectById(Xe.BIEUDO_ID); var chamCongList = ChamCongDal.SelectByXeTuNgay(PHOI_ID, tuNgay.ToString("dd/MM/yyyy"), Xe.ID); var chamCongListCurrent = new List <ChamCong>(); var phoi = new Phoi() { XE_ID = Xe.ID }; phoi.Xe = Xe; ChamCongCalendar_View.Item = phoi; ChamCongCalendar_View.NgayXuatBen = DateTime.Now.ToString("dd/MM/yyyy"); ChamCongCalendar_View.ListChamCong = chamCongList; ChamCongCalendar_View.ListChamCongCurrent = chamCongListCurrent; ChamCongCalendar_View.LoaiBieuDo = loaiBieuDo; ChamCongCalendar_View.Visible = true; ChamCongCalendar_View.TuNgay = tuNgay; ChamCongCalendar_View.DenNgay = DateTime.Now; ChamCongCalendar_View.ShowFullMonth = true; } }
protected void Page_Load(object sender, EventArgs e) { var Id = Request["ID"]; using (var con = DAL.con()) { Item = TruyThuDal.SelectById(con, Convert.ToInt64(Id)); var phoi = PhoiDal.SelectById(con, Item.PHOI_ID); var Xe = XeDal.SelectById(con, Item.XE_ID); var Tuyen = TuyenDal.SelectById(con, Xe.TUYEN_ID); var LaiXe = LaiXeDal.SelectById(con, phoi.LAIXE_ID); Xe.Tuyen = Tuyen; phoi.Xe = Xe; phoi.LaiXe = LaiXe; Item.Phoi = phoi; Add.Item = Item; } }
protected void Page_Load(object sender, EventArgs e) { var id = Request["ID"]; var idNull = string.IsNullOrEmpty(id); using (var con = DAL.con()) { if (idNull) { Item = ThuChiDal.SelectByLastest(con, Security.CqId); } else { Item = ThuChiDal.SelectById(con, Convert.ToInt64(id)); var phoi = PhoiDal.SelectById(Item.PHOI_ID); var xe = XeDal.SelectById(phoi.XE_ID); phoi.Xe = xe; Item.Phoi = phoi; } } ThuCapPhoiAdd.Item = Item; }
protected void Page_Load(object sender, EventArgs e) { var Id = Request["ID"]; using (var con = DAL.con()) { Item = TruyThuDal.SelectById(con, Convert.ToInt64(Id)); var phoi = PhoiDal.SelectById(con, Item.PHOI_ID); var Xe = XeDal.SelectById(con, Item.XE_ID); var Tuyen = TuyenDal.SelectById(con, Xe.TUYEN_ID); var LaiXe = LaiXeDal.SelectById(con, phoi.LAIXE_ID); var chamCong = ChamCongDal.SelectByTruyThuId(con, Item.ID).Where(x => x.Loai != 1 && x.Loai != 2) .OrderBy(x => x.Ngay).ToList(); Xe.Tuyen = Tuyen; phoi.Xe = Xe; phoi.LaiXe = LaiXe; Item.Phoi = phoi; Add.Item = Item; Add.List = chamCong; Add.Phoi = phoi; } }
protected void Page_Load(object sender, EventArgs e) { var XE_ID = Request["XE_ID"]; var PHOI_ID = Request["PHOI_ID"]; if (!string.IsNullOrEmpty(XE_ID)) { 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 Xe = XeDal.SelectById(Convert.ToInt64(XE_ID)); var LoaiBieuDo = LoaiBieuDoDal.SelectById(Xe.BIEUDO_ID); var chamCongList = ChamCongDal.SelectByXeTuNgay(PHOI_ID, tuNgay.ToString("dd/MM/yyyy"), Xe.ID); var chamCongListCurrent = new List <ChamCong>(); ChamCongCalendar_View.ListChamCong = chamCongList; ChamCongCalendar_View.ListChamCongCurrent = chamCongListCurrent; ChamCongCalendar_View.LoaiBieuDo = LoaiBieuDo; ChamCongCalendar_View.Visible = true; BieuDo = LoaiBieuDo; } }
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 XE_ID = Request["XE_ID"]; var PHOI_ID = Request["PHOI_ID"]; var NgayXuatBen = Request["NgayXuatBen"]; var Ngay = Request["Ngay"]; var TangCuong = Request["TangCuong"]; var PhoiId = Request["PhoiId"]; var CHAMCONG_ID = Request["CHAMCONG_ID"]; var CHAMCONG_GhiChu = Request["CHAMCONG_GhiChu"]; var CHAMCONG_Tien = Request["CHAMCONG_Tien"]; var CHAMCONG_TrangThaiNo = Request["CHAMCONG_TrangThaiNo"]; var ChamCongTruyChuCkb = Request["ChamCongTruyChuCkb"]; var GhiChu = Request["GhiChu"]; var Loai = Request["Loai"]; Loai = string.IsNullOrEmpty(Loai) ? "4" : "3"; if (string.IsNullOrEmpty(NgayXuatBen)) { NgayXuatBen = DateTime.Now.ToString("dd/MM/yyyy"); } var q = Request["q"]; switch (subAct) { case "BangChamCongTheoXe": #region BangChamCongTheoXe if (!string.IsNullOrEmpty(XE_ID)) { using (var con = DAL.con()) { var month = DateTime.Now.Month; var year = DateTime.Now.Year; var prevMonth = month == 1 ? 12 : month - 1; var tuNgay = new DateTime(year, prevMonth, 1); var Xe = XeDal.SelectById(con, Convert.ToInt64(XE_ID)); var loaiBieuDo = LoaiBieuDoDal.SelectById(con, Xe.BIEUDO_ID); var chamCongList = ChamCongDal.SelectByXeTuNgay(con, PHOI_ID, tuNgay.ToString("dd/MM/yyyy"), Xe.ID); var chamCongListCurrent = new List <ChamCong>(); var phoi = new Phoi() { XE_ID = Xe.ID }; phoi.Xe = Xe; ChamCongCalendar_View.Item = phoi; ChamCongCalendar_View.NgayXuatBen = NgayXuatBen; ChamCongCalendar_View.ListChamCong = chamCongList; ChamCongCalendar_View.ListChamCongCurrent = chamCongListCurrent; ChamCongCalendar_View.LoaiBieuDo = loaiBieuDo; ChamCongCalendar_View.Visible = true; ChamCongCalendar_View.TuNgay = tuNgay; ChamCongCalendar_View.DenNgay = DateTime.Now; } } break; #endregion case "LuuChamCongDraff": #region LuuChamCongDraff if (!string.IsNullOrEmpty(PhoiId) && loggedIn) { var item = new ChamCong(); item.PHOI_ID = Convert.ToInt64(PhoiId); item.Ngay = Convert.ToDateTime(Ngay, new CultureInfo("Vi-vn")); item.TangCuong = Convert.ToBoolean(TangCuong); item.Draff = true; item.NgayTao = DateTime.Now; item.Username = Security.Username; item.CQ_ID = Security.CqId; item.Loai = 3; item = ChamCongDal.Insert(item); AddPhoiListItem.Item = item; AddPhoiListItem.Visible = true; } break; #endregion case "UpdateChamCongDraff": #region UpdateChamCongDraff if (!string.IsNullOrEmpty(Id) && loggedIn) { var item = ChamCongDal.SelectById(Convert.ToInt64(Id)); item.GhiChu = GhiChu; if (!string.IsNullOrEmpty(ChamCongTruyChuCkb)) { item.Loai = 3; } else { item.Loai = 2; } item.NgayCapNhat = DateTime.Now; ChamCongDal.Update(item); } break; #endregion case "XoaChamCongDraff": #region XoaChamCongDraff if (!string.IsNullOrEmpty(Id) && loggedIn) { ChamCongDal.DeleteById(Convert.ToInt64(Id)); } break; #endregion case "BangCongNoTheoXe": #region BangCongNoTheoXe if (!string.IsNullOrEmpty(XE_ID)) { var chamCongList = ChamCongDal.NoByXeTuNgay(DAL.con(), null, Convert.ToInt64(XE_ID)); ThuNoList.XE_ID = XE_ID; ThuNoList.List = chamCongList; ThuNoList.Visible = chamCongList.Any(); } break; #endregion case "updateAjaxTruyThuDuyetKetQua": #region updateAjaxTruyThuDuyetKetQua if (loggedIn && !string.IsNullOrEmpty(CHAMCONG_ID)) { var item = ChamCongDal.SelectById(Convert.ToInt64(CHAMCONG_ID)); if (!string.IsNullOrEmpty(CHAMCONG_Tien)) { item.Tien = CHAMCONG_Tien.ToMoney(); } item.TrangThaiNo = Convert.ToInt16(string.IsNullOrEmpty(CHAMCONG_TrangThaiNo) ? 2 : 1); item.NgayCapNhat = DateTime.Now; item.GhiChu = CHAMCONG_GhiChu; item.Loai = Convert.ToInt16(Loai); item = ChamCongDal.Update(item); rendertext(item.ID.ToString()); } rendertext("0"); break; #endregion default: break; } }
protected void Page_Load(object sender, EventArgs e) { #region Variables var loggedIn = Security.IsAuthenticated(); var Id = Request["Id"]; var STTBX = Request["STTBX"]; var STTALL = Request["STTALL"]; var NgayXuatBen = Request["NgayXuatBen"]; var XE_BienSo = Request["XE_BienSo"]; var XE_ID = Request["XE_ID"]; var LAIXE_Ten = Request["LAIXE_Ten"]; var LAIXE_ID = Request["LAIXE_ID"]; var DONVI_Ten = Request["DONVI_Ten"]; var DI_Ten = Request["DI_Ten"]; var DEN_Ten = Request["DEN_Ten"]; var GioXuatBen = Request["GioXuatBen"]; var XeThayThe_BienSo = Request["XeThayThe_BienSo"]; var XeThayThe_ID = Request["XeThayThe_ID"]; var PHI_BenBai = Request["PHI_BenBai"]; var PHI_XeDauDem = Request["PHI_XeDauDem"]; var PHI_VeSinhBenBai = Request["PHI_VeSinhBenBai"]; var GiaVe = Request["GiaVe"]; var HoaHongBanVe = Request["HoaHongBanVe"]; var PhiTrenMotVe = Request["PhiTrenMotVe"]; var Ve = Request["Ve"]; var PHI_HoaHongBanVe = Request["PHI_HoaHongBanVe"]; var KhachTruyThu = Request["KhachTruyThu"]; var PHI_KhachTruyThu = Request["PHI_KhachTruyThu"]; var PHI_XeLuuBen = Request["PHI_XeLuuBen"]; var PHI_ChuyenTruyThu = Request["PHI_ChuyenTruyThu"]; var ChuyenTruyThu = Request["ChuyenTruyThu"]; var PHI_TruyThuGiam = Request["PHI_TruyThuGiam"]; var PHI_Khac = Request["PHI_Khac"]; var PHI_Tong = Request["PHI_Tong"]; var PHI_Nop = Request["PHI_Nop"]; var PHI_ConNo = Request["PHI_ConNo"]; var SoChuyenBieuDo = Request["SoChuyenBieuDo"]; var DeNghi = Request["DeNghi"]; var SoChuyenDeNghi = Request["SoChuyenDeNghi"]; var NOIDUNG_Ten = Request["NOIDUNG_Ten"]; var NOIDUNG_ID = Request["NOIDUNG_ID"]; var DANHGIA_Ten = Request["DANHGIA_Ten"]; var DANHGIA_ID = Request["DANHGIA_ID"]; var TRUYTHU_ID = Request["TRUYTHU_ID"]; var DeNghiCuaNhaXe = Request["DeNghiCuaNhaXe"]; var GiaTienDichVuTrongHopDong = Request["GiaTienDichVuTrongHopDong"]; var TongTruyThu = Request["TongTruyThu"]; var GiamTru = Request["GiamTru"]; var ConLai = Request["ConLai"]; var q = Request["q"]; var NgayChamCong = Request["NgayChamCong"]; var XVB_ID = Request["XVB_ID"]; var XeTangCuong = Request["XeTangCuong"]; var PHI_ChiThuBenBai = Request["PHI_ChiThuBenBai"]; var saveType = Request["saveType"]; var hopLe = Request["hopLe"]; var Draff = Request["Draff"]; var YKienQuanLy = Request["YKienQuanLy"]; XeTangCuong = !string.IsNullOrEmpty(XeTangCuong) ? "true" : "false"; PHI_ChiThuBenBai = !string.IsNullOrEmpty(PHI_ChiThuBenBai) ? "true" : "false"; var XeThayThe = Request["XeThayThe"]; XeThayThe = !string.IsNullOrEmpty(XeThayThe) ? "true" : "false"; #endregion var Inserted = Convert.ToBoolean(Draff); if (string.IsNullOrEmpty(saveType)) { saveType = ""; } switch (subAct) { case "save": #region save ///////////////////////////////////////// // Ý tưởng cơ bản là check số NgayChamCong != Null => Có truy thu. // Nếu số chuyến đề nghị =0 nghĩa là tự nguyện truy thu. Ngược lại là có phát sinh đề nghị truy thu. //////////////////////////////////////// if (!loggedIn || !string.IsNullOrEmpty(STTBX) || !string.IsNullOrEmpty(XE_BienSo)) { var Item = Inserted ? PhoiDal.SelectLastest(Security.CqId.ToString(), true) : PhoiDal.SelectById(Convert.ToInt64(Id)); if (Inserted && !string.IsNullOrEmpty(Id)) { Item.ID = Convert.ToInt64(Id); } if (!string.IsNullOrEmpty(NgayXuatBen)) { Item.NgayXuatBen = Convert.ToDateTime(NgayXuatBen, new CultureInfo("vi-vn")); } if (!string.IsNullOrEmpty(XE_ID)) { Item.XE_ID = Convert.ToInt64(XE_ID); var xe = XeDal.SelectById(Convert.ToInt64(XE_ID)); Item.DONVI_ID = xe.DONVI_ID; } if (!string.IsNullOrEmpty(LAIXE_ID)) { Item.LAIXE_ID = Convert.ToInt64(LAIXE_ID); } if (!string.IsNullOrEmpty(XeThayThe_ID)) { Item.XeThayThe_ID = Convert.ToInt64(XeThayThe_ID); } // PHI if (!string.IsNullOrEmpty(PHI_BenBai)) { Item.PHI_BenBai = Convert.ToDouble(PHI_BenBai); } if (!string.IsNullOrEmpty(PHI_XeDauDem)) { Item.PHI_XeDauDem = Convert.ToDouble(PHI_XeDauDem); } if (!string.IsNullOrEmpty(PHI_VeSinhBenBai)) { Item.PHI_VeSinhBenBai = Convert.ToDouble(PHI_VeSinhBenBai); } if (!string.IsNullOrEmpty(GiaVe)) { Item.GiaVe = Convert.ToDouble(GiaVe); } if (!string.IsNullOrEmpty(Ve)) { Item.Ve = Convert.ToInt16(Ve); } if (!string.IsNullOrEmpty(PHI_HoaHongBanVe)) { Item.PHI_HoaHongBanVe = Convert.ToDouble(PHI_HoaHongBanVe); } // Truy thu if (!string.IsNullOrEmpty(KhachTruyThu)) { Item.KhachTruyThu = Convert.ToInt16(KhachTruyThu); } if (!string.IsNullOrEmpty(PHI_KhachTruyThu)) { Item.PHI_KhachTruyThu = Convert.ToDouble(PHI_KhachTruyThu); } if (!string.IsNullOrEmpty(PHI_XeLuuBen)) { Item.PHI_XeLuuBen = Convert.ToDouble(PHI_XeLuuBen); } if (!string.IsNullOrEmpty(ChuyenTruyThu)) { Item.ChuyenTruyThu = Convert.ToInt16(ChuyenTruyThu); } if (!string.IsNullOrEmpty(PHI_ChuyenTruyThu)) { Item.PHI_ChuyenTruyThu = Convert.ToDouble(PHI_ChuyenTruyThu); } if (!string.IsNullOrEmpty(PHI_TruyThuGiam)) { Item.PHI_TruyThuGiam = Convert.ToDouble(PHI_TruyThuGiam); } if (!string.IsNullOrEmpty(PHI_Khac)) { Item.PHI_Khac = Convert.ToDouble(PHI_Khac); } Item.PHI_ChiThuBenBai = Convert.ToBoolean(PHI_ChiThuBenBai); Item.XeThayThe = Convert.ToBoolean(XeThayThe); Item.XeTangCuong = Convert.ToBoolean(XeTangCuong); Item.CQ_ID = Security.CqId; Item.PhiMotChuyenTruyThu = Item.PHI_ChiThuBenBai ? Item.PHI_BenBai : (Item.PHI_HoaHongBanVe + Item.PHI_BenBai); Item.NgayCapNhat = DateTime.Now; if (!string.IsNullOrEmpty(PHI_Tong)) { Item.PHI_Tong = Convert.ToDouble(PHI_Tong); } // !imporant giả định là cứ cấp phơi mặc định nộp đủ if (!string.IsNullOrEmpty(PHI_Tong)) { Item.PHI_Nop = Item.PHI_Tong; } //if (!string.IsNullOrEmpty(PHI_ConNo)) //{ // Item.PHI_ConNo = Convert.ToDouble(PHI_ConNo); //} // Trong trường hợp chỉ tiến hành Truy thu if (saveType.ToLower().Contains("truythu")) { Item.PHI_Tong = Item.PhiMotChuyenTruyThu * Item.ChuyenTruyThu; Item.PHI_Nop = Item.PHI_Tong; } Item.Draff = false; if (Inserted) { Item.Username = Security.Username; Item.NgayTao = DateTime.Now; Item.RowId = Guid.NewGuid(); //Update Ca làm việc var giaoCa = GiaoCaDal.Current(Security.CqId, Security.Username); Item.GIAOCA_ID = giaoCa.ID; giaoCa.TongSoPhoi += 1; giaoCa.DoanhThu += Item.PHI_Tong; giaoCa.NgayCapNhat = DateTime.Now; GiaoCaDal.Update(giaoCa); } Item = PhoiDal.Update(Item); var chamCong = new ChamCong(); if (Inserted) { if (!saveType.ToLower().Contains("truythu")) // Trong trường hợp không truy thu { // Thêm chấm công mới short loaiChamCong = 1; if (hopLe == "0") { loaiChamCong = 2; } chamCong.Loai = loaiChamCong; chamCong.Duyet = true; chamCong.Ngay = new DateTime(Item.NgayXuatBen.Year, Item.NgayXuatBen.Month, Item.NgayXuatBen.Day); chamCong.PHOI_ID = Item.ID; chamCong.XE_ID = Item.XE_ID; chamCong.CQ_ID = Security.CqId; chamCong.TrangThaiNo = 0; chamCong.NgayCapNhat = DateTime.Now; chamCong.Username = Security.Username; chamCong.NgayTao = DateTime.Now; chamCong.RowId = Guid.NewGuid(); chamCong.Draff = false; ChamCongDal.Insert(chamCong); } } var idTruyThuNull = string.IsNullOrEmpty(TRUYTHU_ID); var truyThu = idTruyThuNull ? TruyThuDal.SelectLastest(Security.CqId) : TruyThuDal.SelectById(Convert.ToInt64(TRUYTHU_ID)); if (!string.IsNullOrEmpty(DANHGIA_ID)) { truyThu.DANHGIA_ID = new Guid(DANHGIA_ID); } if (!string.IsNullOrEmpty(NOIDUNG_ID)) { truyThu.NOIDUNG_ID = new Guid(NOIDUNG_ID); } if (!string.IsNullOrEmpty(SoChuyenDeNghi)) { truyThu.SoChuyenDeNghi = Convert.ToInt16(SoChuyenDeNghi); } truyThu.SoChuyenThieu = Item.ChuyenTruyThu; truyThu.TongTruyThu = Item.PHI_ChuyenTruyThu; truyThu.Duyet = truyThu.SoChuyenDeNghi == 0; truyThu.CQ_ID = Security.CqId; truyThu.PHOI_ID = Item.ID; truyThu.DeNghiCuaNhaXe = DeNghiCuaNhaXe; truyThu.PHOI_ID = Item.ID; truyThu.XE_ID = Item.XE_ID; truyThu.DeNghi = truyThu.SoChuyenDeNghi != 0; truyThu.YKienQuanLy = YKienQuanLy; if (truyThu.DeNghi) { truyThu.TrangThai = 1; } else { truyThu.TrangThai = 0; } truyThu.NgayCapNhat = DateTime.Now; if (idTruyThuNull) { truyThu.Username = Security.Username; truyThu.NgayTao = DateTime.Now; truyThu.RowId = Guid.NewGuid(); truyThu.NguoiLap = Security.Username; truyThu = TruyThuDal.Insert(truyThu); } else { truyThu = TruyThuDal.Update(truyThu); ChamCongDal.DeleteByTruyThuId(Convert.ToInt64(TRUYTHU_ID)); } var chamCongByPhoiId = ChamCongDal.SelectByPhoiId(Item.ID); foreach (var item in chamCongByPhoiId) { item.Tien = Item.PhiMotChuyenTruyThu; item.XE_ID = Item.XE_ID; item.TRUYTHU_ID = truyThu.ID; item.NgayCapNhat = DateTime.Now; //item.Draff = false; ChamCongDal.Update(item); } // Xử lý phần XeVaoBen if (!string.IsNullOrEmpty(XVB_ID)) { var xvb = XeVaoBenDal.SelectById(Convert.ToInt64(XVB_ID)); xvb.NgayDuyetPhoi = xvb.NgayCapNhat = DateTime.Now; xvb.NguoiDuyetPhoi = Security.Username; xvb.PHOI_ID = Item.ID; xvb.Tien = Item.PHI_Tong; xvb.TrangThai = 400; if (truyThu.SoChuyenDeNghi > 0 && !truyThu.Duyet) // Có đề nghị truy thu và truy thu này chưa duyệt { xvb.TrangThai = 500; // Chờ duyệt truy thu } xvb.TRUYTHU_ID = truyThu.ID; XeVaoBenDal.Update(xvb); } else { var xvb = new XeVaoBen { TrangThai = 400 }; xvb.NgayDuyetPhoi = xvb.NgayCapNhat = DateTime.Now; xvb.NguoiDuyetPhoi = Security.Username; xvb.PHOI_ID = Item.ID; xvb.XE_ID = Item.XE_ID; xvb.Loai = 300; xvb.Username = Security.Username; xvb.CQ_ID = Security.CqId; xvb.TrangThai = 400; xvb.Tien = Item.PHI_Tong; if (truyThu.SoChuyenDeNghi > 0 && !truyThu.Duyet) // Có đề nghị truy thu và truy thu này chưa duyệt { xvb.TrangThai = 500; // Chờ duyệt truy thu } xvb.TRUYTHU_ID = truyThu.ID; XeVaoBenDal.Insert(xvb); } rendertext(Item.ID.ToString()); } rendertext("0"); break; #endregion case "getLatest": #region getLatest if (loggedIn) { var Item = PhoiDal.SelectLastest(Security.CqId.ToString()); rendertext(string.Format("({0})", JavaScriptConvert.SerializeObject(Item))); } rendertext("-1"); break; #endregion case "remove": #region remove if (loggedIn) { var Item = PhoiDal.SelectById(Convert.ToInt32(Id)); if (Item.Username == Security.Username) { PhoiDal.DeleteById(Item.ID); rendertext("0"); } } rendertext("-1"); break; #endregion default: break; } }
protected void Page_Load(object sender, EventArgs e) { var loggedIn = Security.IsAuthenticated(); var Id = Request["Id"]; var uname = Security.Username; switch (subAct) { case "GetNewers": if (loggedIn) { var list = XeVaoBenDal.ListTsLenPhoi(DAL.con(), Security.CqId, 100); if (list.Any()) { ListTodayAjax.List = list; ListTodayAjax.Visible = true; } else { rendertext(""); } } break; case "GetChoThanhToan": if (loggedIn) { var list = XeVaoBenDal.ListTsChoThanhToan(DAL.con(), Security.CqId, 100); if (list.Any()) { TS_XeChoThanhToanAjax.List = list; TS_XeChoThanhToanAjax.Visible = true; } else { rendertext(""); } } break; case "GetDaThanhToan": if (loggedIn) { var list = XeVaoBenDal.ListTsDaThanhToan(DAL.con(), Security.CqId, 100); if (list.Any()) { TS_XeDaThanhToanAjax.List = list; TS_XeDaThanhToanAjax.Visible = true; } else { rendertext(""); } } break; case "GetYeuCauThanhToan": if (loggedIn) { var list = XeVaoBenDal.ListTsChoThanhToan(DAL.con(), Security.CqId, 100).OrderByDescending(x => x.TrangThai). ThenByDescending(x => x.ID).ToList(); if (list.Any()) { AjaxListYeuCauThanhToanHangDoi.List = list; AjaxListYeuCauThanhToanHangDoi.Visible = true; } else { rendertext(""); } } break; case "ListDuyetDeNghiTruyThu": if (loggedIn) { var list = XeVaoBenDal.ListTruyThu(DAL.con(), Security.CqId, 100).OrderByDescending(x => x.TrangThai). ThenByDescending(x => x.ID).ToList(); if (list.Any()) { AjaxListDuyetDeNghiTruyThu.List = list; AjaxListDuyetDeNghiTruyThu.Visible = true; } else { rendertext(""); } } break; case "GetYeuCauXuLyListByUsername": if (loggedIn) { var list = XeVaoBenDal.ListTsLenPhoi(DAL.con(), Security.CqId, 100).OrderByDescending(x => x.TrangThai). ThenByDescending(x => x.XE_GioXuatBen).ToList(); if (!list.Any()) { rendertext(""); } AjaxListYeuCauXuLyHangDoi.List = list; AjaxListYeuCauXuLyHangDoi.Visible = true; } break; case "YeuCauXuLy": if (!string.IsNullOrEmpty(Id)) { var item = XeVaoBenDal.SelectById(Convert.ToInt64(Id)); item.TrangThai = 200; item.NgayYeuCauXuLy = item.NgayCapNhat = DateTime.Now; item = XeVaoBenDal.Update(item); } break; case "YeuCauXuatBen": if (!string.IsNullOrEmpty(Id)) { var item = XeVaoBenDal.SelectById(Convert.ToInt64(Id)); item.TrangThai = 820; item.NgayCapNhat = DateTime.Now; item = XeVaoBenDal.Update(item); } break; case "YeuCauThanhToan": if (!string.IsNullOrEmpty(Id)) { var item = XeVaoBenDal.SelectById(Convert.ToInt64(Id)); item.TrangThai = 600; item.NgayYeuCauThanhToan = item.NgayCapNhat = DateTime.Now; item = XeVaoBenDal.Update(item); } break; case "RestoreXeChuaXuLy": if (!string.IsNullOrEmpty(Id)) { var xvb = XeVaoBenDal.SelectById(Convert.ToInt64(Id)); xvb.TrangThai = 100; xvb.NgayCapNhat = DateTime.Now; xvb = XeVaoBenDal.Update(xvb); } break; case "RestoreXeChuaThanhToan": if (!string.IsNullOrEmpty(Id)) { var xvb = XeVaoBenDal.SelectById(Convert.ToInt64(Id)); xvb.TrangThai = 400; xvb.NgayCapNhat = DateTime.Now; xvb = XeVaoBenDal.Update(xvb); } break; case "NhanYeuCauThanhToan": if (!string.IsNullOrEmpty(Id)) { var xvb = XeVaoBenDal.SelectById(Convert.ToInt64(Id)); xvb.TrangThai = 700; xvb.NguoiNhanYeuCauThanhToan = Security.Username; xvb.NgayNhanYeuCauThanhToan = xvb.NgayCapNhat = DateTime.Now; xvb = XeVaoBenDal.Update(xvb); var thuChi = ThuChiDal.SelectByLastest(DAL.con(), Security.CqId); var phoi = PhoiDal.SelectById(xvb.PHOI_ID); var xe = XeDal.SelectById(phoi.XE_ID); thuChi.XeVaoBen = xvb; phoi.Xe = xe; thuChi.Phoi = phoi; rendertext(string.Format("({0})", JavaScriptConvert.SerializeObject(thuChi))); } break; case "GetCurrentCapPhoi": if (loggedIn) { var item = XeVaoBenDal.ListByCurrentCapPhoiByUser(DAL.con(), Security.CqId, Security.Username).FirstOrDefault(); if (item != null) { rendertext(string.Format("({0})", JavaScriptConvert.SerializeObject(item))); } rendertext(""); } break; case "GetCurrentThuCapPhoi": if (loggedIn) { var item = XeVaoBenDal.ListByCurrentThuCapPhoiByUser(DAL.con(), Security.CqId, Security.Username).FirstOrDefault(); if (item != null) { var thuChi = ThuChiDal.SelectByLastest(DAL.con(), Security.CqId); var phoi = PhoiDal.SelectById(item.PHOI_ID); var xe = XeDal.SelectById(phoi.XE_ID); thuChi.XeVaoBen = item; phoi.Xe = xe; thuChi.Phoi = phoi; rendertext(string.Format("({0})", JavaScriptConvert.SerializeObject(thuChi))); } rendertext(""); } break; default: break; } }
protected void Page_Load(object sender, EventArgs e) { var loggedIn = Security.IsAuthenticated(); var Id = Request["Id"]; var BienSo_Chu = Request["BienSo_Chu"]; var BienSo_So = Request["BienSo_So"]; var LOAIXE_ID = Request["LOAIXE_ID"]; var TUYEN_ID = Request["TUYEN_ID"]; var DONVI_ID = Request["DONVI_ID"]; var LOAIXE_Ten = Request["LOAIXE_Ten"]; var TUYEN_Ten = Request["TUYEN_Ten"]; var DONVI_Ten = Request["DONVI_Ten"]; var NamSanXuat = Request["NamSanXuat"]; var NgayXuatBen = Request["NgayXuatBen"]; var TuyenCoDinh = Request["TuyenCoDinh"]; var LuuHanh = Request["LuuHanh"]; var Ghe = Request["Ghe"]; var SoKhach = Request["SoKhach"]; var MucPhi = Request["MucPhi"]; var GiaVe = Request["GiaVe"]; var GioXuatBen = Request["GioXuatBen"]; var XeVangLai = Request["XeVangLai"]; var XeTai = Request["XeTai"]; var BaoHiem = Request["BaoHiem"]; var BIEUDO_ID = Request["BIEUDO_ID"]; var ChuaDangKy = Request["ChuaDangKy"]; var Khoa = Request["Khoa"]; var XVB_ID = Request["XVB_ID"]; var NgayKyGuiBanVe = Request["NgayKyGuiBanVe"]; var KyGuiBanVe = Request["KyGuiBanVe"]; var ChapThuanTuyen_SoChuyen = Request["ChapThuanTuyen_SoChuyen"]; var q = Request["q"]; //For search var VangLai = Request["XeVangLai"]; KyGuiBanVe = !string.IsNullOrEmpty(KyGuiBanVe) ? "true" : "false"; XeVangLai = !string.IsNullOrEmpty(XeVangLai) ? "true" : "false"; XeTai = !string.IsNullOrEmpty(XeTai) ? "true" : "false"; Khoa = !string.IsNullOrEmpty(Khoa) ? "true" : "false"; ChuaDangKy = !string.IsNullOrEmpty(ChuaDangKy) ? "true" : "false"; var Inserted = string.IsNullOrEmpty(Id); switch (subAct) { case "save": #region save if (!loggedIn || !string.IsNullOrEmpty(BienSo_Chu) || !string.IsNullOrEmpty(BienSo_So)) { var Item = Inserted ? new Xe() : XeDal.SelectById(Convert.ToInt32(Id)); Item.BienSo_Chu = BienSo_Chu; Item.BienSo_So = BienSo_So; Item.LOAIXE_ID = Convert.ToInt32(LOAIXE_ID); Item.TUYEN_ID = Convert.ToInt32(TUYEN_ID); Item.DONVI_ID = Convert.ToInt32(DONVI_ID); if (!string.IsNullOrEmpty(TuyenCoDinh)) { Item.TuyenCoDinh = Convert.ToDateTime(TuyenCoDinh, new CultureInfo("vi-vn")); } if (!string.IsNullOrEmpty(LuuHanh)) { Item.LuuHanh = Convert.ToDateTime(LuuHanh, new CultureInfo("vi-vn")); } if (!string.IsNullOrEmpty(BaoHiem)) { Item.BaoHiem = Convert.ToDateTime(BaoHiem, new CultureInfo("vi-vn")); } if (!string.IsNullOrEmpty(NgayKyGuiBanVe)) { Item.NgayKyGuiBanVe = Convert.ToDateTime(NgayKyGuiBanVe, new CultureInfo("vi-vn")); } if (!string.IsNullOrEmpty(ChapThuanTuyen_SoChuyen)) { Item.ChapThuanTuyen_SoChuyen = Convert.ToInt16(ChapThuanTuyen_SoChuyen); } Item.Ghe = Convert.ToInt16(Ghe); Item.SoKhach = Convert.ToInt16(SoKhach); Item.MucPhi = Convert.ToDouble(MucPhi); Item.GiaVe = Convert.ToDouble(GiaVe); Item.NamSanXuat = Convert.ToInt16(NamSanXuat); Item.GioXuatBen = GioXuatBen; Item.BIEUDO_ID = Convert.ToInt32(BIEUDO_ID); Item.XeTai = Convert.ToBoolean(XeTai); Item.XeVangLai = Convert.ToBoolean(XeVangLai); Item.Khoa = Convert.ToBoolean(Khoa); Item.KyGuiBanVe = Convert.ToBoolean(KyGuiBanVe); if (Item.ID != 0 && Item.ChuaDangKy && Convert.ToBoolean(ChuaDangKy)) // Đăng ký mới lần đầu { XeVaoBenDal.UpdateXeChuaDangKy(Item.ID); } Item.ChuaDangKy = !Convert.ToBoolean(ChuaDangKy); if (Inserted) { Item.Username = Security.Username; Item.NgayTao = DateTime.Now; Item.RowId = Guid.NewGuid(); //SearchManager.Add(string.Format("{0} {1}", Item.BienSo_Chu, Item.BienSo_So) // , string.Format("{0} {1} {2} {3} {4}", Item.BienSo_Chu, Item.BienSo_So, DONVI_Ten, TUYEN_Ten, LOAIXE_Ten) // , string.Format("{0} {1}", Item.BienSo_Chu, Item.BienSo_So) // , Item.RowId.ToString() // , Item.Url // , typeof(Xe).Name); } Item.NgayCapNhat = DateTime.Now; Item = Inserted ? XeDal.Insert(Item) : XeDal.Update(Item); rendertext(Item.ID.ToString()); } rendertext("0"); break; #endregion case "remove": #region remove if (loggedIn) { var Item = XeDal.SelectById(Convert.ToInt32(Id)); if (Item.Username == Security.Username) { XeDal.DeleteById(Item.ID); rendertext("0"); } } rendertext("-1"); break; #endregion case "GetById": #region GetById if (!string.IsNullOrEmpty(Id)) { var Item = XeDal.SelectById(Convert.ToInt32(Id)); Item.Tuyen = TuyenDal.SelectById(Item.TUYEN_ID); Item.LoaiBieuDo = LoaiBieuDoDal.SelectById(Item.BIEUDO_ID); Item.LaiXe = LaiXeDal.SelectByXeId(Item.ID); var ngay = DateTime.Now; if (!string.IsNullOrEmpty(NgayXuatBen)) { ngay = Convert.ToDateTime(ngay, new CultureInfo("Vi-vn")); } var ngaySoSanh = ngay.AddDays(BxVinhConfig.SoNgayHetHan); Item.HopLeAll = (ngaySoSanh < Item.BaoHiem) && (ngaySoSanh < Item.LuuHanh) && (ngaySoSanh < Item.BaoHiem); if (!string.IsNullOrEmpty(XVB_ID)) { var xvb = XeVaoBenDal.SelectById(Convert.ToInt64(XVB_ID)); xvb.TrangThai = 300; xvb.NguoiXuLyYeuCau = Security.Username; xvb.NgayXuLyYeuCau = xvb.NgayCapNhat = DateTime.Now; xvb = XeVaoBenDal.Update(xvb); } rendertext(string.Format("({0})", JavaScriptConvert.SerializeObject(Item))); } rendertext("-1"); break; #endregion case "search": #region search var pgResult = XeTinyDal.SearchSQL(q, VangLai); rendertext(JavaScriptConvert.SerializeObject(pgResult), "text/javascript"); break; #endregion default: break; } }