Ejemplo n.º 1
0
 private void rdPlant_CheckedChanged(object sender, EventArgs e)
 {
     if (rdPlant.Checked)
     {
         extensionObjectDTOBindingSource.DataSource = VpnManagerDal.GetExtensionObjects(_plant, (int)TargetTable.Plant);
     }
 }
Ejemplo n.º 2
0
 private void AddExt_Click(object sender, EventArgs e)
 {
     if (txtExtName.Text != string.Empty && txtExtValue.Text != string.Empty)
     {
         PlantDTO plant = VpnManagerDal.GetPlant(cmbCustomer.Text);
         bool     mustUpdateExtensionObj = false; //added refresh of ext objs if needed
         if (rdPlant.Checked)
         {
             if (plant.Id > 0)
             {
                 mustUpdateExtensionObj = VpnManagerDal.AddExtensionObject(plant.Id, (int)TargetTable.Plant, txtExtName.Text, txtExtValue.Text);
             }
         }
         else
         {
             if (_machineID > 0)
             {
                 mustUpdateExtensionObj = VpnManagerDal.AddExtensionObject(_machineID, (int)TargetTable.Machine, txtExtName.Text, txtExtValue.Text);
             }
         }
         if (mustUpdateExtensionObj)
         {
             extensionObjectDTOBindingSource.DataSource = VpnManagerDal.GetExtensionObjects(_plant, (int)TargetTable.Plant);
         }
     }
 }
Ejemplo n.º 3
0
 private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (dataGridView1.Focused)
     {
         DataGridViewRow row = dataGridView1.SelectedRows[0];
         VpnManagerDal.DeleteMachine(Convert.ToInt32(row.Cells[0].Value));
     }
     else
     {
         if (dataGridView1.SelectedRows.Count > 0)
         {
             DataGridViewRow row = dataGridView2.SelectedRows[0];
             VpnManagerDal.DeleteExtensionObject(Convert.ToInt32(row.Cells[0].Value));
             if (rdPlant.Checked)
             {
                 extensionObjectDTOBindingSource.DataSource = VpnManagerDal.GetExtensionObjects(_plant, (int)TargetTable.Plant);
             }
             else
             {
                 extensionObjectDTOBindingSource.DataSource = VpnManagerDal.GetExtensionObjects(_machineID, (int)TargetTable.Machine);
             }
         }
         else
         {
             MessageBox.Show("Select a Object before");
         }
     }
 }
Ejemplo n.º 4
0
 private void rdExtMachine_CheckedChanged(object sender, EventArgs e)
 {
     if (rdExtMachine.Checked)
     {
         if (dataGridView1.SelectedRows.Count > 0)
         {
             extensionObjectDTOBindingSource.DataSource = VpnManagerDal.GetExtensionObjects(_machineID, (int)TargetTable.Machine);
         }
         else
         {
             MessageBox.Show("Select First a Machine!");
             rdExtMachine.Checked = false;
             rdPlant.Checked      = true;
         }
     }
 }
Ejemplo n.º 5
0
        public AddConnection(int Plant)
        {
            InitializeComponent();
            vpnTypeDTOBindingSource.DataSource        = VpnManagerDal.GetVpnTypes();
            connectionTypeDTOBindingSource.DataSource = VpnManagerDal.GetConnectionTypes();
            machineDTOBindingSource.DataSource        = VpnManagerDal.GetMachinesByPlant(Plant);
            PlantDTO plant = VpnManagerDal.GetPlant(Plant);

            cmbCustomer.DataSource = VpnManagerDal.GetCustomersList();
            cmbCustomer.Text       = plant.DisplayedName;
            //cmbCustomer.Text = plant.Name;
            txtServerHost.Text       = plant.ServerAddress;
            txtUser.Text             = plant.Username;
            txtPassword.Text         = plant.Password;
            txtConfrimPassword.Text  = plant.Password;
            cmbVpnType.SelectedValue = plant.IdConnectionType;
            Loading            = false;
            Modifing           = true;
            grpMachine.Enabled = true;
            _plant             = Plant;
            cmdNext.Text       = "Modify Plant";
            extensionObjectDTOBindingSource.DataSource = VpnManagerDal.GetExtensionObjects(_plant, (int)TargetTable.Plant);
            // cmdMachine.Text = "Edit";
        }
Ejemplo n.º 6
0
 private void LoadDataExtension(int id)
 {
     extensionObjectDTOBindingSource.DataSource = VpnManagerDal.GetExtensionObjects(id, (int)VpnManagerDal.GetTargetTable(sTargetTable));
 }