Esempio n. 1
0
        private void gvEmployee_CustomRowCellEditForEditing(object sender, CustomRowCellEditEventArgs e)
        {
            DataRow row = gvLabour.GetDataRow(e.RowHandle);

            if (e.Column == colLevel1Code)
            {
                var codeList = LevelOneCode.ListForProject(_headerRecord.ProjectId).Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();
                luColLevel.DataSource = codeList.OrderBy(x => x.MatchId);
                e.RepositoryItem      = luColLevel;
            }
            else if (e.Column == colLevel2Code)
            {
                int level1Id = row[colLevel1Code.FieldName] == DBNull.Value ? -1 : (int)row[colLevel1Code.FieldName];
                var codeList = LevelTwoCode.SubList(level1Id, _headerRecord.ProjectId).Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();
                luColLevel.DataSource = codeList.OrderBy(x => x.MatchId);
                e.RepositoryItem      = luColLevel;
            }
            else if (e.Column == colLevel3Code)
            {
                int level2Id = row[colLevel2Code.FieldName] == DBNull.Value ? -1 : (int)row[colLevel2Code.FieldName];
                var codeList = LevelThreeCode.SubList(level2Id, _headerRecord.ProjectId).Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();
                luColLevel.DataSource = codeList.OrderBy(x => x.MatchId);
                e.RepositoryItem      = luColLevel;
            }
            else if (e.Column == colLevel4Code)
            {
                int level3Id = row[colLevel3Code.FieldName] == DBNull.Value ? -1 : (int)row[colLevel3Code.FieldName];
                var codeList = LevelFourCode.SubList(level3Id, _headerRecord.ProjectId).Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();
                luColLevel.DataSource = codeList.OrderBy(x => x.MatchId);
                e.RepositoryItem      = luColLevel;
            }
        }
Esempio n. 2
0
        private void gvDetail_CustomRowCellEditForEditing(object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e)
        {
            int projectId = (int)gvPO.GetFocusedDataRow()[colProjectCode.FieldName];

            DataRow row = gvDetail.GetDataRow(e.RowHandle);

            if (e.Column == colDetailLevel1Code)
            {
                var codeList = LevelOneCode.ListForProject(projectId).Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();
                luDetailLevel.DataSource = codeList.OrderBy(x => x.MatchId);
                e.RepositoryItem         = luDetailLevel;
            }
            else if (e.Column == colDetailLevel2Code)
            {
                int level1Id = row[colDetailLevel1Code.FieldName] == DBNull.Value ? -1 : (int)row[colDetailLevel1Code.FieldName];
                var codeList = LevelTwoCode.SubList(level1Id, projectId).Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();
                luDetailLevel.DataSource = codeList.OrderBy(x => x.MatchId);
                e.RepositoryItem         = luDetailLevel;
            }
            else if (e.Column == colDetailLevel3Code)
            {
                int level2Id = row[colDetailLevel2Code.FieldName] == DBNull.Value ? -1 : (int)row[colDetailLevel2Code.FieldName];
                var codeList = LevelThreeCode.SubList(level2Id, projectId).Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();
                luDetailLevel.DataSource = codeList.OrderBy(x => x.MatchId);
                e.RepositoryItem         = luDetailLevel;
            }
            else if (e.Column == colDetailLevel4Code)
            {
                int level3Id = row[colDetailLevel3Code.FieldName] == DBNull.Value ? -1 : (int)row[colDetailLevel3Code.FieldName];
                var codeList = LevelFourCode.SubList(level3Id, projectId).Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();
                luDetailLevel.DataSource = codeList.OrderBy(x => x.MatchId);
                e.RepositoryItem         = luDetailLevel;
            }
        }
Esempio n. 3
0
        private void gvEquipment_CustomRowCellEditForEditing(object sender, CustomRowCellEditEventArgs e)
        {
            DataRow row = gvEquipment.GetDataRow(e.RowHandle);

            if (e.Column == colBillCycle)
            {
                var equip = Equipment.GetEquipment(Convert.ToString(row[colEqpNum.FieldName]));
                var list  = equip.GetBillRateList(_headerRecord.ProjectId);
                list.Add(new EquipmentBillRate {
                    BillCycle = EnumBillCycle.Unknown, BillRate = 0, IsDefault = false
                });

                luColBillCycle.DataSource = list.Select(x => new
                {
                    Enum      = (char)x.BillCycle,
                    Cycle     = Enum.GetName(typeof(EnumBillCycle), x.BillCycle),
                    BillRate  = (x.BillRate == 0 ? "" : x.BillRate.ToString("N2")),
                    IsDefault = x.IsDefault ? "*" : ""
                });
                e.RepositoryItem = luColBillCycle;
            }
            else if (e.Column == colLevel1Code)
            {
                var codeList = LevelOneCode.ListForProject(_headerRecord.ProjectId).Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();
                luColLevel.DataSource = codeList.OrderBy(x => x.MatchId);
                e.RepositoryItem      = luColLevel;
            }
            else if (e.Column == colLevel2Code)
            {
                int level1Id = row[colLevel1Code.FieldName] == DBNull.Value ? -1 : (int)row[colLevel1Code.FieldName];
                var codeList = LevelTwoCode.SubList(level1Id, _headerRecord.ProjectId).Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();
                luColLevel.DataSource = codeList.OrderBy(x => x.MatchId);
                e.RepositoryItem      = luColLevel;
            }
            else if (e.Column == colLevel3Code)
            {
                int level2Id = row[colLevel2Code.FieldName] == DBNull.Value ? -1 : (int)row[colLevel2Code.FieldName];
                var codeList = LevelThreeCode.SubList(level2Id, _headerRecord.ProjectId).Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();
                luColLevel.DataSource = codeList.OrderBy(x => x.MatchId);
                e.RepositoryItem      = luColLevel;
            }
            else if (e.Column == colLevel4Code)
            {
                int level3Id = row[colLevel3Code.FieldName] == DBNull.Value ? -1 : (int)row[colLevel3Code.FieldName];
                var codeList = LevelThreeCode.SubList(level3Id, _headerRecord.ProjectId).Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();
                luColLevel.DataSource = codeList.OrderBy(x => x.MatchId);
                e.RepositoryItem      = luColLevel;
            }
        }