Esempio n. 1
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                if (!ValidarIngreso())
                {
                    WorkAreaBL objBL_Area = new WorkAreaBL();
                    WorkAreaBE objArea    = new WorkAreaBE();

                    objArea.IdWorkArea   = IdWorkArea;
                    objArea.NameWorkArea = txtDescripcion.Text;
                    objArea.FlagState    = true;
                    objArea.Login        = Parametros.strUsuarioLogin;
                    objArea.Machine      = WindowsIdentity.GetCurrent().Name.ToString();
                    objArea.IdCompany    = Parametros.intEmpresaId;

                    if (pOperacion == Operacion.Nuevo)
                    {
                        objBL_Area.Inserta(objArea);
                    }
                    else
                    {
                        objBL_Area.Actualiza(objArea);
                    }

                    this.Close();
                }
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        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())
                    {
                        WorkAreaBE objE_Area = new WorkAreaBE();
                        objE_Area.IdWorkArea = int.Parse(gvArea.GetFocusedRowCellValue("IdWorkArea").ToString());
                        objE_Area.Login      = Parametros.strUsuarioLogin;
                        objE_Area.Machine    = WindowsIdentity.GetCurrent().Name.ToString();
                        objE_Area.IdCompany  = Parametros.intEmpresaId;

                        WorkAreaBL objBL_Area = new WorkAreaBL();
                        objBL_Area.Elimina(objE_Area);
                        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 void Elimina(WorkAreaBE pItem)
 {
     try
     {
         WorkAreaDL WorkArea = new WorkAreaDL();
         WorkArea.Elimina(pItem);
     }
     catch (Exception ex)
     { throw ex; }
 }
 public void Actualiza(WorkAreaBE pItem)
 {
     try
     {
         WorkAreaDL WorkArea = new WorkAreaDL();
         WorkArea.Actualiza(pItem);
     }
     catch (Exception ex)
     { throw ex; }
 }
 public void Inserta(WorkAreaBE pItem)
 {
     try
     {
         WorkAreaDL WorkArea = new WorkAreaDL();
         WorkArea.Inserta(pItem);
     }
     catch (Exception ex)
     { throw ex; }
 }
 public WorkAreaBE SeleccionaDescripcion(int IdCompany, string NameWorkArea)
 {
     try
     {
         WorkAreaDL WorkArea = new WorkAreaDL();
         WorkAreaBE objEmp   = WorkArea.SeleccionaDescripcion(IdCompany, NameWorkArea);
         return(objEmp);
     }
     catch (Exception ex)
     { throw ex; }
 }
 public WorkAreaBE Selecciona(int IdCompany, int IdWorkArea)
 {
     try
     {
         WorkAreaDL WorkArea = new WorkAreaDL();
         WorkAreaBE objEmp   = WorkArea.Selecciona(IdCompany, IdWorkArea);
         return(objEmp);
     }
     catch (Exception ex)
     { throw ex; }
 }
Esempio n. 8
0
        public void Elimina(WorkAreaBE pItem)
        {
            Database  db        = DatabaseFactory.CreateDatabase("cnERPBD");
            DbCommand dbCommand = db.GetStoredProcCommand("usp_WorkArea_Elimina");

            db.AddInParameter(dbCommand, "pIdWorkArea", DbType.Int32, pItem.IdWorkArea);
            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);
        }
Esempio n. 9
0
        private void frmManAreaEdit_Load(object sender, EventArgs e)
        {
            if (pOperacion == Operacion.Nuevo)
            {
                this.Text = "Work Area - New";
            }
            else if (pOperacion == Operacion.Modificar)
            {
                this.Text = "Work Area - Update";
                WorkAreaBE objE_Area = null;
                objE_Area = new WorkAreaBL().Selecciona(Parametros.intEmpresaId, IdWorkArea);
                if (objE_Area != null)
                {
                    txtDescripcion.Text = objE_Area.NameWorkArea.Trim();
                }
            }

            txtDescripcion.Select();
        }
        public void InicializarModificar()
        {
            if (gvArea.RowCount > 0)
            {
                WorkAreaBE objArea = new WorkAreaBE();

                objArea.IdWorkArea = int.Parse(gvArea.GetFocusedRowCellValue("IdWorkArea").ToString());

                frmManAreaEdit objManAreaEdit = new frmManAreaEdit();
                objManAreaEdit.pOperacion    = frmManAreaEdit.Operacion.Modificar;
                objManAreaEdit.IdWorkArea    = objArea.IdWorkArea;
                objManAreaEdit.pWorkAreaBE   = objArea;
                objManAreaEdit.StartPosition = FormStartPosition.CenterParent;
                objManAreaEdit.ShowDialog();

                Cargar();
            }
            else
            {
                MessageBox.Show("No se pudo editar");
            }
        }
Esempio n. 11
0
        public WorkAreaBE SeleccionaDescripcion(int IdCompany, string NameWorkArea)
        {
            Database  db        = DatabaseFactory.CreateDatabase("cnERPBD");
            DbCommand dbCommand = db.GetStoredProcCommand("usp_WorkArea_SeleccionaDescripcion");

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

            IDataReader reader   = db.ExecuteReader(dbCommand);
            WorkAreaBE  WorkArea = null;

            while (reader.Read())
            {
                WorkArea              = new WorkAreaBE();
                WorkArea.IdWorkArea   = Int32.Parse(reader["idWorkArea"].ToString());
                WorkArea.IdCompany    = Int32.Parse(reader["IdCompany"].ToString());
                WorkArea.NameWorkArea = reader["NameWorkArea"].ToString();
                WorkArea.FlagState    = Boolean.Parse(reader["FlagState"].ToString());
            }
            reader.Close();
            reader.Dispose();
            return(WorkArea);
        }
Esempio n. 12
0
        public List <WorkAreaBE> ListaTodosActivo(int IdCompany)
        {
            Database  db        = DatabaseFactory.CreateDatabase("cnERPBD");
            DbCommand dbCommand = db.GetStoredProcCommand("usp_WorkArea_ListaTodosActivo");

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

            IDataReader       reader       = db.ExecuteReader(dbCommand);
            List <WorkAreaBE> WorkArealist = new List <WorkAreaBE>();
            WorkAreaBE        WorkArea;

            while (reader.Read())
            {
                WorkArea              = new WorkAreaBE();
                WorkArea.IdWorkArea   = Int32.Parse(reader["idWorkArea"].ToString());
                WorkArea.IdCompany    = Int32.Parse(reader["IdCompany"].ToString());
                WorkArea.NameWorkArea = reader["NameWorkArea"].ToString();
                WorkArea.FlagState    = Boolean.Parse(reader["FlagState"].ToString());
                WorkArealist.Add(WorkArea);
            }
            reader.Close();
            reader.Dispose();
            return(WorkArealist);
        }