public static XuatNhap SelectByDraff(SqlConnection con) { var Item = new XuatNhap(); using (IDataReader rd = SqlHelper.ExecuteReader(con, CommandType.StoredProcedure, "sp_tblXuatNhapChiTiet_Select_SelectDraff_linhnx")) { while (rd.Read()) { Item = getFromReader(rd); } } return(Item); }
public static XuatNhap SelectTvDv(Guid TVDV_ID) { var Item = new XuatNhap(); var obj = new SqlParameter[1]; obj[0] = new SqlParameter("TVDV_ID", TVDV_ID); using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblXuatNhap_Select_SelectByTvDvId_linhnx", obj)) { while (rd.Read()) { Item = getFromReader(rd); } } return(Item); }
public static XuatNhap SelectByDraff(bool xuat) { var Item = new XuatNhap(); var obj = new SqlParameter[3]; obj[0] = new SqlParameter("Xuat", xuat); using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblXuatNhapChiTiet_Select_SelectDraff_linhnx", obj)) { while (rd.Read()) { Item = getFromReader(rd); } } return(Item); }
public static XuatNhap getFromReader(IDataReader rd) { var Item = new XuatNhap(); if (rd.FieldExists("XN_ID")) { Item.ID = (Guid)(rd["XN_ID"]); } if (rd.FieldExists("XN_GH_ID")) { Item.GH_ID = (Guid)(rd["XN_GH_ID"]); } if (rd.FieldExists("XN_LOAI_ID")) { Item.LOAI_ID = (Guid)(rd["XN_LOAI_ID"]); } if (rd.FieldExists("XN_Ma")) { Item.Ma = (String)(rd["XN_Ma"]); } if (rd.FieldExists("XN_KH_ID")) { Item.KH_ID = (Guid)(rd["XN_KH_ID"]); } if (rd.FieldExists("XN_NgayHoaDon")) { Item.NgayHoaDon = (DateTime)(rd["XN_NgayHoaDon"]); } if (rd.FieldExists("XN_NhanVien")) { Item.NhanVien = (String)(rd["XN_NhanVien"]); } if (rd.FieldExists("XN_CongTienHang")) { Item.CongTienHang = (Double)(rd["XN_CongTienHang"]); } if (rd.FieldExists("XN_DienGiai")) { Item.DienGiai = (String)(rd["XN_DienGiai"]); } if (rd.FieldExists("XN_VAT")) { Item.VAT = (Double)(rd["XN_VAT"]); } if (rd.FieldExists("XN_ThanhToan")) { Item.ThanhToan = (Double)(rd["XN_ThanhToan"]); } if (rd.FieldExists("XN_ConNo")) { Item.ConNo = (Double)(rd["XN_ConNo"]); } if (rd.FieldExists("XN_ChietKhau")) { Item.ChietKhau = (Double)(rd["XN_ChietKhau"]); } if (rd.FieldExists("XN_NgayTao")) { Item.NgayTao = (DateTime)(rd["XN_NgayTao"]); } if (rd.FieldExists("XN_NguoiTao")) { Item.NguoiTao = (String)(rd["XN_NguoiTao"]); } if (rd.FieldExists("XN_NgayCapNhat")) { Item.NgayCapNhat = (DateTime)(rd["XN_NgayCapNhat"]); } if (rd.FieldExists("XN_NguoiCapNhat")) { Item.NguoiCapNhat = (String)(rd["XN_NguoiCapNhat"]); } if (rd.FieldExists("XN_GhiChu")) { Item.GhiChu = (String)(rd["XN_GhiChu"]); } if (rd.FieldExists("KH_Ten")) { Item.KH_Ten = (String)(rd["KH_Ten"]); } if (rd.FieldExists("LOAI_Ten")) { Item.LOAI_Ten = (String)(rd["LOAI_Ten"]); } if (rd.FieldExists("XN_KHO_ID")) { Item.KHO_ID = (Guid)(rd["XN_KHO_ID"]); } if (rd.FieldExists("XN_KHO_Ten")) { Item.KHO_Ten = (String)(rd["XN_KHO_Ten"]); } if (rd.FieldExists("XN_Xuat")) { Item.Xuat = (Boolean)(rd["XN_Xuat"]); } if (rd.FieldExists("XN_TV_ID")) { Item.TVDV_ID = (Guid)(rd["XN_TVDV_ID"]); } if (rd.FieldExists("XN_DauKy")) { Item.DauKy = (Boolean)(rd["XN_DauKy"]); } if (rd.FieldExists("XN_NoiBo")) { Item.NoiBo = (Boolean)(rd["XN_NoiBo"]); } if (rd.FieldExists("XN_ChuyenDoi")) { Item.ChuyenDoi = (Boolean)(rd["XN_ChuyenDoi"]); } if (rd.FieldExists("XN_TuVanVien")) { Item.TuVanVien = (String)(rd["XN_TuVanVien"]); } Item._ThuChi = ThuChiDal.getFromReader(rd); return(Item); }
public static XuatNhap Update(XuatNhap item) { var Item = new XuatNhap(); var obj = new SqlParameter[25]; obj[0] = new SqlParameter("XN_ID", item.ID); obj[1] = new SqlParameter("XN_GH_ID", item.GH_ID); obj[2] = new SqlParameter("XN_LOAI_ID", item.LOAI_ID); obj[3] = new SqlParameter("XN_Ma", item.Ma); obj[4] = new SqlParameter("XN_KH_ID", item.KH_ID); if (item.NgayHoaDon > DateTime.MinValue) { obj[5] = new SqlParameter("XN_NgayHoaDon", item.NgayHoaDon); } else { obj[5] = new SqlParameter("XN_NgayHoaDon", DBNull.Value); } obj[6] = new SqlParameter("XN_NhanVien", item.NhanVien); obj[7] = new SqlParameter("XN_CongTienHang", item.CongTienHang); obj[8] = new SqlParameter("XN_DienGiai", item.DienGiai); obj[9] = new SqlParameter("XN_VAT", item.VAT); obj[10] = new SqlParameter("XN_ThanhToan", item.ThanhToan); obj[11] = new SqlParameter("XN_ConNo", item.ConNo); obj[12] = new SqlParameter("XN_ChietKhau", item.ChietKhau); if (item.NgayTao > DateTime.MinValue) { obj[13] = new SqlParameter("XN_NgayTao", item.NgayTao); } else { obj[13] = new SqlParameter("XN_NgayTao", DBNull.Value); } obj[14] = new SqlParameter("XN_NguoiTao", item.NguoiTao); if (item.NgayCapNhat > DateTime.MinValue) { obj[15] = new SqlParameter("XN_NgayCapNhat", item.NgayCapNhat); } else { obj[15] = new SqlParameter("XN_NgayCapNhat", DBNull.Value); } obj[16] = new SqlParameter("XN_NguoiCapNhat", item.NguoiCapNhat); obj[17] = new SqlParameter("XN_GhiChu", item.GhiChu); obj[18] = new SqlParameter("XN_KHO_ID", item.KHO_ID); obj[19] = new SqlParameter("XN_Xuat", item.Xuat); obj[20] = new SqlParameter("XN_TVDV_ID", item.TVDV_ID); obj[21] = new SqlParameter("XN_DauKy", item.DauKy); obj[22] = new SqlParameter("XN_NoiBo", item.NoiBo); obj[23] = new SqlParameter("XN_ChuyenDoi", item.ChuyenDoi); obj[24] = new SqlParameter("XN_TuVanVien", item.TuVanVien); using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblXuatNhap_Update_UpdateNormal_linhnx", obj)) { while (rd.Read()) { Item = getFromReader(rd); } } return(Item); }