private void tlbMenu_DeleteClick()
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                if (XtraMessageBox.Show("Be sure to delete the record?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (!ValidarIngreso())
                    {
                        CorporationBE objE_Corporation = new CorporationBE();
                        objE_Corporation.IdCorporation = int.Parse(gvCorporation.GetFocusedRowCellValue("IdCorporation").ToString());
                        objE_Corporation.Login         = Parametros.strUsuarioLogin;
                        objE_Corporation.Machine       = WindowsIdentity.GetCurrent().Name.ToString();
                        objE_Corporation.IdCompany     = Parametros.intEmpresaId;

                        CorporationBL objBL_Corporation = new CorporationBL();
                        objBL_Corporation.Elimina(objE_Corporation);
                        XtraMessageBox.Show("The record was successfully deleted.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Cargar();
                    }
                }
                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public List <CorporationBE> ListaTodosActivo(int IdCompany)
        {
            Database  db        = DatabaseFactory.CreateDatabase("cnERPBD");
            DbCommand dbCommand = db.GetStoredProcCommand("usp_Corporation_ListaTodosActivo");

            db.AddInParameter(dbCommand, "pIdCompany", DbType.Int32, IdCompany);

            IDataReader          reader          = db.ExecuteReader(dbCommand);
            List <CorporationBE> Corporationlist = new List <CorporationBE>();
            CorporationBE        Corporation;

            while (reader.Read())
            {
                Corporation = new CorporationBE();
                Corporation.IdCorporation   = Int32.Parse(reader["idCorporation"].ToString());
                Corporation.IdCompany       = Int32.Parse(reader["IdCompany"].ToString());
                Corporation.NameCorporation = reader["NameCorporation"].ToString();
                Corporation.FrefixInvoice   = reader["FrefixInvoice"].ToString();
                Corporation.FlagState       = Boolean.Parse(reader["FlagState"].ToString());
                Corporationlist.Add(Corporation);
            }
            reader.Close();
            reader.Dispose();
            return(Corporationlist);
        }
Exemple #3
0
 public void Elimina(CorporationBE pItem)
 {
     try
     {
         CorporationDL Corporation = new CorporationDL();
         Corporation.Elimina(pItem);
     }
     catch (Exception ex)
     { throw ex; }
 }
Exemple #4
0
 public void Actualiza(CorporationBE pItem)
 {
     try
     {
         CorporationDL Corporation = new CorporationDL();
         Corporation.Actualiza(pItem);
     }
     catch (Exception ex)
     { throw ex; }
 }
Exemple #5
0
 public CorporationBE SeleccionaDescripcion(int IdCompany, string NameCorporation)
 {
     try
     {
         CorporationDL Corporation = new CorporationDL();
         CorporationBE objEmp      = Corporation.SeleccionaDescripcion(IdCompany, NameCorporation);
         return(objEmp);
     }
     catch (Exception ex)
     { throw ex; }
 }
Exemple #6
0
 public CorporationBE Selecciona(int IdCorporation)
 {
     try
     {
         CorporationDL Corporation = new CorporationDL();
         CorporationBE objEmp      = Corporation.Selecciona(IdCorporation);
         return(objEmp);
     }
     catch (Exception ex)
     { throw ex; }
 }
        public void Elimina(CorporationBE pItem)
        {
            Database  db        = DatabaseFactory.CreateDatabase("cnERPBD");
            DbCommand dbCommand = db.GetStoredProcCommand("usp_Corporation_Elimina");

            db.AddInParameter(dbCommand, "pIdCorporation", DbType.Int32, pItem.IdCorporation);
            db.AddInParameter(dbCommand, "pIdCompany", DbType.Int32, pItem.IdCompany);
            db.AddInParameter(dbCommand, "pLogin", DbType.String, pItem.Login);
            db.AddInParameter(dbCommand, "pMachine", DbType.String, pItem.Machine);

            db.ExecuteNonQuery(dbCommand);
        }
        public void Actualiza(CorporationBE pItem)
        {
            Database  db        = DatabaseFactory.CreateDatabase("cnERPBD");
            DbCommand dbCommand = db.GetStoredProcCommand("usp_Corporation_Actualiza");

            db.AddInParameter(dbCommand, "pIdCorporation", DbType.Int32, pItem.IdCorporation);
            db.AddInParameter(dbCommand, "pIdCompany", DbType.Int32, pItem.IdCompany);
            db.AddInParameter(dbCommand, "pNameCorporation", DbType.String, pItem.NameCorporation);
            db.AddInParameter(dbCommand, "pFrefixInvoice", DbType.String, pItem.FrefixInvoice);
            db.AddInParameter(dbCommand, "pFlagState", DbType.Boolean, pItem.FlagState);
            db.AddInParameter(dbCommand, "pLogin", DbType.String, pItem.Login);
            db.AddInParameter(dbCommand, "pMachine", DbType.String, pItem.Machine);

            db.ExecuteNonQuery(dbCommand);
        }
        private void frmManCorporationEdit_Load(object sender, EventArgs e)
        {
            if (pOperacion == Operacion.Nuevo)
            {
                this.Text = "Corporation - New";
            }
            else if (pOperacion == Operacion.Modificar)
            {
                this.Text = "Corporation - Update";
                CorporationBE objE_Corporation = null;
                objE_Corporation = new CorporationBL().Selecciona(IdCorporation);
                if (objE_Corporation != null)
                {
                    txtDescripcion.Text = objE_Corporation.NameCorporation.Trim();
                    txtPrefix.Text      = objE_Corporation.FrefixInvoice;
                }
            }

            txtDescripcion.Select();
        }
        public void InicializarModificar()
        {
            if (gvCorporation.RowCount > 0)
            {
                CorporationBE objCorporation = new CorporationBE();

                objCorporation.IdCorporation = int.Parse(gvCorporation.GetFocusedRowCellValue("IdCorporation").ToString());

                frmManCorporationEdit objManCorporationEdit = new frmManCorporationEdit();
                objManCorporationEdit.pOperacion     = frmManCorporationEdit.Operacion.Modificar;
                objManCorporationEdit.IdCorporation  = objCorporation.IdCorporation;
                objManCorporationEdit.pCorporationBE = objCorporation;
                objManCorporationEdit.StartPosition  = FormStartPosition.CenterParent;
                objManCorporationEdit.ShowDialog();

                Cargar();
            }
            else
            {
                MessageBox.Show("No se pudo editar");
            }
        }
        public CorporationBE Selecciona(int IdCorporation)
        {
            Database  db        = DatabaseFactory.CreateDatabase("cnERPBD");
            DbCommand dbCommand = db.GetStoredProcCommand("usp_Corporation_Selecciona");

            db.AddInParameter(dbCommand, "pidCorporation", DbType.Int32, IdCorporation);

            IDataReader   reader      = db.ExecuteReader(dbCommand);
            CorporationBE Corporation = null;

            while (reader.Read())
            {
                Corporation = new CorporationBE();
                Corporation.IdCorporation   = Int32.Parse(reader["idCorporation"].ToString());
                Corporation.IdCompany       = Int32.Parse(reader["IdCompany"].ToString());
                Corporation.NameCorporation = reader["NameCorporation"].ToString();
                Corporation.FrefixInvoice   = reader["FrefixInvoice"].ToString();
                Corporation.FlagState       = Boolean.Parse(reader["FlagState"].ToString());
            }
            reader.Close();
            reader.Dispose();
            return(Corporation);
        }
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                if (!ValidarIngreso())
                {
                    CorporationBL objBL_Corporation = new CorporationBL();
                    CorporationBE objCorporation    = new CorporationBE();

                    objCorporation.IdCorporation   = IdCorporation;
                    objCorporation.NameCorporation = txtDescripcion.Text;
                    objCorporation.FrefixInvoice   = txtPrefix.Text;
                    objCorporation.FlagState       = true;
                    objCorporation.Login           = Parametros.strUsuarioLogin;
                    objCorporation.Machine         = WindowsIdentity.GetCurrent().Name.ToString();
                    objCorporation.IdCompany       = Parametros.intEmpresaId;

                    if (pOperacion == Operacion.Nuevo)
                    {
                        objBL_Corporation.Inserta(objCorporation);
                    }
                    else
                    {
                        objBL_Corporation.Actualiza(objCorporation);
                    }

                    this.Close();
                }
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }