Esempio n. 1
0
 private void AddEquipment(object sender, EventArgs e)
 {
     int buttonTag = Convert.ToInt32(((ToolStripButton)sender).Tag);
     EquipmentManage manageForm = new EquipmentManage(_dataContexts, _loadedArea,null, buttonTag);
     if (manageForm.ShowDialog(this) == DialogResult.OK)
     {
         ReloadData(_loadedArea, true);
         SharedAppData.HistoryStore.AddHistoryEvent("Add Equipment",manageForm.GetManagedEquipmentDescription);
         OnUpdateData();
     }
 }
Esempio n. 2
0
 private void ManageEquipment(object sender, EventArgs e)
 {
     int tag=0;
     var button = sender as ToolStripButton;
     if (button != null)
     {
         tag = Convert.ToInt32(button.Tag);
     }
     else
     {
         var customed = sender as DataGridViewCustomed;
         if (customed != null)
         {
             tag = Convert.ToInt32(customed.Tag);
         }
     }
     DataGridViewCustomed dgv;
     switch (tag)
     {
         case 2:
             dgv = gvProviderSetProviderSummary.DependentGridView;
             break;
         case 12:
             dgv = gvProviderSetClientSummary.DependentGridView;
             break;
         case 22:
             dgv = gvClientSetProviderSummary.DependentGridView;
             break;
         default:
             throw new Exception("Invalid button tag");
     }
     if (dgv.SelectedRows.Count != 1)
         return;
     Equipment managedEquipment = (Equipment)((EquipmentGridViewItemDetailed)dgv.SelectedRows[0].DataBoundItem).Tag;
     if (managedEquipment==null) throw new Exception("Invalid data structure in child table");
     EquipmentManage manageForm = new EquipmentManage(_dataContexts, _loadedArea, managedEquipment, tag);
     if (manageForm.ShowDialog(this)== DialogResult.OK)
     {
         ReloadData(_loadedArea, true);
         OnUpdateData();
     }
 }
Esempio n. 3
0
 private void areasTree_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         TreeNodeAdv selectedNode = areasTree.SelectedNode;
         if (selectedNode == null)
         {
             return;
         }
         AreaTreeItem selectedTreeItem = selectedNode.Tag as AreaTreeItem;
         if (selectedTreeItem == null)
             throw new Exception("Invalid tree struct, maybe error in database");
         var selectedDataItem = selectedTreeItem.Tag;
         Equipment item = selectedDataItem as Equipment;
         if (item != null)
         {
             int tag = 0;
             if ((item.OwnerType == (int) EquipmentOwner.Provider) & (item.PlaceType == (int) EquipmentSide.ProviderArea))
             {
                 tag = 1;
             }
             else if ((item.OwnerType == (int) EquipmentOwner.Provider) & (item.PlaceType == (int) EquipmentSide.ClientArea))
             {
                 tag = 11;
             }
             else if ((item.OwnerType == (int) EquipmentOwner.Client) & (item.PlaceType == (int) EquipmentSide.ProviderArea))
             {
                 tag = 21;
             }
             EquipmentManage manageForm = new EquipmentManage(_dataContexts, item.Area, item, tag);
             if (manageForm.ShowDialog(this) == DialogResult.OK)
             {
                 RefresAreaTree();
                 if (areaDetails.Visible)
                     areaDetails.ReloadData(item.Area);
                 else
                     equipmentDetails.ReloadData(item);
             }
         }
     }
 }