示例#1
0
文件: FormArm.cs 项目: TeaMoon/DBTest
        private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {
            DataGridView dgv = RModulesView;
            var bs = (BindingSource)dgv.DataSource;
            if (bs == null) return;
            DataRow objectRow = _dsQuarry.Tables["Object"].NewRow();
            FillNewRow(objectRow);
            _dsQuarry.Tables["Object"].Rows.Add(objectRow);

            IPropertyObject iProp = null;
            string objId = objectRow["ObjectId"].ToString();
            string code = objectRow["Code"].ToString();

            const int objectType = (int)ObjectTypeEnum.Personal;

            using (var frm = new FormConfig(this, _dsQuarry, iProp, objId, code, true, false, objectType))
            {
                FArm_StopTimer();
                dgv.CurrentCell = dgv.Rows[dgv.Rows.Count - 1].Cells[0];
                var result = frm.ShowDialog(this);
                RefreshDataSetTable();
                SetStyleForDeletedRows(RModulesView);
                FArm_StartTimer();
            }
        }
示例#2
0
文件: FormArm.cs 项目: TeaMoon/DBTest
        private void ToolStripConfigButton_Click(object sender, EventArgs e)
        {
            DataGridView dgv = RModulesView;
            var bs = (BindingSource)dgv.DataSource;
            if (bs == null) return;
            DataRow row = ((DataRowView)bs.Current).Row;
            DataRow[] childRows = row.GetChildRows("Object_ObjectConfig");
            IPropertyObject iProp = null;
            string objId = row["ObjectId"].ToString();
            string code = row["Code"].ToString();
            var objectType = (int)row["ObjectTypeId"];
            var isReadOnly = (bool)row["IsDeleted"];

            if (childRows.Length != 0)
            {
                if (objectType == (int)ObjectTypeEnum.BaseStation) iProp = new BaseStationClass(objectType);
                else iProp = new TrackerClass(objectType);

                try
                {
                    iProp.GetDataFromDataRow(childRows[0]);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Не возможно просмотреть конфиугурацию" + Environment.NewLine
                                    + "Текст ошибки: " + ex.Message);
                    return;
                }
            }

            using (var frm = new FormConfig(this, _dsQuarry, iProp, objId, code, false, isReadOnly, objectType))
            {
                FArm_StopTimer();
                var result = frm.ShowDialog(this);
                FArm_StartTimer();
            }
        }