public Boolean GrabarModelo_x_Obra(prd_ProcesoProductivo_Info infoMP, prd_Obra_Info InfoOBra) { try { using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus()) { var address = new prd_ProcesoProductivo_x_prd_obra(); address.IdEmpresa_obra = InfoOBra.IdEmpresa; address.CodObra = InfoOBra.CodObra; address.IdEmpresa_Pr = infoMP.IdEmpresa; address.IdProcesoProductivo = infoMP.IdProcesoProductivo; context.prd_ProcesoProductivo_x_prd_obra.Add(address); context.SaveChanges(); } return(true); } catch (Exception ex) { string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); mensaje = ex.ToString() + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(ex.ToString()); } }
void ucGe_Menu_Mantenimiento_x_usuario_event_btnModificar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { InfoObra = (prd_Obra_Info)gridViewObras.GetFocusedRow(); if (InfoObra == null) { MessageBox.Show("Selecciones una fila", "sistemas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { FrmPrd_ObraMantemiento frm = new FrmPrd_ObraMantemiento(); frm.set_Acccion(Cl_Enumeradores.eTipo_action.actualizar); frm.set_Info(InfoObra); frm.Text = frm.Text + " ***MODIFICAR REGISTRO***"; frm.MdiParent = this.MdiParent; frm.Show(); frm.event_FrmPrd_ObraMantemiento_FormClosing += frm_event_FrmPrd_ObraMantemiento_FormClosing; } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.InnerException.ToString()); } }
public Boolean ModificarDB(prd_Obra_Info info, ref string msg) { try { using (EntitiesProduccion_Cidersus Context = new EntitiesProduccion_Cidersus()) { var contact = Context.prd_Obra.FirstOrDefault(A => A.IdEmpresa == info.IdEmpresa && A.CodObra == info.CodObra); if (contact != null) { contact.Descripcion = info.Descripcion; contact.Estado = info.Estado; contact.Fecha = info.Fecha; contact.IdUsuarioAnu = info.IdUsuarioAnu; contact.IdUsuarioUltModi = info.IdUsuarioUltModi; contact.FechaUltModi = info.FechaUltModi; contact.IdCliente = info.IdCliente; contact.PesoObra = info.PesoObra; contact.Referencia = info.Referencia; Context.SaveChanges(); msg = "Grabación exitosa.."; } } return(true); } catch (Exception ex) { string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); msg = ex.ToString() + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg); throw new Exception(ex.ToString()); } }
public prd_Obra_Info get_item_info() { try { prd_Obra_Info InfoOBra = new prd_Obra_Info(); if (UC_Obra.EditValue != null) { InfoOBra = (prd_Obra_Info)UC_Obra.Properties.View.GetFocusedRow(); } else { return(new prd_Obra_Info()); } return(InfoOBra); } catch (Exception ex) { string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name; MessageBox.Show(NameMetodo + " - " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString()); return(new prd_Obra_Info()); } }
private void gridViewObras_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { try { InfoObra = GetSelectedRow((DevExpress.XtraGrid.Views.Grid.GridView)sender); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); } }
public Boolean GrabarModelo_x_Obra(prd_ProcesoProductivo_Info infoMP, prd_Obra_Info InfoOBra) { try { return(data.GrabarModelo_x_Obra(infoMP, InfoOBra)); } catch (Exception ex) { Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message); throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "GrabarModelo_x_Obra", ex.Message), ex) { EntityType = typeof(prd_ProcesoProductivo_Bus) }; } }
public Boolean AnularDB(prd_Obra_Info info, ref string msg) { try { return(data.AnularDB(info, ref msg)); } catch (Exception ex) { Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message); throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "AnularDB", ex.Message), ex) { EntityType = typeof(prd_Obra_Bus) }; } }
private void UC_Obra_EditValueChanged_1(object sender, EventArgs e) { try { _InfoObra = (prd_Obra_Info)UC_Obra.Properties.View.GetFocusedRow(); this.Event_UCObra_SelectionChanged(sender, e); Event_UCObra_EditValueChanged(sender, e); } catch (Exception ex) { string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name; MessageBox.Show(NameMetodo + " - " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString()); } }
public prd_Obra_Info ObtenerUnaObra(int IdEmpresa, string CodObra) { try { EntitiesProduccion_Cidersus OEEtapa = new EntitiesProduccion_Cidersus(); var registros = from A in OEEtapa.prd_Obra where A.IdEmpresa == IdEmpresa && A.CodObra == CodObra select A; if (registros.ToList().Count > 0) { prd_Obra_Info info = new prd_Obra_Info(); foreach (var item in registros) { info.CodObra = item.CodObra; info.IdEmpresa = item.IdEmpresa; info.IdCentroCosto = item.IdCentroCosto; info.Descripcion = item.Descripcion; info.Estado = item.Estado; info.Fecha = item.Fecha; info.DetalleObra = "[" + item.CodObra.Trim() + "] - " + item.Descripcion.Trim(); info.PesoObra = item.PesoObra; info.Referencia = item.Referencia; } return(info); } else { return(new prd_Obra_Info()); } } catch (Exception ex) { string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); mensaje = ex.ToString() + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(ex.ToString()); } }
public List <prd_Obra_Info> ObtenerListaObra(int IdEmpresa) { try { List <prd_Obra_Info> lm = new List <prd_Obra_Info>(); EntitiesProduccion_Cidersus OEEtapa = new EntitiesProduccion_Cidersus(); var registros = from A in OEEtapa.vwprd_Obras_Cliente where A.IdEmpresa == IdEmpresa orderby A.CodObra select A; foreach (var item in registros) { prd_Obra_Info info = new prd_Obra_Info(); info.CodObra = item.CodObra; info.IdEmpresa = item.IdEmpresa; info.IdCentroCosto = item.IdCentroCosto; info.Descripcion = item.Descripcion; info.Estado = item.Estado; info.Fecha = item.Fecha; info.IdCliente = item.IdCliente; info.DetalleObra = "[" + item.CodObra.Trim() + "] - " + item.Descripcion.Trim(); info.cl_RazonSocial = item.cl_RazonSocial; info.PesoObra = item.PesoObra; info.Referencia = item.Referencia; lm.Add(info); } return(lm); } catch (Exception ex) { string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); mensaje = ex.ToString() + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(ex.ToString()); } }
public void get_Obra( ) { try { infoObra = new prd_Obra_Info(); infoObra.CodObra = txtCodigo.Text.ToString(); infoObra.IdCliente = Convert.ToDecimal(this.cmb_cliente.EditValue); infoObra.Descripcion = txtDescripcion.Text.ToString(); infoObra.Fecha = dTPFecha.Value; infoObra.IdEmpresa = param.IdEmpresa; infoObra.PesoObra = Convert.ToDecimal(txtPesoObra.Text); infoObra.Referencia = txtReferencia.Text.ToString(); infoObra.Estado = (chkEstado.Checked == true) ? "A" : "I"; // return infoObra; } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.InnerException.ToString()); } }
public void set_Info(prd_Obra_Info Obra) { try { infoObra = Obra; infoObra = new prd_Obra_Info(); infoObra = Obra; txtCodigo.Text = infoObra.CodObra; cmb_cliente.EditValue = infoObra.IdCliente; txtDescripcion.Text = infoObra.Descripcion; txtPesoObra.Text = infoObra.PesoObra.ToString(); dTPFecha.Value = infoObra.Fecha; chkEstado.Checked = (infoObra.Estado == "A") ? true : false; lblAnulado.Visible = (infoObra.Estado == "I") ? true : false; txtReferencia.Text = infoObra.Referencia; } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.InnerException.ToString()); } }
public Boolean GuardarDB(prd_Obra_Info info, ref string msg) { try { using (EntitiesProduccion_Cidersus Context = new EntitiesProduccion_Cidersus()) { var Address = new prd_Obra(); Address.IdEmpresa = info.IdEmpresa; Address.CodObra = info.CodObra; Address.Descripcion = info.Descripcion; Address.Estado = "A"; Address.Fecha = info.Fecha; Address.IdCentroCosto = info.CodObra; Address.IdUsuario = info.IdUsuario; Address.FechaTransac = info.FechaTransac; Address.IdCliente = info.IdCliente; Address.PesoObra = info.PesoObra; Address.Referencia = info.Referencia; Context.prd_Obra.Add(Address); Context.SaveChanges(); } msg = "Grabación exitosa.."; return(true); } catch (Exception ex) { string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); msg = ex.ToString() + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg); throw new Exception(ex.ToString()); } }
private Boolean validar() { try { prd_Obra_Info temp = new prd_Obra_Info(); temp = UCObra.get_item_info(); if (CodOBra == "") { MessageBox.Show("Debe escoger la Obra"); return(false); } else if (descripcion == "") { MessageBox.Show("Debe ingresar el nombre del Modelo de Producción"); return(false); } else if (temp == null) { MessageBox.Show("Escoja una Obra"); UCObra.cargaCmb_Obra(); return(false); } else { CodOBra = UCObra.get_item(); descripcion = textBox1.Text; return(true); } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); return(false); } }
void ucGe_Menu_Mantenimiento_x_usuario_event_btnDuplicar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (this.gridViewModelo.RowCount == 0) { MessageBox.Show("Seleccione una fila ", "sistemas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } info = (prd_ProcesoProductivo_Info)gridViewModelo.GetFocusedRow(); if (info != null) { prd_EtapaProduccion_Bus BusEtapas = new prd_EtapaProduccion_Bus(); List <prd_EtapaProduccion_Info> ListEtapas = new List <prd_EtapaProduccion_Info>(); List <prd_EtapaProduccion_Info> lisTemporal = new List <prd_EtapaProduccion_Info>(); prd_ProcesoProductivo_Bus ProcesoProductivo_bus = new prd_ProcesoProductivo_Bus(); prd_ProcesoProductivo_Info infoDupl = new prd_ProcesoProductivo_Info(); string msg = ""; int idpp = 0; infoDupl = info; // necesario porque el infoDupl ocupa el mismo espacio en memoria que el info y necesito el id anterior int idprocprodanterior = info.IdProcesoProductivo; FrmPrd_Duplica Frm = new FrmPrd_Duplica(); Frm.nombrar(info.Nombre); Frm.ShowDialog(); infoDupl.Nombre = Frm.descripcion; if (Frm.duplicaSiNo == "S") { if (Frm.descripcion.Trim() != string.Empty) { if (ProcesoProductivo_bus.GrabarItem(infoDupl, ref idpp, ref msg)) { infoDupl.IdProcesoProductivo = idpp; string CodObra = Frm.CodOBra; if (CodObra != string.Empty) { prd_Obra_Info InfoObra = new prd_Obra_Info(); InfoObra.IdEmpresa = param.IdEmpresa; InfoObra.CodObra = CodObra; ProcesoProductivo_bus.GrabarModelo_x_Obra(infoDupl, InfoObra); } //string IdCentroCosto = Frm.idcentrocosto; //if (IdCentroCosto != string.Empty) //{ // ct_Centro_costo_Info InfoCC = new ct_Centro_costo_Info(); // InfoCC.IdEmpresa = param.IdEmpresa; // InfoCC.IdCentroCosto = IdCentroCosto; // ProcesoProductivo_bus.GrabarModelo_x_CentroCosto(info, InfoCC); //} } ListEtapas = BusEtapas.ObtenerListaEtapas(param.IdEmpresa, idprocprodanterior); foreach (var item in ListEtapas) { item.IdProcesoProductivo = infoDupl.IdProcesoProductivo; lisTemporal.Add(item); } //grabo la lista de etapas para el nuevo modelo duplicado BusEtapas.GrabarListaEtapas(ListEtapas, param.IdEmpresa, infoDupl.IdProcesoProductivo, ref msg); MessageBox.Show("Duplicado con éxito", "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No se grabó", "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } ListaModelos(); } } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); } }