Ejemplo n.º 1
0
        public static ThuChi Insert(ThuChi item)
        {
            var Item = new ThuChi();
            var obj  = new SqlParameter[19];

            obj[1] = new SqlParameter("TC_CQ_ID", item.CQ_ID);
            obj[2] = new SqlParameter("TC_GIAOCA_ID", item.GIAOCA_ID);
            obj[3] = new SqlParameter("TC_XVB_ID", item.XVB_ID);
            obj[4] = new SqlParameter("TC_STTBX", item.STTBX);
            obj[5] = new SqlParameter("TC_STTALL", item.STTALL);
            obj[6] = new SqlParameter("TC_XE_ID", item.XE_ID);
            obj[7] = new SqlParameter("TC_Tien", item.Tien);
            obj[8] = new SqlParameter("TC_MoTa", item.MoTa);
            obj[9] = new SqlParameter("TC_Ngay", item.Ngay);
            if (item.Ngay > DateTime.MinValue)
            {
                obj[9] = new SqlParameter("TC_Ngay", item.Ngay);
            }
            else
            {
                obj[9] = new SqlParameter("TC_Ngay", DBNull.Value);
            }
            obj[10] = new SqlParameter("TC_NgayTao", item.NgayTao);
            if (item.NgayTao > DateTime.MinValue)
            {
                obj[10] = new SqlParameter("TC_NgayTao", item.NgayTao);
            }
            else
            {
                obj[10] = new SqlParameter("TC_NgayTao", DBNull.Value);
            }
            obj[11] = new SqlParameter("TC_NguoiTao", item.NguoiTao);
            obj[12] = new SqlParameter("TC_NgayCapNhat", item.NgayCapNhat);
            if (item.NgayCapNhat > DateTime.MinValue)
            {
                obj[12] = new SqlParameter("TC_NgayCapNhat", item.NgayCapNhat);
            }
            else
            {
                obj[12] = new SqlParameter("TC_NgayCapNhat", DBNull.Value);
            }
            obj[13] = new SqlParameter("TC_NguoiCapNhat", item.NguoiCapNhat);
            obj[14] = new SqlParameter("TC_NDTC_ID", item.NDTC_ID);
            obj[15] = new SqlParameter("TC_Thu", item.Thu);
            obj[16] = new SqlParameter("TC_PHOI_ID", item.PHOI_ID);
            obj[17] = new SqlParameter("TC_TRUYTHU_ID", item.TRUYTHU_ID);
            obj[18] = new SqlParameter("TC_RowId", item.RowId);

            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblBx_ThuChi_Insert_InsertNormal_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
Ejemplo n.º 2
0
        public static ThuChi SelectByLastest(SqlConnection con, Int32 CQ_ID)
        {
            var Item = new ThuChi();
            var obj  = new SqlParameter[1];

            obj[0] = new SqlParameter("CQ_ID", CQ_ID);
            using (IDataReader rd = SqlHelper.ExecuteReader(con, CommandType.StoredProcedure, "sp_tblBx_ThuChi_Select_SelectByLastest_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
Ejemplo n.º 3
0
        public static ThuChi SelectByDraff(SqlConnection con, bool Thu)
        {
            var Item = new ThuChi();
            var obj  = new SqlParameter[3];

            obj[0] = new SqlParameter("Thu", Thu);
            using (IDataReader rd = SqlHelper.ExecuteReader(con, CommandType.StoredProcedure, "sp_tblThuChi_Select_SelectDraff_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
Ejemplo n.º 4
0
        public static ThuChi getFromReader(IDataReader rd)
        {
            var Item = new ThuChi();

            if (rd.FieldExists("TC_ID"))
            {
                Item.ID = (Int64)(rd["TC_ID"]);
            }
            if (rd.FieldExists("TC_CQ_ID"))
            {
                Item.CQ_ID = (Int32)(rd["TC_CQ_ID"]);
            }
            if (rd.FieldExists("TC_GIAOCA_ID"))
            {
                Item.GIAOCA_ID = (Int32)(rd["TC_GIAOCA_ID"]);
            }
            if (rd.FieldExists("TC_XVB_ID"))
            {
                Item.XVB_ID = (Int64)(rd["TC_XVB_ID"]);
            }
            if (rd.FieldExists("TC_STTBX"))
            {
                Item.STTBX = (Int64)(rd["TC_STTBX"]);
            }
            if (rd.FieldExists("TC_STTALL"))
            {
                Item.STTALL = (Int64)(rd["TC_STTALL"]);
            }
            if (rd.FieldExists("TC_Tien"))
            {
                Item.Tien = (Double)(rd["TC_Tien"]);
            }
            if (rd.FieldExists("TC_MoTa"))
            {
                Item.MoTa = (String)(rd["TC_MoTa"]);
            }
            if (rd.FieldExists("TC_Ngay"))
            {
                Item.Ngay = (DateTime)(rd["TC_Ngay"]);
            }
            if (rd.FieldExists("TC_NgayTao"))
            {
                Item.NgayTao = (DateTime)(rd["TC_NgayTao"]);
            }
            if (rd.FieldExists("TC_NguoiTao"))
            {
                Item.NguoiTao = (String)(rd["TC_NguoiTao"]);
            }
            if (rd.FieldExists("TC_NgayCapNhat"))
            {
                Item.NgayCapNhat = (DateTime)(rd["TC_NgayCapNhat"]);
            }
            if (rd.FieldExists("TC_NguoiCapNhat"))
            {
                Item.NguoiCapNhat = (String)(rd["TC_NguoiCapNhat"]);
            }
            if (rd.FieldExists("TC_NDTC_ID"))
            {
                Item.NDTC_ID = (Guid)(rd["TC_NDTC_ID"]);
            }
            if (rd.FieldExists("TC_Thu"))
            {
                Item.Thu = (Boolean)(rd["TC_Thu"]);
            }
            if (rd.FieldExists("TC_PHOI_ID"))
            {
                Item.PHOI_ID = (Int64)(rd["TC_PHOI_ID"]);
            }
            if (rd.FieldExists("TC_TRUYTHU_ID"))
            {
                Item.TRUYTHU_ID = (Int64)(rd["TC_TRUYTHU_ID"]);
            }
            if (rd.FieldExists("TC_RowId"))
            {
                Item.RowId = (Guid)(rd["TC_RowId"]);
            }
            if (rd.FieldExists("NguoiTao_Ten"))
            {
                Item.NguoiTao_Ten = (String)(rd["NguoiTao_Ten"]);
            }
            if (rd.FieldExists("TC_XE_ID"))
            {
                Item.XE_ID = (Int64)(rd["TC_XE_ID"]);
            }
            if (rd.FieldExists("XE_BienSo"))
            {
                Item.XE_BienSo = (String)(rd["XE_BienSo"]);
            }
            return(Item);
        }
Ejemplo n.º 5
0
        public static ThuChi getFromReader(IDataReader rd)
        {
            var Item = new ThuChi();

            if (rd.FieldExists("TC_ID"))
            {
                Item.ID = (Guid)(rd["TC_ID"]);
            }
            if (rd.FieldExists("TC_NDTC_ID"))
            {
                Item.NDTC_ID = (Guid)(rd["TC_NDTC_ID"]);
            }
            if (rd.FieldExists("TC_CQ_ID"))
            {
                Item.CQ_ID = (Int32)(rd["TC_CQ_ID"]);
            }
            if (rd.FieldExists("TC_MaPhieu"))
            {
                Item.MaPhieu = (String)(rd["TC_MaPhieu"]);
            }
            if (rd.FieldExists("TC_SoPhieu"))
            {
                Item.SoPhieu = (Int32)(rd["TC_SoPhieu"]);
            }
            if (rd.FieldExists("TC_SoPhieuAll"))
            {
                Item.SoPhieuAll = (Int32)(rd["TC_SoPhieuAll"]);
            }
            if (rd.FieldExists("TC_SoTien"))
            {
                Item.SoTien = (Double)(rd["TC_SoTien"]);
            }
            if (rd.FieldExists("TC_Mota"))
            {
                Item.Mota = (String)(rd["TC_Mota"]);
            }
            if (rd.FieldExists("TC_NgayTrenPhieu"))
            {
                Item.NgayTrenPhieu = (DateTime)(rd["TC_NgayTrenPhieu"]);
            }
            if (rd.FieldExists("TC_NgayTao"))
            {
                Item.NgayTao = (DateTime)(rd["TC_NgayTao"]);
            }
            if (rd.FieldExists("TC_NguoiTao"))
            {
                Item.NguoiTao = (Int32)(rd["TC_NguoiTao"]);
            }
            if (rd.FieldExists("TC_NgayCapNhat"))
            {
                Item.NgayCapNhat = (DateTime)(rd["TC_NgayCapNhat"]);
            }
            if (rd.FieldExists("TC_NguoiCapNhat"))
            {
                Item.NguoiCapNhat = (Int32)(rd["TC_NguoiCapNhat"]);
            }
            if (rd.FieldExists("TC_LoaiQuy"))
            {
                Item.LoaiQuy = (Int32)(rd["TC_LoaiQuy"]);
            }
            if (rd.FieldExists("TC_LoaiCandoi"))
            {
                Item.LoaiCandoi = (Int32)(rd["TC_LoaiCandoi"]);
            }
            if (rd.FieldExists("TC_isCandoi"))
            {
                Item.isCandoi = (Boolean)(rd["TC_isCandoi"]);
            }
            if (rd.FieldExists("TC_Thu"))
            {
                Item.Thu = (Boolean)(rd["TC_Thu"]);
            }
            if (rd.FieldExists("TC_XN_ID"))
            {
                Item.XN_ID = (Guid)(rd["TC_XN_ID"]);
            }
            if (rd.FieldExists("TC_P_ID"))
            {
                Item.P_ID = (Guid)(rd["TC_P_ID"]);
            }
            if (rd.FieldExists("TC_PDV_ID"))
            {
                Item.PDV_ID = (Guid)(rd["TC_PDV_ID"]);
            }
            if (rd.FieldExists("TC_CTV_ID"))
            {
                Item.CTV_ID = (Guid)(rd["TC_CTV_ID"]);
            }
            if (rd.FieldExists("TC_PGV_ID"))
            {
                Item.PGV_ID = (Guid)(rd["TC_PGV_ID"]);
            }
            if (rd.FieldExists("TC_PBH_ID"))
            {
                Item.PBH_ID = (Guid)(rd["TC_PBH_ID"]);
            }
            if (rd.FieldExists("TC_Xoa"))
            {
                Item.Xoa = (Boolean)(rd["TC_Xoa"]);
            }
            if (rd.FieldExists("TC_XoaAdm"))
            {
                Item.XoaAdm = (Boolean)(rd["TC_XoaAdm"]);
            }

            if (rd.FieldExists("CTV_Ma"))
            {
                Item.CTV_Ma = (Int32)(rd["CTV_Ma"]);
            }

            if (rd.FieldExists("PGV_Ma"))
            {
                Item.PGV_Ma = (Int32)(rd["PGV_Ma"]);
            }

            if (rd.FieldExists("PDV_Ma"))
            {
                Item.PDV_Ma = (Int32)(rd["PDV_Ma"]);
            }
            if (rd.FieldExists("PBH_Ma"))
            {
                Item.PBH_Ma = (Int32)(rd["PBH_Ma"]);
            }
            if (rd.FieldExists("P_Ten"))
            {
                Item.P_Ten = (String)(rd["P_Ten"]);
                if (!string.IsNullOrEmpty(Item.P_Ten) && Item.P_ID != Guid.Empty)
                {
                    Item.P_Ten = maHoa.DecryptString(Item.P_Ten, Item.P_ID.ToString());
                }
            }
            if (rd.FieldExists("NDTC_Ten"))
            {
                Item.NDTC_Ten = (String)(rd["NDTC_Ten"]);
            }
            if (rd.FieldExists("NguoiTao_Ten"))
            {
                Item.NguoiTao_Ten = (String)(rd["NguoiTao_Ten"]);
            }
            if (rd.FieldExists("NguoiCapNhat_Ten"))
            {
                Item.NguoiCapNhat_Ten = (String)(rd["NguoiCapNhat_Ten"]);
            }
            return(Item);
        }
Ejemplo n.º 6
0
        public static ThuChi Update(ThuChi item)
        {
            var Item = new ThuChi();
            var obj  = new SqlParameter[25];

            obj[0] = new SqlParameter("TC_ID", item.ID);
            obj[1] = new SqlParameter("TC_NDTC_ID", item.NDTC_ID);
            obj[2] = new SqlParameter("TC_CQ_ID", item.CQ_ID);
            obj[3] = new SqlParameter("TC_MaPhieu", item.MaPhieu);
            obj[4] = new SqlParameter("TC_SoPhieu", item.SoPhieu);
            obj[5] = new SqlParameter("TC_SoPhieuAll", item.SoPhieuAll);
            obj[6] = new SqlParameter("TC_SoTien", item.SoTien);
            obj[7] = new SqlParameter("TC_Mota", item.Mota);
            if (item.NgayTrenPhieu > DateTime.MinValue)
            {
                obj[8] = new SqlParameter("TC_NgayTrenPhieu", item.NgayTrenPhieu);
            }
            else
            {
                obj[8] = new SqlParameter("TC_NgayTrenPhieu", DBNull.Value);
            }
            if (item.NgayTao > DateTime.MinValue)
            {
                obj[9] = new SqlParameter("TC_NgayTao", item.NgayTao);
            }
            else
            {
                obj[9] = new SqlParameter("TC_NgayTao", DBNull.Value);
            }
            obj[10] = new SqlParameter("TC_NguoiTao", item.NguoiTao);
            if (item.NgayCapNhat > DateTime.MinValue)
            {
                obj[11] = new SqlParameter("TC_NgayCapNhat", item.NgayCapNhat);
            }
            else
            {
                obj[11] = new SqlParameter("TC_NgayCapNhat", DBNull.Value);
            }
            obj[12] = new SqlParameter("TC_NguoiCapNhat", item.NguoiCapNhat);
            obj[13] = new SqlParameter("TC_LoaiQuy", item.LoaiQuy);
            obj[14] = new SqlParameter("TC_LoaiCandoi", item.LoaiCandoi);
            obj[15] = new SqlParameter("TC_isCandoi", item.isCandoi);
            obj[16] = new SqlParameter("TC_Thu", item.Thu);
            obj[17] = new SqlParameter("TC_XN_ID", item.XN_ID);
            obj[18] = new SqlParameter("TC_P_ID", item.P_ID);
            obj[19] = new SqlParameter("TC_PDV_ID", item.PDV_ID);
            obj[20] = new SqlParameter("TC_CTV_ID", item.CTV_ID);
            obj[21] = new SqlParameter("TC_PGV_ID", item.PGV_ID);
            obj[22] = new SqlParameter("TC_PBH_ID", item.PBH_ID);
            obj[23] = new SqlParameter("TC_Xoa", item.Xoa);
            obj[24] = new SqlParameter("TC_XoaAdm", item.XoaAdm);

            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblThuChi_Update_UpdateNormal_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }