Esempio n. 1
0
            public static MaterialReportDTOCollection GetAllWaiveMaterialsByDate(long CaseID, DateTime?DateFrom, DateTime?DateTo, long?ContractID, long?ActivityID, long?PartID, long?MaterialID, bool?IsOrdered)
            {
                MaterialReportDTOCollection c = new MaterialReportDTOCollection();

                SqlCommand             cmd    = new SqlCommand();
                SqlParameterCollection Params = cmd.Parameters;

                Params.Add(new SqlParameter("CaseID", CaseID));
                if (DateFrom != null)
                {
                    Params.Add(new SqlParameter("DateFrom", DateFrom));
                }
                if (DateTo != null)
                {
                    Params.Add(new SqlParameter("DateTo", DateTo));
                }
                if (ContractID != null)
                {
                    Params.Add(new SqlParameter("ContractID", ContractID));
                }
                if (ActivityID != null)
                {
                    Params.Add(new SqlParameter("ActivityID", ActivityID));
                }
                if (PartID != null)
                {
                    Params.Add(new SqlParameter("PartID", PartID));
                }
                if (MaterialID != null)
                {
                    Params.Add(new SqlParameter("MaterialID", MaterialID));
                }
                if (IsOrdered != null)
                {
                    Params.Add(new SqlParameter("IsOrdered", IsOrdered));
                }


                DataTable dt = Execute.FillDataTable(StoredProcedures.GetAllWaiveMaterialsByDate, Params);

                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        MaterialReportDTO o = new MaterialReportDTO();
                        LoadMaterialDTOByReader(row, o);
                        c.Add(o);
                    }
                }

                return(c);
            }
Esempio n. 2
0
 public static void LoadMaterialDTOByReader(DataRow row, MaterialReportDTO o)
 {
     o.ID          = Convert.ToInt64(row["MaterialID"]);
     o.Title       = row["Title"].ToString();
     o.Length      = Convert.ToDecimal(row["Length"]);
     o.Width       = Convert.ToDecimal(row["Width"]);
     o.UnitTypeID  = Convert.ToInt32(row["UnitTypeID"]);
     o.TypeID      = Convert.ToInt32(row["TypeID"]);
     o.TotalAmount = Convert.ToDecimal(row["TotalMaterialAmount"]);
     o.UnitPrice   = Convert.ToDecimal(row["AverageUnitPrice"]);
     o.Totalprice  = Convert.ToDecimal(row["TotalPrice"]);
     o.Year        = Convert.ToInt32(row["Year"]);
     o.Month       = Convert.ToInt32(row["Month"]);
     o.IsOrdered   = Convert.ToBoolean(row["IsOrdered"]);
 }