コード例 #1
0
        public static List <MyCostItem> GetCostItems(List <JobCostingTransaction> jobCosts)
        {
            var myCosts = new List <MyCostItem>();
            int i       = 1;

            foreach (var jc in jobCosts)
            {
                var mc = new MyCostItem()
                {
                    CostItemID  = jc.TransactionID,
                    CategoryID  = jc.EST_Cost_Type.CategoryID,
                    TypeID      = jc.EstCostTypeID,
                    TypeName    = jc.EST_Cost_Type.Name,
                    OrderNumber = i++,

                    Name      = MaterialCommon.GetMaterialName(jc.Material),
                    Unit      = jc.Material.MaterialPriceUnit.UnitName,
                    UnitPrice = jc.Material.Price,
                    Qty       = jc.Count,
                    TempInt1  = jc.WoID,
                };
                mc.SubTotal = Math.Round(mc.UnitPrice * mc.Qty, 2);


                myCosts.Add(mc);
            }
            return(myCosts);
        }
コード例 #2
0
        private List <MyKeyValuePair> GetMaterialsFilteredByQueryString(QueryStringForMaterialSearch qString, IEnumerable <Model.Material> materials)
        {
            var values = new List <MyKeyValuePair>();

            foreach (var m in materials)
            {
                var name = MaterialCommon.GetMaterialName(m);
                var b0   = true;
                var b1   = true;
                var b2   = true;

                if (qString.QLength >= 1)
                {
                    if (!name.ToUpper().Contains(qString.Q0))
                    {
                        b0 = false;
                    }
                }
                if (qString.QLength >= 2)
                {
                    if (!name.ToUpper().Contains(qString.Q1))
                    {
                        b1 = false;
                    }
                }
                if (qString.QLength >= 3)
                {
                    if (!name.ToUpper().Contains(qString.Q2))
                    {
                        b2 = false;
                    }
                }
                if (!(b0 & b1 & b2))
                {
                    continue;
                }
                var value = new MyKeyValuePair()
                {
                    Value = name + "--" + m.Price.ToString("C2") + "/" + m.MaterialPriceUnit.UnitName,
                    Key   = m.MaterialID,
                };
                values.Add(value);
            }
            return(values);
        }