public static WaivePackageStockMaterialCollection GetStockWaiveMaterialsByWaiveID(Int64 CaseID, Int64 CompanyID, DateTime DateFrom, DateTime DateTo, Int64 MaterialID) { WaivePackageStockMaterialCollection c = new WaivePackageStockMaterialCollection(); SqlCommand cmd = new SqlCommand(); SqlParameterCollection Params = cmd.Parameters; Params.Add(new SqlParameter("CaseID", CaseID)); Params.Add(new SqlParameter("CompanyID", CompanyID)); Params.Add(new SqlParameter("DateFrom", DateFrom)); Params.Add(new SqlParameter("DateTo", DateTo)); if (MaterialID > 0) { Params.Add(new SqlParameter("MaterialID", MaterialID)); } DataTable dt = Execute.FillDataTable(StoredProcedures.GetAllWaiveMaterialsByCompanyIDAndDate, Params); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { WaivePackageStockMaterial o = new WaivePackageStockMaterial(); LoadWaivePackageStockMaterial(row, o, true); c.Add(o); } } return(c); }
public static void LoadWaivePackageStockMaterial(DataRow row, WaivePackageStockMaterial o, bool forDeliveryPlan) { o.Length = Convert.ToDecimal(row["Length"]); o.Width = Convert.ToDecimal(row["Width"]); o.TotalAmount = Convert.ToDecimal(row["TotalAmount"]); o.Title = row["Title"].ToString(); o.MaterialID = Convert.ToInt64(row["MaterialID"]); o.UnitTypeID = Convert.ToInt32(row["UnitTypeID"]); if (forDeliveryPlan) { o.EstOrderDate = Convert.ToDateTime(row["EstOrderDate"]); } }
public static WaivePackageStockMaterialCollection GetStockWaiveMaterialsByWaiveID(Int64 WaiveID) { WaivePackageStockMaterialCollection c = new WaivePackageStockMaterialCollection(); DataTable dt = Execute.FillDataTable(StoredProcedures.GetStockWaiveMaterialsByWaiveID, new SqlParameter("WaiveID", WaiveID)); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { WaivePackageStockMaterial o = new WaivePackageStockMaterial(); LoadWaivePackageStockMaterial(row, o, false); c.Add(o); } } return(c); }