コード例 #1
0
ファイル: AddConnection.cs プロジェクト: leon289/vpn_manager
        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 = "";
        }
コード例 #2
0
ファイル: AddConnection.cs プロジェクト: leon289/vpn_manager
        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";
        }