public static XuatNhapReport Insert(XuatNhapReport item) { var Item = new XuatNhapReport(); var obj = new SqlParameter[12]; obj[0] = new SqlParameter("BCXN_HH_ID", item.HH_ID); obj[1] = new SqlParameter("BCXN_HH_Ten", item.HH_Ten); obj[2] = new SqlParameter("BCXN_HH_Ma", item.HH_Ma); obj[3] = new SqlParameter("BCXN_HH_DonVi", item.HH_DonVi); obj[4] = new SqlParameter("BCXN_DauKy_SoLuong", item.DauKy_SoLuong); obj[5] = new SqlParameter("BCXN_DauKy_Tien", item.DauKy_Tien); obj[6] = new SqlParameter("BCXN_Nhap_SoLuong", item.Nhap_SoLuong); obj[7] = new SqlParameter("BCXN_Nhap_Tien", item.Nhap_Tien); obj[8] = new SqlParameter("BCXN_Xuat_SoLuong", item.Xuat_SoLuong); obj[9] = new SqlParameter("BCXN_Xuat_Tien", item.Xuat_Tien); obj[10] = new SqlParameter("BCXN_CuoiKy_SoLuong", item.CuoiKy_SoLuong); obj[11] = new SqlParameter("BCXN_CuoiKy_Tien", item.CuoiKy_Tien); using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblXuatNhapReport_Insert_InsertNormal_linhnx", obj)) { while (rd.Read()) { Item = getFromReader(rd); } } return(Item); }
public static XuatNhapReport getFromReader(IDataReader rd) { var Item = new XuatNhapReport(); if (rd.FieldExists("HH_ID")) { Item.HH_ID = (Guid)(rd["HH_ID"]); } if (rd.FieldExists("HH_Ten")) { Item.HH_Ten = (String)(rd["HH_Ten"]); } if (rd.FieldExists("HH_Ma")) { Item.HH_Ma = (String)(rd["HH_Ma"]); } if (rd.FieldExists("HH_DonVi")) { Item.HH_DonVi = (String)(rd["HH_DonVi"]); } if (rd.FieldExists("DauKy_SoLuong")) { Item.DauKy_SoLuong = (Double)(rd["DauKy_SoLuong"]); } if (rd.FieldExists("DauKy_Tien")) { Item.DauKy_Tien = (Double)(rd["DauKy_Tien"]); } if (rd.FieldExists("Nhap_SoLuong")) { Item.Nhap_SoLuong = (Double)(rd["Nhap_SoLuong"]); } if (rd.FieldExists("Nhap_Tien")) { Item.Nhap_Tien = (Double)(rd["Nhap_Tien"]); } if (rd.FieldExists("Xuat_SoLuong")) { Item.Xuat_SoLuong = (Double)(rd["Xuat_SoLuong"]); } if (rd.FieldExists("Xuat_Tien")) { Item.Xuat_Tien = (Double)(rd["Xuat_Tien"]); } if (rd.FieldExists("CuoiKy_SoLuong")) { Item.CuoiKy_SoLuong = (Double)(rd["CuoiKy_SoLuong"]); } if (rd.FieldExists("CuoiKy_Tien")) { Item.CuoiKy_Tien = (Double)(rd["CuoiKy_Tien"]); } if (rd.FieldExists("HH_GiaNhap")) { Item.HH_GiaNhap = (Double)(rd["HH_GiaNhap"]); } return(Item); }
public static XuatNhapReport SelectById(Guid BCXN_HH_ID) { var Item = new XuatNhapReport(); var obj = new SqlParameter[1]; obj[0] = new SqlParameter("BCXN_HH_ID", BCXN_HH_ID); using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblXuatNhapReport_Select_SelectById_linhnx", obj)) { while (rd.Read()) { Item = getFromReader(rd); } } return(Item); }