示例#1
0
        private void EditMethod()
        {
            GridView focusedView = (FocusedGrid.Views[0] as GridView);
            int      index       = focusedView.FocusedRowHandle;
            int      selectedID  = int.Parse(focusedView.GetRowCellValue(index, "Id").ToString());
            Form     card        = null;

            if (index < 0)
            {
                return;
            }

            if (FocusedGrid.Name == "gridFittings")
            {
                object name      = focusedView.GetRowCellValue(index, "Name");
                object price     = focusedView.GetRowCellValue(index, "Price");
                object groupName = focusedView.GetRowCellValue(index, "ComponentGroup");

                card = new OneFitting(selectedID, name, price, groupName, true);
            }
            else if (FocusedGrid.Name == "gridBriefcases")
            {
                object name        = focusedView.GetRowCellValue(index, "Name");
                object description = focusedView.GetRowCellValue(index, "Description");
                object date        = focusedView.GetRowCellValue(index, "CreateDateTime");

                card = new ViewForms.BriefcaseCard(selectedID, name, description, date);
            }
            else if (FocusedGrid.Name == "gridComponentGroup")
            {
                object name = focusedView.GetRowCellValue(index, "Name");

                card = new Cards.ComponentGroupCard(selectedID, name);
            }
            else if (FocusedGrid.Name == "gridEquipments")
            {
                object name        = focusedView.GetRowCellValue(index, "Name");
                object description = focusedView.GetRowCellValue(index, "Description");
                object price       = focusedView.GetRowCellValue(index, "Price");

                Model.EquipmentModel model = new Model.EquipmentModel()
                {
                    Id          = selectedID,
                    Name        = name.ToString(),
                    Description = description.ToString(),
                    Price       = double.Parse(price.ToString())
                };

                card = new Cards.EquipmentCard(model);
            }

            card.Owner = this;
            if (card.ShowDialog() == DialogResult.OK)
            {
                RefreshMethods();
            }

            focusedView.FocusedRowHandle = UI.GridControlUIModifications.GetIndexRowOfItem(selectedID, focusedView);
        }
示例#2
0
        private void AddMethod()
        {
            if (FocusedGrid.Name == "gridFittings")
            {
                OneFitting oneFitting = new OneFitting();
                oneFitting.Owner = this;
                oneFitting.ShowDialog();

                if (oneFitting.DialogResult == DialogResult.OK)
                {
                    int newId = oneFitting.IdAddedFitting;
                    LoadFittings();
                    gridView1.FocusedRowHandle = UI.GridControlUIModifications.GetIndexRowOfItem(newId, gridView1);
                }
            }
            else if (FocusedGrid.Name == "gridBriefcases")
            {
                ViewForms.BriefcaseCard card = new ViewForms.BriefcaseCard();
                card.Owner = this;
                card.ShowDialog();

                if (card.DialogResult == DialogResult.OK)
                {
                    int newId = card.IdAddedBriefcase;
                    LoadBriefcases();
                    gridView2.FocusedRowHandle = UI.GridControlUIModifications.GetIndexRowOfItem(newId, gridView2);
                }
            }
            else if (FocusedGrid.Name == "gridComponentGroup")
            {
                Cards.ComponentGroupCard card = new Cards.ComponentGroupCard();
                card.Owner = this;
                card.ShowDialog();

                if (card.DialogResult == DialogResult.OK)
                {
                    int id = card.IdGroup;
                    LoadComponentGroup();
                    gridView3.FocusedRowHandle = UI.GridControlUIModifications.GetIndexRowOfItem(id, gridView3);
                }
            }
            else if (FocusedGrid.Name == "gridEquipments")
            {
                Cards.EquipmentCard card = new Cards.EquipmentCard();
                card.Owner = this;
                card.ShowDialog();

                if (card.DialogResult == DialogResult.OK)
                {
                    int id = card.EquipmentModel.Id;
                    LoadEquipments();
                    gridView4.FocusedRowHandle = UI.GridControlUIModifications.GetIndexRowOfItem(id, gridView4);
                }
            }
        }