Example #1
0
        /// <summary>
        /// Constructs the group box
        /// </summary>
        /// <param name="location">The location of the group box</param>
        /// <param name="size">The size of the group box</param>
        /// <param name="tabIndex">The tab index of the group box</param>
        public UnmatchedGroupBox(DeckMatcherForm owner, Point location, Size size, int tabIndex)
        {
            this.m_Owner = owner;

            this.SuspendLayout();

            // Set the group box properties
            this.Location = location;
            this.Size     = size;
            this.TabIndex = tabIndex;
            this.Name     = "UnmatchedGroupBox";
            this.TabStop  = false;
            this.Text     = "Unmatched";
            this.Enabled  = true;

            // Add the controls
            this.Controls.Add(new MatchButton(this,
                                              new Point(10, this.ClientRectangle.Bottom - 45),
                                              new Size(this.ClientRectangle.Width - 20, 35),
                                              0));
            this.m_Local = new LocalListBox(
                new Point(10, 40),
                new Size((this.ClientRectangle.Width / 2) - 20, this.ClientRectangle.Height - 95),
                1);
            this.Controls.Add(this.m_Local);
            this.m_Remote = new RemoteListBox(
                new Point(10 + (this.ClientRectangle.Width / 2), 40),
                new Size((this.ClientRectangle.Width / 2) - 20, this.ClientRectangle.Height - 95),
                2);
            this.Controls.Add(this.m_Remote);
            this.Controls.Add(new LabelHelper(new Point(10, 25), new Size(75, 15), "Local"));
            this.Controls.Add(new LabelHelper(new Point(10 + (this.ClientRectangle.Width / 2), 25), new Size(75, 15), "Remote"));

            this.ResumeLayout();
        }
        /// <summary>
        /// Constructs the group box
        /// </summary>
        /// <param name="location">The location of the group box</param>
        /// <param name="size">The size of the group box</param>
        /// <param name="tabIndex">The tab index of the group box</param>
        public UnmatchedGroupBox( DeckMatcherForm owner, Point location, Size size, int tabIndex )
        {
            this.m_Owner = owner;

            this.SuspendLayout();

            // Set the group box properties
            this.Location = location;
            this.Size = size;
            this.TabIndex = tabIndex;
            this.Name = "UnmatchedGroupBox";
            this.TabStop = false;
            this.Text = "Unmatched";
            this.Enabled = true;

            // Add the controls
            this.Controls.Add( new MatchButton( this,
                new Point(10, this.ClientRectangle.Bottom - 45),
                new Size(this.ClientRectangle.Width-20, 35),
                0 ) );
            this.m_Local = new LocalListBox(
                new Point(10, 40),
                new Size((this.ClientRectangle.Width/2)-20, this.ClientRectangle.Height - 95),
                1 );
            this.Controls.Add( this.m_Local );
            this.m_Remote = new RemoteListBox(
                new Point(10+(this.ClientRectangle.Width/2), 40),
                new Size((this.ClientRectangle.Width/2)-20, this.ClientRectangle.Height - 95),
                2 );
            this.Controls.Add( this.m_Remote );
            this.Controls.Add( new LabelHelper( new Point(10,25), new Size(75,15), "Local") );
            this.Controls.Add( new LabelHelper( new Point(10+(this.ClientRectangle.Width/2),25), new Size(75,15), "Remote") );

            this.ResumeLayout();
        }
Example #3
0
        private void LoadReg(int nId)
        {
            Clear_Reg();
            Sistema_bll   sistema_Class = new Sistema_bll(_connection);
            usuarioStruct reg           = sistema_Class.Retorna_Usuario(nId);

            IdLabel.Text                = Convert.ToInt32(reg.Id).ToString("0000");
            NomeCompletoTextBox.Text    = reg.Nome_completo;
            NomeLoginTextBox.Text       = reg.Nome_login;
            LocalComboBox.SelectedValue = reg.Setor_atual == null ? -1 : reg.Setor_atual;
            LocalTextBox.Text           = reg.Nome_setor;
            AtivoCheckbox.Checked       = reg.Ativo == 1?true:false;

            bExec = false;
            List <Usuariocc> ListaCC = sistema_Class.Lista_Usuario_Local(nId);

            foreach (Usuariocc item in ListaCC)
            {
                for (int i = 0; i < LocalListBox.Items.Count; i++)
                {
                    CustomListBoxItem linha = (CustomListBoxItem)LocalListBox.Items[i];
                    int nCodCC = linha._value;
                    if (nCodCC == item.Codigocc)
                    {
                        LocalListBox.SetItemChecked(i, true);
                    }
                }
            }
            bExec = true;
        }
Example #4
0
 private void Clear_Reg()
 {
     IdLabel.Text                = "0";
     NomeCompletoTextBox.Text    = "";
     NomeLoginTextBox.Text       = "";
     LocalComboBox.SelectedIndex = -1;
     AtivoCheckbox.Checked       = false;
     bExec = false;
     for (int i = 0; i < LocalComboBox.Items.Count; i++)
     {
         LocalListBox.SetItemChecked(i, false);
     }
     bExec = true;
 }
Example #5
0
        private void SaveReg()
        {
            int?              nLastCod;
            Sistema_bll       sistema_Class = new Sistema_bll(_connection);
            CustomListBoxItem cBoxItem      = (CustomListBoxItem)LocalComboBox.SelectedItem;

            if (bAddNew)
            {
                nLastCod = sistema_Class.Retorna_Ultimo_Codigo_Usuario();
                if (nLastCod == 0)
                {
                    nLastCod = 1;
                }
                else
                {
                    nLastCod++;
                }
            }
            else
            {
                nLastCod = Convert.ToInt32(IdLabel.Text);
            }
            GTI_Models.Models.Usuario reg = new GTI_Models.Models.Usuario {
                Nomecompleto = NomeCompletoTextBox.Text,
                Nomelogin    = NomeLoginTextBox.Text,
                Ativo        = AtivoCheckbox.Checked?(byte)1:(byte)0,
                Id           = (int)nLastCod,
                Setor_atual  = cBoxItem._value
            };

            Exception ex;

            if (bAddNew)
            {
                ex           = sistema_Class.Incluir_Usuario(reg);
                IdLabel.Text = Convert.ToInt32(nLastCod).ToString("0000");
            }
            else
            {
                ex = null;
                ex = sistema_Class.Alterar_Usuario(reg);
            }
            if (ex != null)
            {
                ErrorBox eBox = new ErrorBox("Atenção", ex.Message, ex);
                eBox.ShowDialog();
            }
            else
            {
                List <Usuariocc> Lista = new List <Usuariocc>();
                for (int i = 0; i < LocalListBox.Items.Count; i++)
                {
                    if (LocalListBox.GetItemCheckState(i) == CheckState.Checked)
                    {
                        Usuariocc         item         = new Usuariocc();
                        CustomListBoxItem selectedItem = (CustomListBoxItem)LocalListBox.Items[i];
                        item.Userid   = Convert.ToInt32(IdLabel.Text);
                        item.Codigocc = Convert.ToInt16(selectedItem._value);
                        Lista.Add(item);
                    }
                }
                ex = null;
                ex = sistema_Class.Alterar_Usuario_Local(Lista);
                if (ex != null)
                {
                    ErrorBox eBox = new ErrorBox("Atenção", ex.Message, ex);
                    eBox.ShowDialog();
                }
                else
                {
                    LocalTextBox.Text = LocalComboBox.Text;
                    ControlBehaviour(true);
                }
            }
        }