public Boolean GrabarDB(Af_Encargado_Info info, ref int id, ref string msg) { try { using (EntitiesActivoFijo context = new EntitiesActivoFijo()) { var address = new Af_Encargado(); int idpv = GetId(info.IdEmpresa); id = idpv; address.IdEmpresa = info.IdEmpresa; address.IdEncargado = idpv; address.estado = info.estado; address.nom_encargado = info.nom_encargado; context.Af_Encargado.Add(address); context.SaveChanges(); msg = "Se ha procedido a grabar el registro del Tipo de Af_Encargado_Info #: " + id.ToString() + " exitosamente."; } 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); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.InnerException + " " + ex.Message; msg = "Se ha producido el siguiente error: " + ex.Message; throw new Exception(ex.InnerException.ToString()); } }
public Boolean ModificarDB(Af_Encargado_Info info, ref string msg) { try { using (EntitiesActivoFijo context = new EntitiesActivoFijo()) { var contact = context.Af_Encargado.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa && obj.IdEncargado == info.IdEncargado); if (contact != null) { contact.estado = info.estado; contact.nom_encargado = info.nom_encargado; context.SaveChanges(); msg = "Se ha procedido actualizar el registro del Tipo de Activo Fijo #: " + info.IdEncargado.ToString() + " exitosamente"; } } 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); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.ToString() + " " + ex.Message; msg = "Se ha producido el siguiente error: " + ex.Message; throw new Exception(ex.ToString()); } }
public Boolean Anular() { try { if (Info_Encargado.estado == "I") { MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.El_registro_se_encuentra_anulado), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } else { if (MessageBox.Show("¿Está seguro que desea anular el Tipo de Rubro #:" + txt_IdMotivo.Text.Trim() + " ?", param.Nombre_sistema, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { FrmGe_MotivoAnulacion fr = new FrmGe_MotivoAnulacion(); fr.ShowDialog(); Af_Encargado_Bus neg = new Af_Encargado_Bus(); Af_Encargado_Info moInfo = new Af_Encargado_Info(); string mensaje = string.Empty; moInfo = Get_Info(ref mensaje); if (mensaje != "") { MessageBox.Show("Error " + mensaje, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information); } //moInfo.UsuarioAnulacion = param.IdUsuario; //moInfo.MotivoAnulacion = fr.motivoAnulacion; bool resultado = neg.AnularDB(moInfo, ref mensaje); if (resultado) { MessageBox.Show(mensaje, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information); this.ucGe_Menu_Superior_Mant1.Visible_bntGuardar_y_Salir = false; this.ucGe_Menu_Superior_Mant1.Visible_btnGuardar = false; } else { Log_Error_bus.Log_Error(mensaje.ToString()); MessageBox.Show("Error " + mensaje, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information); } return(true); } else { return(false); } } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.Message); return(false); } }
public void Set_Info(Af_Encargado_Info _Info_Encargado) { try { Info_Encargado = _Info_Encargado; } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString()); } }
private void modificarToolStripMenuItem_Click(object sender, EventArgs e) { try { Info_Encargado = get_Info(); llamar_Formulario(Cl_Enumeradores.eTipo_action.actualizar); } 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 Boolean AnularDB(Af_Encargado_Info info, ref string msg) { try { return(Odata.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("", "Get_List_Aca_Institucion_x_Sede_x_Jorn_x_Sec_Curso_x_Para", ex.Message), ex) { EntityType = typeof(Af_Activo_fijo_Categoria_Bus) }; } }
public Boolean Guardar() { bool resultado = false; try { Af_Encargado_Info InfoMotivo = new Af_Encargado_Info(); Af_Encargado_Bus BusMotivo = new Af_Encargado_Bus(); mensaje = ""; int id = 0; InfoMotivo = Get_Info(ref mensaje); if (mensaje != "") { MessageBox.Show(mensaje); return(false); } resultado = BusMotivo.GrabarDB(InfoMotivo, ref id, ref mensaje); if (resultado == true) { MessageBox.Show(mensaje, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information); this.ucGe_Menu_Superior_Mant1.Visible_bntGuardar_y_Salir = true; this.ucGe_Menu_Superior_Mant1.Visible_btnGuardar = true; } else { Log_Error_bus.Log_Error(mensaje.ToString()); MessageBox.Show("Error " + mensaje, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information); } return(resultado); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.Message); return(false); } }
public Boolean AnularDB(Af_Encargado_Info info, ref string msg) { try { EntitiesActivoFijo OEPActivoFijo = new EntitiesActivoFijo(); var select = from q in OEPActivoFijo.Af_Encargado where q.IdEmpresa == info.IdEmpresa && q.IdEncargado == info.IdEncargado select q; if (select.ToList().Count > 0) { using (EntitiesActivoFijo context = new EntitiesActivoFijo()) { var contact = context.Af_Encargado.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa && obj.IdEncargado == info.IdEncargado); if (contact != null) { contact.estado = "I"; context.SaveChanges(); msg = "Se ha procedido anular el registro del Tipo de Activo Fijo #: " + info.IdEncargado.ToString() + " exitosamente"; } } return(true); } else { msg = "No es posible anular el registro del Tipo de Activo Fijo #: " + info.IdEncargado.ToString() + " debido a que ya se encuentra anulado."; return(false); } } 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); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.ToString() + " " + ex.Message; msg = "Se ha producido el siguiente error: " + ex.Message; throw new Exception(ex.ToString()); } }
public Af_Encargado_Info get_Info() { try { Info_Encargado = new Af_Encargado_Info(); if (cmbEncargado.EditValue != null) { Info_Encargado = List_Encargado.FirstOrDefault(v => v.IdEncargado == Convert.ToDecimal(cmbEncargado.EditValue)); } return(Info_Encargado); } 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 Af_Encargado_Info()); } }
public Af_Encargado_Info Get_Info(ref string mensaje) { try { Af_Encargado_Info Info = new Af_Encargado_Info(); Info.IdEmpresa = param.IdEmpresa; Info.IdEncargado = Convert.ToInt32(txt_IdMotivo.Text); Info.nom_encargado = txtDescripcion.Text; if (Accion == Cl_Enumeradores.eTipo_action.grabar) { chkEstado.Checked = true; } Info.estado = (chkEstado.Checked == true)? "A" : "I"; if (chkEstado.Checked) { lbl_Estado.Visible = false; } else { lbl_Estado.Visible = true; } return(Info); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); mensaje = ex.Message.ToString(); MessageBox.Show("Error " + mensaje, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information); throw; } }
public List <Af_Encargado_Info> Get_List_Encargado(int IdEmpresa) { List <Af_Encargado_Info> lM = new List <Af_Encargado_Info>(); EntitiesActivoFijo OEPActivoFijo = new EntitiesActivoFijo(); try { var select = from A in OEPActivoFijo.Af_Encargado where A.IdEmpresa == IdEmpresa select A; foreach (var item in select) { Af_Encargado_Info info = new Af_Encargado_Info(); info.IdEmpresa = item.IdEmpresa; info.estado = item.estado; info.IdEncargado = item.IdEncargado; info.nom_encargado = item.nom_encargado; 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); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.InnerException + " " + ex.Message; throw new Exception(ex.InnerException.ToString()); } }