Esempio n. 1
0
        public ucEquipmentEntry()
        {
            InitializeComponent();

            luColEquipNum.DataSource = Equipment.ListForCompany().Select(e => new
            {
                EqpNum      = e.EqpNum,
                AssetCode   = e.AssetCode,
                DisplayName = e.DisplayName,
                Class       = EquipmentClass.GetEquipmentClass(e.ClassCode)?.Desc,
                Category    = EquipmentCategory.GetEquipmentCategory(e.CategoryCode)?.Desc
            }).ToList();

            luColAssertNum.DataSource = Equipment.ListForCompany().Select(e => new
            {
                EqpNum      = e.EqpNum,
                AssetCode   = e.AssetCode,
                DisplayName = e.DisplayName,
                Class       = EquipmentClass.GetEquipmentClass(e.ClassCode)?.Desc,
                Category    = EquipmentCategory.GetEquipmentCategory(e.CategoryCode)?.Desc
            }).ToList();

            var level1CodeList = LevelOneCode.ListForCompany().Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();

            luColLevel1All.DataSource = level1CodeList.OrderBy(x => x.MatchId);

            var level2CodeList = LevelTwoCode.ListForCompany().Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();

            luColLevel2All.DataSource = level2CodeList.OrderBy(x => x.MatchId);

            var level3CodeList = LevelThreeCode.ListForCompany().Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();

            luColLevel3All.DataSource = level3CodeList.OrderBy(x => x.MatchId);

            var level4CodeList = LevelFourCode.ListForCompany().Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();

            luColLevel4All.DataSource = level4CodeList.OrderBy(x => x.MatchId);

            luColBillCycleAll.DataSource = Enum.GetValues(typeof(EnumBillCycle)).Cast <EnumBillCycle>().Select(x => new { Enum = (char)x, Desc = Enum.GetName(typeof(EnumBillCycle), x) });

            int maxLevel  = Company.GetCurrCompany().MaxLevelCode;
            var SetColumn = new Action <GridColumn, int, string>((col, level, caption) =>
            {
                col.Visible = maxLevel >= level;
                col.OptionsColumn.ShowInCustomizationForm = maxLevel >= level;
                col.Caption = caption;
            });

            SetColumn(colLevel4Code, 4, Company.GetCurrCompany().Level4CodeDesc);
            SetColumn(colLevel3Code, 3, Company.GetCurrCompany().Level3CodeDesc);
            SetColumn(colLevel2Code, 2, Company.GetCurrCompany().Level2CodeDesc);
            SetColumn(colLevel1Code, 1, Company.GetCurrCompany().Level1CodeDesc);
        }
Esempio n. 2
0
        public ucFieldPO()
        {
            InitializeComponent();

            btnSubmit.Enabled = false;

            _fileMgr                     = new ucFileManager(MobileCommon.HMCon, GuiCommon.HMDevXManager, DocumentViewerMode.All, false, "F", true);
            _fileMgr.Dock                = DockStyle.Fill;
            _fileMgr.Parent              = dpAttachment;
            _fileMgr.AttachmentsRemoved += AttachmentsRemoved;
            _fileMgr.AttachmentsAdded   += AttachmentsAdded;
            _fileMgr.AttachmentsEdited  += AttachmentsEdited;
            _fileMgr.Enabled             = false;

            luColSupplier.DataSource     = Supplier.ListForCompany().Select(s => new { SupplierCode = s.SupplierCode, SupplierName = s.SupplierName });
            luColSupplierName.DataSource = Supplier.ListForCompany().Select(s => new { SupplierCode = s.SupplierCode, SupplierName = s.SupplierName });

            luColProjectCode.DataSource = Project.AccessibleList().Select(p => new { MatchId = p.MatchId, Code = p.Code, Project = p.Name }).ToList();
            luColProjectName.DataSource = Project.AccessibleList().Select(p => new { MatchId = p.MatchId, Code = p.Code, Project = p.Name }).ToList();

            var level1CodeList = LevelOneCode.ListForCompany().Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();

            luDetailLevel1All.DataSource = level1CodeList.OrderBy(x => x.MatchId);

            var level2CodeList = LevelTwoCode.ListForCompany().Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();

            luDetailLevel2All.DataSource = level2CodeList.OrderBy(x => x.MatchId);

            var level3CodeList = LevelThreeCode.ListForCompany().Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();

            luDetailLevel3All.DataSource = level3CodeList.OrderBy(x => x.MatchId);

            var level4CodeList = LevelFourCode.ListForCompany().Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();

            luDetailLevel4All.DataSource = level4CodeList.OrderBy(x => x.MatchId);

            luDetailComponent.DataSource = Enum.GetValues(typeof(EnumComponentType)).Cast <EnumComponentType>().Select(x => new { Type = Enum.GetName(typeof(EnumComponentType), x), Enum = (char)x });

            int maxLevel  = Company.GetCurrCompany().MaxLevelCode;
            var SetColumn = new Action <GridColumn, int, string>((col, level, caption) =>
            {
                col.Visible = maxLevel >= level;
                col.OptionsColumn.ShowInCustomizationForm = maxLevel >= level;
                col.Caption = caption;
            });

            SetColumn(colDetailLevel4Code, 4, Company.GetCurrCompany().Level4CodeDesc);
            SetColumn(colDetailLevel3Code, 3, Company.GetCurrCompany().Level3CodeDesc);
            SetColumn(colDetailLevel2Code, 2, Company.GetCurrCompany().Level2CodeDesc);
            SetColumn(colDetailLevel1Code, 1, Company.GetCurrCompany().Level1CodeDesc);
        }
