Esempio n. 1
0
        public void SetCurrent(LemHeader header)
        {
            _headerRecord = header;
            SetEnabled(_headerRecord.CheckEditable());

            var changeOrderList = ChangeOrder.ListForProject(_headerRecord.ProjectId).Select(cs => new { EstimateId = cs.EstimateId, DisplayName = cs.DisplayName }).Distinct().ToList();

            changeOrderList.Add(new { EstimateId = -1, DisplayName = "" });
            luChangeOrder.DataSource = changeOrderList;

            tableLabour.Clear();
            var list = LabourTimeEntry.GetLabourEntryList(header.Id).ToList();

            list.ForEach(lte =>
            {
                DataRow row = tableLabour.Rows.Add(
                    lte.Id,
                    lte.EmpNum,
                    lte.EmpNum,
                    lte.WorkClassCode,
                    lte.ChangeOrderId,
                    lte.Level1Id,
                    lte.Level2Id,
                    lte.Level3Id,
                    lte.Level4Id,
                    lte.Billable,
                    lte.Manual,
                    lte.IncludedHours,
                    lte.TotalHours,
                    lte.BillAmount);

                foreach (var timecode in TimeCode.SubList(TimeCode.EnumValueType.Hours))
                {
                    row[BillRateI(timecode)]   = (object)ProjectWorkClass.GetBillRate(_headerRecord.ProjectId, timecode.MatchId, (string)row[colWorkClass.FieldName]) ?? DBNull.Value;
                    row[EnterHoursI(timecode)] = (object)list.Find(x => x.Id == (int)row[colId.FieldName]).DetailList.SingleOrDefault(d => d.TimeCodeId == timecode.MatchId)?.WorkHours ?? DBNull.Value;
                }

                foreach (var timecode in TimeCode.SubList(TimeCode.EnumValueType.Dollars))
                {
                    row[EnterAmountI(timecode)] = (object)list.Find(x => x.Id == (int)row[colId.FieldName]).DetailList.SingleOrDefault(d => d.TimeCodeId == timecode.MatchId)?.Amount ?? DBNull.Value;
                }
            });

            tableLabour.AcceptChanges();
            gvLabour.BestFitColumns(true);
        }
Esempio n. 2
0
        public void SetCurrent(LemHeader header)
        {
            _headerRecord = header;
            SetEnabled(_headerRecord.CheckEditable());

            var changeOrderList = ChangeOrder.ListForProject(_headerRecord.ProjectId).Select(cs => new { EstimateId = cs.EstimateId, DisplayName = cs.DisplayName }).Distinct().ToList();

            luChangeOrder.DataSource = changeOrderList;

            tableEquipEntry.Clear();
            EquipTimeEntry.GetEquipEntryList(header.Id).ToList().ForEach(x =>
            {
                var equip       = Equipment.GetEquipment(x.EqpNum);
                double?billRate = null;
                if (equip != null)
                {
                    var list = equip.GetBillRateList(_headerRecord.ProjectId);
                    billRate = (double?)list.SingleOrDefault(c => c.BillCycle == x.BillCycle)?.BillRate;
                }

                tableEquipEntry.Rows.Add(
                    x.Id,
                    x.EqpNum,
                    x.EqpNum,
                    EquipmentClass.GetEquipmentClass(equip.ClassCode)?.DisplayName ?? "",
                    x.EmpNum,
                    x.EmpNum != null ? Employee.GetEmployee(x.EmpNum.Value).DisplayName : "",
                    x.ChangeOrderId,
                    x.Level1Id,
                    x.Level2Id,
                    x.Level3Id,
                    x.Level4Id,
                    x.Billable,
                    x.Quantity,
                    (char)x.BillCycle,
                    billRate,
                    x.BillAmount);
            });
            tableEquipEntry.AcceptChanges();
        }