Beispiel #1
0
        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 = "";
        }