Esempio n. 3
0
        public ucLabourEntry()
        {
            InitializeComponent();

            luColEmpNum.DataSource  = Employee.ListForCompany().Select(emp => new { EmpNum = emp.EmpNum, DisplayName = emp.DisplayName }).Distinct().ToList();
            luColEmpName.DataSource = Employee.ListForCompany().Select(emp => new { EmpNum = emp.EmpNum, DisplayName = emp.DisplayName }).Distinct().ToList();

            var wcList = WorkClass.ListForCompany().Select(wc => new { Code = wc.Code, DisplayName = wc.DisplayName }).Distinct().ToList();

            luColWorkClass.DataSource = wcList;

            var codeLevel1List = LevelOneCode.ListForCompany().Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();

            luColLevel1All.DataSource = codeLevel1List.OrderBy(x => x.MatchId);

            var codeLevel2List = LevelTwoCode.ListForCompany().Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();

            luColLevel2All.DataSource = codeLevel2List.OrderBy(x => x.MatchId);

            var level3CodeList = LevelThreeCode.ListForCompany().Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();

            luColLevel3All.DataSource = level3CodeList.OrderBy(x => x.MatchId);

            var level4CodeList = LevelFourCode.ListForCompany().Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();

            luColLevel4All.DataSource = level4CodeList.OrderBy(x => x.MatchId);

            Func <string, string, int, GridColumn> CreateColumn = new Func <string, string, int, GridColumn>((field, caption, visibleIndex) =>
            {
                GridColumn column   = gvLabour.Columns.AddVisible(field, caption);
                column.VisibleIndex = visibleIndex;
                return(column);
            });

            int visionIndex = 0;

            new List <GridColumn> {
                colEmpNum, colEmployeeName, colWorkClass, colChangeOrder, colLevel1Code, colLevel2Code, colLevel3Code, colLevel4Code, colBillable, colManual
            }
            .ForEach(x => x.VisibleIndex = visionIndex++);

            foreach (var timecode in TimeCode.SubList(TimeCode.EnumValueType.Hours))
            {
                tableLabour.Columns.Add(BillRateI(timecode), Type.GetType("System.Decimal"));
                var rateCol = CreateColumn(BillRateI(timecode), $"{timecode.Desc} Bill Rate", visionIndex++);
                rateCol.DisplayFormat.FormatType   = FormatType.Numeric;
                rateCol.DisplayFormat.FormatString = "c2";
                rateCol.OptionsColumn.AllowEdit    = false;

                tableLabour.Columns.Add(EnterHoursI(timecode), Type.GetType("System.Decimal"));
                var hourCol = CreateColumn(EnterHoursI(timecode), $"{timecode.Desc} Hours", visionIndex++);
                hourCol.ColumnEdit = textColHours;
                hourCol.Summary.AddRange(new DevExpress.XtraGrid.GridSummaryItem[] {
                    new DevExpress.XtraGrid.GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Sum, hourCol.FieldName, "{0:n2}")
                });
            }

            foreach (var timecode in TimeCode.SubList(TimeCode.EnumValueType.Dollars))
            {
                tableLabour.Columns.Add(EnterAmountI(timecode), Type.GetType("System.Decimal"));
                var amountCol = CreateColumn(EnterAmountI(timecode), timecode.Desc, visionIndex++);
                amountCol.ColumnEdit = textColAmount;
            }

            colTotalHours.VisibleIndex = visionIndex++;
            colBillAmount.VisibleIndex = visionIndex++;

            int maxLevel  = Company.GetCurrCompany().MaxLevelCode;
            var SetColumn = new Action <GridColumn, int, string>((col, level, caption) =>
            {
                col.Visible = maxLevel >= level;
                col.OptionsColumn.ShowInCustomizationForm = maxLevel >= level;
                col.Caption = caption;
            });

            SetColumn(colLevel4Code, 4, Company.GetCurrCompany().Level4CodeDesc);
            SetColumn(colLevel3Code, 3, Company.GetCurrCompany().Level3CodeDesc);
            SetColumn(colLevel2Code, 2, Company.GetCurrCompany().Level2CodeDesc);
            SetColumn(colLevel1Code, 1, Company.GetCurrCompany().Level1CodeDesc);
        }