Exemplo n.º 1
0
        private void GetServers(int UserID)
        {
            try
            {
                cbServerAlias.Items.Clear();

                using (DataStuff sn = new DataStuff())
                {
                    DataTable dt = sn.GetServers(UserID);

                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow row in dt.Rows)
                        {
                            cbServerAlias.Items.Add(row["ServerAliasDesc"].ToString());
                        }
                    }
                }
            }

            catch
            {
                throw;
            }
        }
Exemplo n.º 2
0
        private void GetServers(int UserID)
        {
            int LastX   = 20;
            int LastY   = 20;
            int LastXSG = 20;
            int MaxY    = 0;

            string   ServerGroup = string.Empty;
            GroupBox CurGroupBox = null;

            try
            {
                using (DataStuff sn = new DataStuff())
                {
                    DataTable dt = sn.GetServers(UserID);

                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow row in dt.Rows)
                        {
                            if (row["ServerGroupDesc"].ToString() == ServerGroup)
                            {
                                CheckBox c = new CheckBox();
                                c.Parent          = CurGroupBox;
                                c.Name            = "c" + row["ServerAliasDesc"].ToString();
                                c.Text            = row["ServerAliasDesc"].ToString();
                                c.Left            = LastX;
                                c.Top             = LastY;
                                LastY             = c.Top + c.Height;
                                c.CheckedChanged += CheckBox_Clicked;

                                CurGroupBox.Height = LastY;

                                if (MaxY < CurGroupBox.Height)
                                {
                                    MaxY = CurGroupBox.Height + 10;
                                }

                                CurGroupBox.Height = MaxY;
                            }
                            else
                            {
                                GroupBox gbServerGroup = new GroupBox();

                                ServerGroup          = row["ServerGroupDesc"].ToString();
                                gbServerGroup.Parent = gbEnvironments;
                                gbServerGroup.Left   = LastXSG;
                                gbServerGroup.Top    = 18;
                                LastY = 20;
                                gbServerGroup.Name = "gbServerGroup" + ServerGroup;
                                LastXSG            = gbServerGroup.Left + gbServerGroup.Width + 20;
                                gbServerGroup.Text = ServerGroup;

                                CurGroupBox = gbServerGroup;

                                CheckBox c = new CheckBox();
                                c.Parent = CurGroupBox;
                                c.Name   = "c" + row["ServerAliasDesc"].ToString();
                                c.Text   = row["ServerAliasDesc"].ToString();
                                c.Left   = LastX;
                                c.Top    = LastY;
                                LastY    = c.Top + c.Height;

                                gbServerGroup.Height = LastY + 10;

                                c.CheckedChanged += CheckBox_Clicked;
                            }
                        }
                    }

                    gbEnvironments.Height = CurGroupBox.Top + MaxY + 10;
                    gbEnvironments.Width  = LastXSG;
                    this.Width            = gbEnvironments.Width + gbEnvironments.Left + 30;
                    this.Height           = gbEnvironments.Height + gbEnvironments.Top + 60 + cmdNext.Height;

                    cmdNext.Left   = gbEnvironments.Width + gbEnvironments.Left - cmdNext.Width;
                    cmdNext.Top    = gbEnvironments.Top + gbEnvironments.Height + 10;
                    cmdCancel.Top  = cmdNext.Top;
                    cmdCancel.Left = cmdNext.Left - cmdCancel.Width - 10;

                    cmdNext.Enabled = false;
                }
            }

            catch
            {
                throw;
            }
        }