예제 #1
0
        /// <summary>
        /// Заполнить таблицу КП
        /// </summary>
        private void FillKPGrid()
        {
            try
            {
                DataTable tblObj = Tables.GetObjTable();
                tblObj.Rows.Add(DBNull.Value, AppPhrases.UndefinedItem);
                DataGridViewComboBoxColumn colObjNum = (DataGridViewComboBoxColumn)gvKPSel.Columns["colObjNum"];
                colObjNum.DataSource    = tblObj;
                colObjNum.DisplayMember = "Name";
                colObjNum.ValueMember   = "ObjNum";

                DataTable tblKP     = Tables.GetKPTable();
                DataTable tblKPType = Tables.GetKPTypeTable();
                foreach (DataRow rowKP in tblKP.Rows)
                {
                    CreateCnls.KPInfo kpInfo = CreateCnls.KPInfo.Create(rowKP, tblKPType);

                    if (kpInfo.DllFileName != "")
                    {
                        Type kpViewType;
                        if (kpViewTypes.TryGetValue(kpInfo.DllFileName, out kpViewType))
                        {
                            if (kpViewType == null)
                            {
                                kpInfo.Color    = Color.Red;
                                kpInfo.DllState = CreateCnls.DllStates.Error;
                            }
                            else
                            {
                                kpInfo.Enabled  = true;
                                kpInfo.Color    = Color.Black;
                                kpInfo.DllState = CreateCnls.DllStates.Loaded;
                            }
                        }
                        else
                        {
                            kpInfo.DllState = CreateCnls.DllStates.NotFound;
                        }
                    }

                    kpInfoList.Add(kpInfo);
                }

                gvKPSel.DataSource = kpInfoList;
            }
            catch (Exception ex)
            {
                AppUtils.ProcError(AppPhrases.FillKPGridError + ":\r\n" + ex.Message);
            }
        }
예제 #2
0
            /// <summary>
            /// Создать объект информации о КП
            /// </summary>
            public static KPInfo Create(DataRow rowKP, DataTable tblKPType)
            {
                CreateCnls.KPInfo kpInfo = new CreateCnls.KPInfo();
                kpInfo.KPNum  = (int)rowKP["KPNum"];
                kpInfo.KPName = (string)rowKP["Name"];
                object commLineNum = rowKP["CommLineNum"];

                kpInfo.CommLineNum = commLineNum == DBNull.Value ? 0 : (int)commLineNum;

                tblKPType.DefaultView.RowFilter = "KPTypeID = " + rowKP["KPTypeID"];
                object dllFileName = tblKPType.DefaultView[0]["DllFileName"];

                kpInfo.DllFileName = dllFileName == null || dllFileName == DBNull.Value ?
                                     "" : (string)dllFileName;

                return(kpInfo);
            }
예제 #3
0
            /// <summary>
            /// Создать объект информации о КП
            /// </summary>
            public static KPInfo Create(DataRow rowKP, DataTable tblKPType)
            {
                CreateCnls.KPInfo kpInfo = new CreateCnls.KPInfo();
                kpInfo.KPNum = (int)rowKP["KPNum"];
                kpInfo.KPName = (string)rowKP["Name"];
                object commLineNum = rowKP["CommLineNum"];
                kpInfo.CommLineNum = commLineNum == DBNull.Value ? 0 : (int)commLineNum;

                tblKPType.DefaultView.RowFilter = "KPTypeID = " + rowKP["KPTypeID"];
                object dllFileName = tblKPType.DefaultView[0]["DllFileName"];
                kpInfo.DllFileName = dllFileName == null || dllFileName == DBNull.Value ?
                    "" : (string)dllFileName;

                return kpInfo;
            }