示例#1
0
        private void codigocboButtonEdit_Validated(object sender, EventArgs e)
        {
            if (!codigocboButtonEdit.IsModified)
            {
                return;
            }

            CBODTO cbo = new CBODTO();

            if (codigocboButtonEdit.Text.Trim() != string.Empty && codigocboButtonEdit.Text.Trim() != "0" && this.Enabled == true)
            {
                try
                {
                    cbo = cboGL.GetCBOCodigo(codigocboButtonEdit.Text.Trim());
                    descricaocboTextEdit.Text = cbo.Descricao;
                }
                catch
                {
                    cbo.Codigo = codigocboButtonEdit.Text;
                    descricaocboTextEdit.Text = string.Empty;

                    Cursor = Cursors.WaitCursor;
                    frmGridCBO frmgridcbo = new frmGridCBO(this, new Global.SystemDelegate(SetCBO));
                    frmgridcbo.Show();
                    Cursor = Cursors.Default;
                }
            }
            else
            {
                descricaocboTextEdit.Text = string.Empty;
            }
            funcaoDTO.CBO = cbo;
        }
示例#2
0
        public frmUpdateCBO(Form frm, Enumeradores.TipoOperacao tpo, BindingSource bnd)
        {
            InitializeComponent();

            try
            {
                frmGrid    = frm;
                tpOperacao = tpo;
                bndCBOGrid = bnd;

                MdiParent = frmGrid.MdiParent;

                if (tpOperacao.Equals(Enumeradores.TipoOperacao.Insert))
                {
                    CBODTOBindingSource.AddNew();
                }
                else
                {
                    cboDTO = (CBODTO)bndCBOGrid.Current;
                    CBODTOBindingSource.DataSource = cboGL.GetCBO(cboDTO.Id);
                }

                cboDTO = (CBODTO)CBODTOBindingSource.Current;
            }
            catch
            {
                throw;
            }
        }
示例#3
0
        private void Excluir()
        {
            if (MessageBox.Show("Deseja realmente excluir ?", "Atenção", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                cboDTO = (CBODTO)CBODTOBindingSource.Current;

                try
                {
                    cboGL.Delete(cboDTO.Id);
                    CBODTOBindingSource.RemoveCurrent();
                }
                catch
                {
                    throw;
                }
            }
        }
示例#4
0
        private void gridView_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e)
        {
            CBODTO item = (CBODTO)CBODTOBindingSource[e.ListSourceRowIndex];

            if (e.Column.FieldName == "Grupo.Descricao" && e.ListSourceRowIndex >= 0 && e.IsGetData)
            {
                switch (item.Grupo)
                {
                case "O":
                    e.Value = "Ocupação";
                    break;

                case "S":
                    e.Value = "Sinônimo";
                    break;

                default:
                    e.Value = item.Grupo;
                    break;
                }
            }
        }
示例#5
0
        /// <summary>
        /// Retorna uma lista de objetos FuncaoDTO caso a instrução seja bem sucedida.
        /// </summary>
        public List <FuncaoDTO> GetGridFuncao(string campo, string valorPesquisa)
        {
            try
            {
                dbCommand = db.GetStoredProcCommand(Global.EmpresaAtiva + ".GetGridFuncao");
                db.AddInParameter(dbCommand, "campo", DbType.String, campo);
                db.AddInParameter(dbCommand, "valorPesquisa", DbType.String, valorPesquisa);

                using (IDataReader DR = db.ExecuteReader(dbCommand))
                {
                    List <FuncaoDTO> List = new List <FuncaoDTO>();
                    while (DR.Read())
                    {
                        FuncaoDTO tab = new FuncaoDTO();
                        tab.Id = int.Parse(DR["id"].ToString());

                        //CBO
                        CBODTO cbo = new CBODTO();
                        cbo.Codigo = DR["cbo"].ToString();
                        tab.CBO    = cbo;
                        //

                        tab.Nome                  = DR["nome"].ToString();
                        tab.Salariofuncao         = decimal.Parse(DR["salariofuncao"].ToString());
                        tab.Salariotipo.Descricao = DR["descricao"].ToString();

                        List.Add(tab);
                    }
                    return(List);
                }
            }
            catch
            {
                throw;
            }
        }