コード例 #1
0
ファイル: Main.cs プロジェクト: leon289/vpn_manager
        private void treeClienti_NodeClick(object sender, DevComponents.AdvTree.TreeNodeMouseEventArgs e)
        {
            try
            {
                if (!connected)
                {
                    if (treeClienti.SelectedNode.Index > 0 || treeClienti.SelectedNode.Parent != null)
                    {
                        VpnManagerDAL.DTO.ExtensionObjectDTO ext = VpnManagerDAL.VpnManagerDal.GetExtensionObject(_controller.GetCLient[Convert.ToInt32(treeClienti.SelectedNode.Tag)].Id, VpnManagerDAL.DTO.TargetTable.Plant, "Note");
                        if (ext != null && !string.IsNullOrEmpty(ext.Value))
                        {
                            txtNote.Text = ext.Value;
                        }
                        else
                        {
                            txtNote.Text = string.Empty;  //reset info previously charged
                        }
                        LogConenction LastConenction = VpnManagerDal.GetLogForPlant(Convert.ToInt32(treeClienti.SelectedNode.Tag));
                        if (LastConenction != null)
                        {
                            string temp = @"Last Connection : {0}" + Environment.NewLine + "User : {1}" + Environment.NewLine + "Connection Succesful : {2}" + Environment.NewLine + "Virtual Machine : {3}";
                            txtLastConnectionInfo.Text = string.Format(temp, LastConenction.LastConenctionTime, LastConenction.UserName, LastConenction.ConncetionSuccesful.ToString(), LastConenction.VirtualMachineName);
                        }
                        else
                        {
                            txtLastConnectionInfo.Text = "";
                        }
                    }

                    if (treeClienti.SelectedNode.Tag != null && treeClienti.SelectedNode.Parent == null)
                    {
                        plantDTOBindingSource.DataSource = _controller.GetCLient[Convert.ToInt32(treeClienti.SelectedNode.Tag)];
                    }
                }
                else
                {
                }
            }
            catch (Exception d)
            {
                WriteInfo(d.Message, true);
            }
        }