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); } } }
private void AddOrUpdateMachine(bool Update) { IPAddress ipadresses; if (IPAddress.TryParse(txtIp.Text, out ipadresses)) { int i = VpnManagerDal.GetPlant(cmbCustomer.Text).Id; if (!Update) { VpnManagerDAL.VpnManagerDal.InsertNewMachine(i, txtPcName.Text, txtIp.Text, txtUerMachine.Text, txtPasswordMachine.Text, Convert.ToBoolean(chkCheckEnabled.CheckState), Convert.ToInt32(cmbContype.SelectedValue)); machineDTOBindingSource.DataSource = VpnManagerDal.GetMachinesByPlant(i); } else { VpnManagerDal.EditMachine(_machineID, txtPcName.Text, txtIp.Text, txtUerMachine.Text, txtPassword.Text, Convert.ToBoolean(chkCheckEnabled.CheckState), _plant, (int)cmbContype.SelectedValue); cmdEdit.Enabled = false; } foreach (Control txt in grpMachine.Controls) { if (txt.GetType() == typeof(DevComponents.DotNetBar.Controls.TextBoxX)) { txt.Text = string.Empty; } } } else { MessageBox.Show("Ip Not Valid"); } // txtIp.Text = ""; }
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"; }