public void Actualiza(EppBE pItem) { Database db = DatabaseFactory.CreateDatabase("cnSSOMABD"); DbCommand dbCommand = db.GetStoredProcCommand("usp_Epp_Actualiza"); db.AddInParameter(dbCommand, "pIdEpp", DbType.Int32, pItem.IdEpp); db.AddInParameter(dbCommand, "pIdEmpresa", DbType.Int32, pItem.IdEmpresa); db.AddInParameter(dbCommand, "pIdUnidadMinera", DbType.Int32, pItem.IdUnidadMinera); db.AddInParameter(dbCommand, "pIdArea", DbType.Int32, pItem.IdArea); db.AddInParameter(dbCommand, "pNumero", DbType.String, pItem.Numero); db.AddInParameter(dbCommand, "pIdSolicitudEpp", DbType.Int32, pItem.IdSolicitudEpp); db.AddInParameter(dbCommand, "pIdPersona", DbType.Int32, pItem.IdPersona); db.AddInParameter(dbCommand, "pIdEmpresaResponsable", DbType.Int32, pItem.IdEmpresaResponsable); db.AddInParameter(dbCommand, "pIdUnidadMineraResponsable", DbType.Int32, pItem.IdUnidadMineraResponsable); db.AddInParameter(dbCommand, "pIdAreaResponsable", DbType.Int32, pItem.IdAreaResponsable); db.AddInParameter(dbCommand, "pIdSectorResponsable", DbType.Int32, pItem.IdSectorResponsable); db.AddInParameter(dbCommand, "pFecha", DbType.DateTime, pItem.Fecha); db.AddInParameter(dbCommand, "pDescOrdenInterna", DbType.String, pItem.DescOrdenInterna); db.AddInParameter(dbCommand, "pObservacion", DbType.String, pItem.Observacion); db.AddInParameter(dbCommand, "pFlagEstado", DbType.Boolean, pItem.FlagEstado); db.AddInParameter(dbCommand, "pUsuario", DbType.String, pItem.Usuario); db.AddInParameter(dbCommand, "pMaquina", DbType.String, pItem.Maquina); db.ExecuteNonQuery(dbCommand); }
public void Actualiza(EppBE pItem, List <EppDetalleBE> pListaEppDetalle) { try { using (TransactionScope ts = new TransactionScope()) { EppDL Epp = new EppDL(); EppDetalleDL EppDetalle = new EppDetalleDL(); foreach (EppDetalleBE item in pListaEppDetalle) { if (item.TipoOper == Convert.ToInt32(Operacion.Nuevo)) //Nuevo { item.IdEpp = pItem.IdEpp; EppDetalle.Inserta(item); } else { EppDetalle.Actualiza(item); } } Epp.Actualiza(pItem); ts.Complete(); } } catch (Exception ex) { throw ex; } }
private void tlbMenu_DeleteClick() { try { Cursor = Cursors.WaitCursor; if (XtraMessageBox.Show("Esta seguro de eliminar el registro?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (!ValidarIngreso()) { EppBE objE_Epp = new EppBE(); objE_Epp.IdEpp = int.Parse(gvEpp.GetFocusedRowCellValue("IdEpp").ToString()); objE_Epp.IdSolicitudEpp = int.Parse(gvEpp.GetFocusedRowCellValue("IdSolicitudEpp").ToString()); objE_Epp.Usuario = Parametros.strUsuarioLogin; objE_Epp.Maquina = WindowsIdentity.GetCurrent().Name.ToString(); objE_Epp.IdEmpresa = Parametros.intEmpresaId; EppBL objBL_Epp = new EppBL(); objBL_Epp.Elimina(objE_Epp); XtraMessageBox.Show("El registro se eliminó correctamente", 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 Int32 Inserta(EppBE pItem, List <EppDetalleBE> pListaEppDetalle) { try { using (TransactionScope ts = new TransactionScope()) { EppDL Epp = new EppDL(); EppDetalleDL EppDetalle = new EppDetalleDL(); int IdEpp = 0; IdEpp = Epp.Inserta(pItem); string strNumero = ""; strNumero = AgregarCaracter(IdEpp.ToString(), "0", 7); foreach (var item in pListaEppDetalle) { int IdKardex = 0; //INSERTAR KARDEX KardexBE objE_Kardex = new KardexBE(); objE_Kardex.IdKardex = 0; objE_Kardex.IdEmpresa = pItem.IdEmpresaResponsable; objE_Kardex.IdUnidadMinera = pItem.IdUnidadMineraResponsable; objE_Kardex.DescOrdenInterna = pItem.DescOrdenInterna; objE_Kardex.IdEquipo = item.IdEquipo; objE_Kardex.Periodo = pItem.Fecha.Year; objE_Kardex.FechaMovimiento = Convert.ToDateTime(pItem.Fecha); objE_Kardex.Cantidad = item.Cantidad; objE_Kardex.NumeroDocumento = strNumero; objE_Kardex.Observacion = "SALIDA POR ENTREGA DE EPP"; objE_Kardex.TipoMovimiento = "S"; objE_Kardex.FlagEstado = true; objE_Kardex.Usuario = pItem.Usuario; objE_Kardex.Maquina = pItem.Maquina; KardexDL objDL_Kardex = new KardexDL(); IdKardex = objDL_Kardex.Inserta(objE_Kardex); item.IdEpp = IdEpp; item.IdKardex = IdKardex; EppDetalle.Inserta(item); } //Actualizamos la solicitud del EPP SolicitudEppDL objDL_SolicitudEPP = new SolicitudEppDL(); objDL_SolicitudEPP.ActualizaSituacion(pItem.IdSolicitudEpp, Parametros.intSLCAtendido); ts.Complete(); return(IdEpp); } } catch (Exception ex) { throw ex; } }
public EppBE Selecciona(int IdEpp) { try { EppDL Epp = new EppDL(); EppBE objEmp = Epp.Selecciona(IdEpp); return(objEmp); } catch (Exception ex) { throw ex; } }
public EppBE SeleccionaNumero(int Numero) { try { EppDL Epp = new EppDL(); EppBE objEmp = Epp.SeleccionaNumero(Numero); return(objEmp); } catch (Exception ex) { throw ex; } }
public void Elimina(EppBE pItem) { Database db = DatabaseFactory.CreateDatabase("cnSSOMABD"); DbCommand dbCommand = db.GetStoredProcCommand("usp_Epp_Elimina"); db.AddInParameter(dbCommand, "pIdEpp", DbType.Int32, pItem.IdEpp); db.AddInParameter(dbCommand, "pIdEmpresa", DbType.Int32, pItem.IdEmpresa); db.AddInParameter(dbCommand, "pUsuario", DbType.String, pItem.Usuario); db.AddInParameter(dbCommand, "pMaquina", DbType.String, pItem.Maquina); db.ExecuteNonQuery(dbCommand); }
public void Elimina(EppBE pItem) { try { using (TransactionScope ts = new TransactionScope()) { EppDL Epp = new EppDL(); EppDetalleDL EppDetalle = new EppDetalleDL(); EppBE objE_Epp = new EppBE(); objE_Epp = Epp.Selecciona(pItem.IdEpp); List <EppDetalleBE> lstEppDetalle = null; lstEppDetalle = new EppDetalleDL().ListaTodosActivo(pItem.IdEpp); foreach (EppDetalleBE item in lstEppDetalle) { int IdKardex = 0; //Insertar Kardex KardexBE objE_Kardex = new KardexBE(); objE_Kardex.IdKardex = 0; objE_Kardex.IdEmpresa = objE_Epp.IdEmpresaResponsable; objE_Kardex.IdUnidadMinera = objE_Epp.IdUnidadMineraResponsable; objE_Kardex.DescOrdenInterna = objE_Epp.DescOrdenInterna; objE_Kardex.IdEquipo = item.IdEquipo; objE_Kardex.Periodo = objE_Epp.Fecha.Year; objE_Kardex.FechaMovimiento = Convert.ToDateTime(objE_Epp.Fecha); objE_Kardex.Cantidad = item.Cantidad; objE_Kardex.NumeroDocumento = objE_Epp.Numero; objE_Kardex.Observacion = "INGRESO POR ANULACIÓN DE ENTREGA DE EPP"; objE_Kardex.TipoMovimiento = "I"; objE_Kardex.FlagEstado = true; objE_Kardex.Usuario = pItem.Usuario; objE_Kardex.Maquina = pItem.Maquina; KardexDL objDL_Kardex = new KardexDL(); IdKardex = objDL_Kardex.Inserta(objE_Kardex); EppDetalle.Elimina(item); } Epp.Elimina(pItem); //Actualizamos la solicitud del EPP SolicitudEppDL objDL_SolicitudEPP = new SolicitudEppDL(); objDL_SolicitudEPP.ActualizaSituacion(pItem.IdSolicitudEpp, Parametros.intSLCPendiente); ts.Complete(); } } catch (Exception ex) { throw ex; } }
public List <EppBE> ListaFechaResponsable(int IdEmpresaResponsable, int IdUnidadMineraResponsable, int IdAreaResponsable, int IdResponsable, DateTime FechaDesde, DateTime FechaHasta) { Database db = DatabaseFactory.CreateDatabase("cnSSOMABD"); DbCommand dbCommand = db.GetStoredProcCommand("usp_Epp_ListaFechaResponsable"); db.AddInParameter(dbCommand, "pIdEmpresaResponsable", DbType.Int32, IdEmpresaResponsable); db.AddInParameter(dbCommand, "pIdUnidadMineraResponsable", DbType.Int32, IdUnidadMineraResponsable); db.AddInParameter(dbCommand, "pIdAreaResponsable", DbType.Int32, IdAreaResponsable); db.AddInParameter(dbCommand, "pIdResponsable", DbType.Int32, IdResponsable); db.AddInParameter(dbCommand, "pFechaDesde", DbType.DateTime, FechaDesde); db.AddInParameter(dbCommand, "pFechaHasta", DbType.DateTime, FechaHasta); IDataReader reader = db.ExecuteReader(dbCommand); List <EppBE> Epplist = new List <EppBE>(); EppBE Epp; while (reader.Read()) { Epp = new EppBE(); Epp.IdEpp = Int32.Parse(reader["idEpp"].ToString()); Epp.IdEmpresa = Int32.Parse(reader["IdEmpresa"].ToString()); Epp.RazonSocial = reader["RazonSocial"].ToString(); Epp.IdUnidadMinera = Int32.Parse(reader["IdUnidadMinera"].ToString()); Epp.DescUnidadMinera = reader["DescUnidadMinera"].ToString(); Epp.IdArea = Int32.Parse(reader["IdArea"].ToString()); Epp.DescArea = reader["DescArea"].ToString(); Epp.Numero = reader["Numero"].ToString(); Epp.IdSolicitudEpp = Int32.Parse(reader["IdSolicitudEpp"].ToString()); Epp.NumeroSolicitud = reader["NumeroSolicitud"].ToString(); Epp.IdPersona = Int32.Parse(reader["IdPersona"].ToString()); Epp.Responsable = reader["Responsable"].ToString(); Epp.Cargo = reader["Cargo"].ToString(); Epp.DescNegocio = reader["DescNegocio"].ToString(); Epp.IdEmpresaResponsable = Int32.Parse(reader["IdEmpresaResponsable"].ToString()); Epp.EmpresaResponsable = reader["EmpresaResponsable"].ToString(); Epp.IdUnidadMineraResponsable = Int32.Parse(reader["IdUnidadMineraResponsable"].ToString()); Epp.UnidadMineraResponsable = reader["UnidadMineraResponsable"].ToString(); Epp.IdAreaResponsable = Int32.Parse(reader["IdAreaResponsable"].ToString()); Epp.AreaResponsable = reader["AreaResponsable"].ToString(); Epp.IdSectorResponsable = Int32.Parse(reader["IdSectorResponsable"].ToString()); Epp.SectorResponsable = reader["SectorResponsable"].ToString(); Epp.Fecha = DateTime.Parse(reader["Fecha"].ToString()); Epp.DescOrdenInterna = reader["DescOrdenInterna"].ToString(); Epp.Observacion = reader["Observacion"].ToString(); Epp.FlagEstado = Boolean.Parse(reader["flagestado"].ToString()); Epplist.Add(Epp); } reader.Close(); reader.Dispose(); return(Epplist); }
private void frmRegEppEdit_Load(object sender, EventArgs e) { gvEppDetalle.OptionsView.ShowFooter = true; gvEppDetalle.Layout += new EventHandler(gvEppDetalle_Layout); deFecha.EditValue = DateTime.Now; BSUtils.LoaderLook(cboOrdenInterna, new OrdenInternaBL().ListaTodosActivo(Parametros.intEmpresaId, Parametros.intUnidadMineraId), "DescOrdenInterna", "IdOrdenInterna", true); if (pOperacion == Operacion.Nuevo) { this.Text = "Registro de Epp - Nuevo "; } else if (pOperacion == Operacion.Modificar) { this.Text = "Registro de Epp - Modificar "; EppBE objE_Epp = null; objE_Epp = new EppBL().Selecciona(IdEpp); if (objE_Epp != null) { IdEpp = objE_Epp.IdEpp; intIdEmpresa = objE_Epp.IdEmpresa; intIdUnidadMinera = objE_Epp.IdUnidadMinera; intIdArea = objE_Epp.IdArea; intIdSolicitudEpp = objE_Epp.IdSolicitudEpp; txtNumeroSolicitud.Text = objE_Epp.NumeroSolicitud; txtNumero.Text = objE_Epp.Numero; intIdPersona = objE_Epp.IdPersona; txtResponsable.Text = objE_Epp.Responsable; txtCargo.Text = objE_Epp.Cargo; intIdEmpresaResponsable = objE_Epp.IdEmpresaResponsable; txtEmpresaResponsable.Text = objE_Epp.EmpresaResponsable; intIdUnidadMineraResponsable = objE_Epp.IdUnidadMineraResponsable; txtUnidadMineraResponsable.Text = objE_Epp.UnidadMineraResponsable; intIdAreaResponsable = objE_Epp.IdAreaResponsable; txtAreaResponsable.Text = objE_Epp.AreaResponsable; intIdSectorResponsable = objE_Epp.IdSectorResponsable; txtSectorResponsable.Text = objE_Epp.SectorResponsable; txtDescNegocio.Text = objE_Epp.DescNegocio; deFecha.EditValue = objE_Epp.Fecha; cboOrdenInterna.Text = objE_Epp.DescOrdenInterna; txtObservacion.Text = objE_Epp.Observacion; } } CargaEppDetalle(); AttachSummaryEPP(); txtNumeroSolicitud.Select(); }
public List <EppBE> ListaPorVencer(int IdEmpresa, int IdUnidadMinera, int IdArea, int Dias) { Database db = DatabaseFactory.CreateDatabase("cnSSOMABD"); DbCommand dbCommand = db.GetStoredProcCommand("usp_Epp_ListaPorVencer"); db.AddInParameter(dbCommand, "pIdEmpresa", DbType.Int32, IdEmpresa); db.AddInParameter(dbCommand, "pIdUnidadMinera", DbType.Int32, IdUnidadMinera); db.AddInParameter(dbCommand, "pIdArea", DbType.Int32, IdArea); db.AddInParameter(dbCommand, "pDias", DbType.Int32, Dias); IDataReader reader = db.ExecuteReader(dbCommand); List <EppBE> Epplist = new List <EppBE>(); EppBE Epp; while (reader.Read()) { Epp = new EppBE(); Epp.RazonSocial = reader["RazonSocial"].ToString(); Epp.DescUnidadMinera = reader["DescUnidadMinera"].ToString(); Epp.DescArea = reader["DescArea"].ToString(); Epp.Numero = reader["Numero"].ToString(); Epp.NumeroSolicitud = reader["NumeroSolicitud"].ToString(); Epp.Responsable = reader["Responsable"].ToString(); Epp.EmpresaResponsable = reader["EmpresaResponsable"].ToString(); Epp.UnidadMineraResponsable = reader["UnidadMineraResponsable"].ToString(); Epp.AreaResponsable = reader["AreaResponsable"].ToString(); Epp.SectorResponsable = reader["SectorResponsable"].ToString(); Epp.Cargo = reader["Cargo"].ToString(); Epp.DescNegocio = reader["DescNegocio"].ToString(); Epp.Fecha = DateTime.Parse(reader["Fecha"].ToString()); Epp.DescOrdenInterna = reader["DescOrdenInterna"].ToString(); Epp.Observacion = reader["Observacion"].ToString(); Epp.Item = Int32.Parse(reader["Item"].ToString()); Epp.Codigo = reader["Codigo"].ToString(); Epp.DescEquipo = reader["DescEquipo"].ToString(); Epp.FechaVencimiento = DateTime.Parse(reader["FechaVencimiento"].ToString()); Epp.Cantidad = Int32.Parse(reader["Cantidad"].ToString()); Epp.Precio = Decimal.Parse(reader["Precio"].ToString()); Epp.Total = Decimal.Parse(reader["Total"].ToString()); Epp.DescTipoEntrega = reader["DescTipoEntrega"].ToString(); Epp.Dias = Int32.Parse(reader["Dias"].ToString()); Epplist.Add(Epp); } reader.Close(); reader.Dispose(); return(Epplist); }
public void InicializarModificar() { if (gvEpp.RowCount > 0) { EppBE objEpp = new EppBE(); objEpp.IdEpp = int.Parse(gvEpp.GetFocusedRowCellValue("IdEpp").ToString()); frmRegEppEdit objManEppEdit = new frmRegEppEdit(); objManEppEdit.pOperacion = frmRegEppEdit.Operacion.Modificar; objManEppEdit.IdEpp = objEpp.IdEpp; objManEppEdit.StartPosition = FormStartPosition.CenterParent; objManEppEdit.ShowDialog(); Cargar(); } else { MessageBox.Show("No se pudo editar"); } }
private void btnGrabar_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; if (!ValidarIngreso()) { EppBE objEpp = new EppBE(); EppBL objBL_Epp = new EppBL(); StringBuilder strMensaje = new StringBuilder(); objEpp.IdEpp = IdEpp; objEpp.IdEmpresa = Parametros.intEmpresaId; objEpp.IdUnidadMinera = Parametros.intUnidadMineraId; objEpp.Numero = txtNumero.Text; objEpp.IdSolicitudEpp = intIdSolicitudEpp; objEpp.IdPersona = intIdPersona; objEpp.IdEmpresaResponsable = intIdEmpresaResponsable; objEpp.IdUnidadMineraResponsable = intIdUnidadMineraResponsable; objEpp.IdAreaResponsable = intIdAreaResponsable; objEpp.IdSectorResponsable = intIdSectorResponsable; objEpp.Fecha = Convert.ToDateTime(deFecha.DateTime.ToShortDateString()); objEpp.DescOrdenInterna = cboOrdenInterna.Text; objEpp.Observacion = txtObservacion.Text; objEpp.FlagEstado = true; objEpp.Usuario = Parametros.strUsuarioLogin; objEpp.Maquina = WindowsIdentity.GetCurrent().Name.ToString(); //Epp FOTO List <EppDetalleBE> lstEppDetalle = new List <EppDetalleBE>(); foreach (var item in mListaEppDetalleOrigen) { EppDetalleBE objE_EppDetalle = new EppDetalleBE(); objE_EppDetalle.IdEmpresa = Parametros.intEmpresaId; objE_EppDetalle.IdEpp = IdEpp; objE_EppDetalle.IdEppDetalle = item.IdEppDetalle; objE_EppDetalle.Item = item.Item; objE_EppDetalle.IdEquipo = item.IdEquipo; objE_EppDetalle.Codigo = item.Codigo; objE_EppDetalle.DescEquipo = item.DescEquipo; objE_EppDetalle.FechaVencimiento = item.FechaVencimiento; objE_EppDetalle.Cantidad = item.Cantidad; objE_EppDetalle.Precio = item.Precio; objE_EppDetalle.Total = item.Total; objE_EppDetalle.IdTipoEntrega = item.IdTipoEntrega; objE_EppDetalle.IdKardex = item.IdKardex; objE_EppDetalle.FlagEstado = true; objE_EppDetalle.Usuario = Parametros.strUsuarioLogin; objE_EppDetalle.Maquina = WindowsIdentity.GetCurrent().Name.ToString(); objE_EppDetalle.TipoOper = item.TipoOper; lstEppDetalle.Add(objE_EppDetalle); } if (pOperacion == Operacion.Nuevo) { int intNumero = 0; string strNumero = ""; intNumero = objBL_Epp.Inserta(objEpp, lstEppDetalle); strNumero = FuncionBase.AgregarCaracter(intNumero.ToString(), "0", 7); txtNumero.Text = strNumero; //ACTUALIZA NUMERO EppBL objBEpp = new EppBL(); objBEpp.ActualizaNumero(intNumero, txtNumero.Text); decimal decTotal = 0; strMensaje.Append("**************************** REGISTRO DE ENTREGA DE EPP ***************************************\n\n"); strMensaje.Append("Se Generó el N° REGISTRO DE ENTREGA DE EPP : " + txtNumero.Text + "\n\n"); strMensaje.Append("Responsable : " + txtResponsable.Text + "\n\n"); foreach (var item in mListaEppDetalleOrigen) { strMensaje.Append("Código : " + item.Codigo.ToString() + "\n"); strMensaje.Append("EPP : " + item.DescEquipo.ToString() + "\n"); strMensaje.Append("Cantidad : " + item.Cantidad.ToString() + "\n\n"); decTotal = decTotal + item.Precio; } strMensaje.Append("Costo Total S/.: " + decTotal.ToString() + "\n\n"); strMensaje.Append("**********************************************************************************************\n\n"); //GENERAR EL REPORTE EN PDF List <ReporteEppBE> lstReporte = null; lstReporte = new ReporteEppBL().Listado(intNumero); rptEpp objReporte = new rptEpp(); objReporte.SetDataSource(lstReporte); objReporte.SetParameterValue("Coordinador", Parametros.strUsuarioNombres); objReporte.SetParameterValue("EmpresaResponsable", "CROSLAND LOGISTICA S.A.C."); objReporte.ExportToDisk(ExportFormatType.PortableDocFormat, @"D:\" + strNumero + ".pdf"); BSUtils.EmailSend(strEmail, "Registro de entrega de Epp", strMensaje.ToString(), @"D:\" + strNumero + ".pdf", "", "", ""); XtraMessageBox.Show("Se creó el Registro de Epp N° : " + txtNumero.Text, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { objBL_Epp.Actualiza(objEpp, lstEppDetalle); } this.Close(); } } catch (Exception ex) { Cursor = Cursors.Default; XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }