Ejemplo n.º 1
0
        private void DgvFields_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
        {
            updateRowsCountInfo();

            for (int i = e.RowIndex; i < e.RowIndex + e.RowCount; ++i)
            {
                DataGridViewRow gridRow = dgvFields.Rows[i];
                PenetrTask      task    = (PenetrTask)gridRow.DataBoundItem;

                List <DiameterType> diameters = penData.getDiameters(task.FlangesType);

                //var dataRows = penData.AsEnumerable().
                //    Where(x => projId != 0 ? x.Field<long>("prjId") == projId :
                //        x.Field<long>("depID") == depId).
                //    Where(x => x.Field<long>("flanNumber") == task.FlangesType).
                //    OrderBy(x => x.Field<long>("diamNumber")).
                //    ThenByDescending(x => x.Field<float>("pipeDiam")).
                //    ThenByDescending(x => x.Field<float>("pipeThick"));

                var comboCell = gridRow.Cells["Диаметр"] as DataGridViewComboBoxCell;

                var diametersStringList = new List <string>();

                DiameterType matchValue = null;
                foreach (DiameterType diamType in diameters)
                {
                    if (diamType.number ==
                        DiameterType.Parse(task.DiameterTypeStr).number)
                    {
                        matchValue = diamType;
                    }
                    diametersStringList.Add(diamType.ToString());
                }

                // TODO
                comboCell.DataSource = diametersStringList;
                if (matchValue != null)
                {
                    comboCell.Value = matchValue.ToString();
                }
                else
                {
                    comboCell.ErrorText = "не валидное значение диаметра";
                }

                if (!Keyins.Penetrations.DEBUG_MODE &&
                    task.TFFormsIntersected.Count == 0)
                {
                    gridRow.ReadOnly = true;
                    gridRow.DefaultCellStyle.BackColor = readonlyColor;
                }
            }
        }
Ejemplo n.º 2
0
        TFCOM.TFFrameList createFrameList(PenetrTask task)
        {
            BCOM.Level level     = ElementHelper.getOrCreateLevel(PenetrTask.LEVEL_NAME);
            BCOM.Level levelSymb =
                ElementHelper.getOrCreateLevel(PenetrTask.LEVEL_SYMB_NAME);
            BCOM.Level levelRefPoint =
                ElementHelper.getOrCreateLevel(PenetrTask.LEVEL_POINT_NAME);

            long       diamIndex = DiameterType.Parse(task.DiameterTypeStr).number;
            PenetrInfo penInfo   = penData.getPenInfo(task.FlangesType, diamIndex);

            TFCOM.TFFrameList frameList =
                PenetrHelper.createFrameList(task, penInfo, level);

            PenetrHelper.addProjection(ref frameList,
                                       task, penInfo, levelSymb, levelRefPoint);

            // TODO видимость контура перфоратора можно в конфиг. переменную
            PenetrHelper.addPerforator(ref frameList, task, penInfo, levelSymb, false);

            return(frameList);
        }