public void Grabar() { try { Aca_Matricula_Tipo_Documento_Info tipoDocInfo = new Aca_Matricula_Tipo_Documento_Info(); string mensaje = string.Empty; int id = 0; tipoDocInfo = Get_MatriculaTipoDocumento(ref mensaje); Aca_Material_Tipo_Documento_Bus neg = new Aca_Material_Tipo_Documento_Bus(); bool resultado = neg.GrabarDB(tipoDocInfo, ref id, ref mensaje); txtIdTipoDocumento.Text = id.ToString(); if (resultado == true) { MessageBox.Show(mensaje, " Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Information); this.ucGe_Menu.Visible_bntGuardar_y_Salir = false; this.ucGe_Menu.Visible_btnGuardar = false; } else { Log_Error_bus.Log_Error(mensaje.ToString()); MessageBox.Show("Error " + mensaje, "Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.Message); } }
public void Actualizar() { try { Aca_Material_Tipo_Documento_Bus neg = new Aca_Material_Tipo_Documento_Bus(); Aca_Matricula_Tipo_Documento_Info tipoDocInfo = new Aca_Matricula_Tipo_Documento_Info(); string mensaje = string.Empty; tipoDocInfo = Get_MatriculaTipoDocumento(ref mensaje); if (mensaje != "") { MessageBox.Show(mensaje); return; } tipoDocInfo.UsuarioModificacion = param.IdUsuario; bool resultado = neg.ActualizarDB(tipoDocInfo, ref mensaje); if (resultado) { MessageBox.Show(mensaje, "Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Information); this.ucGe_Menu.Visible_bntGuardar_y_Salir = false; this.ucGe_Menu.Visible_btnGuardar = false; } else { Log_Error_bus.Log_Error(mensaje.ToString()); MessageBox.Show("Error " + mensaje, "Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception) { throw; } }
public bool GrabarDB(Aca_Matricula_Tipo_Documento_Info info, ref int IdTipoDocumento, ref string mensaje) { try { using (Entities_Academico Base = new Entities_Academico()) { Aca_matricula_Tipo_documento matriTipoDoc = new Aca_matricula_Tipo_documento(); IdTipoDocumento = GetId(); matriTipoDoc.IdTipoDocumento = IdTipoDocumento; matriTipoDoc.codTipoDocumento = string.IsNullOrEmpty(info.CodTipoDocumento) ? IdTipoDocumento.ToString() : info.CodTipoDocumento; matriTipoDoc.descripcion = info.Descripcion; matriTipoDoc.Archivo = info.Archivo; matriTipoDoc.FechaCreacion = DateTime.Now; matriTipoDoc.UsuarioCreacion = info.UsuarioCreacion; matriTipoDoc.FechaModificacion = DateTime.Now; matriTipoDoc.UsuarioModificacion = info.UsuarioModificacion; matriTipoDoc.Estado = info.Estado; Base.Aca_matricula_Tipo_documento.Add(matriTipoDoc); Base.SaveChanges(); mensaje = "Se ha procedido a grabar tipo documento #: " + IdTipoDocumento.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; throw new Exception(ex.ToString()); } }
public bool AnularDB(Aca_Matricula_Tipo_Documento_Info info, ref string mensaje) { try { using (Entities_Academico context = new Entities_Academico()) { var address = context.Aca_matricula_Tipo_documento.FirstOrDefault(a => a.IdTipoDocumento == info.IdTipoDocumento); if (address != null) { address.Estado = "I"; address.FechaAnulacion = DateTime.Now; address.UsuarioAnulacion = info.UsuarioAnulacion; address.MotivoAnulacion = info.MotivoAnulacion; context.SaveChanges(); mensaje = "Se ha procedido anular el tipo de documento #: " + info.IdTipoDocumento.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); mensaje = ex.InnerException + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = "Se ha producido el siguiente error: " + ex.Message; throw new Exception(ex.ToString()); } }
public bool ActualizarDB(Aca_Matricula_Tipo_Documento_Info info, ref string mensaje) { try { using (Entities_Academico Base = new Entities_Academico()) { var matTipoDocu = Base.Aca_matricula_Tipo_documento.FirstOrDefault(m => m.IdTipoDocumento == info.IdTipoDocumento); if (matTipoDocu != null) { matTipoDocu.codTipoDocumento = info.CodTipoDocumento; matTipoDocu.descripcion = info.Descripcion; matTipoDocu.Archivo = info.Archivo; matTipoDocu.UsuarioModificacion = info.UsuarioModificacion; matTipoDocu.UsuarioAnulacion = info.UsuarioAnulacion; matTipoDocu.FechaModificacion = DateTime.Now; matTipoDocu.FechaAnulacion = info.FechaAnulacion; matTipoDocu.Estado = info.Estado; Base.SaveChanges(); mensaje = "Se ha procedido actualizar tipo documento #: " + info.IdTipoDocumento.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; throw new Exception(ex.ToString()); } }
public void set_tipoDocumento(Aca_Matricula_Tipo_Documento_Info info) { try { TipoDocumentoInfo = info; } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.Message); } }
public bool EliminarDB(Aca_Matricula_Tipo_Documento_Info info, ref string mensaje) { try { return(da.AnularDB(info, ref mensaje)); } 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("", "EliminarDB", ex.Message), ex) { EntityType = typeof(Aca_Material_Tipo_Documento_Bus) }; } }
private void Anular() { try { if (TipoDocumentoInfo.Estado != "I") { if (MessageBox.Show("¿Está seguro que desea anular el documento # " + txtIdTipoDocumento.Text.Trim() + " ?", "Anulación de Mantenimiento Documento Matricula", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { FrmGe_MotivoAnulacion fr = new FrmGe_MotivoAnulacion(); fr.ShowDialog(); Aca_Material_Tipo_Documento_Bus neg = new Aca_Material_Tipo_Documento_Bus(); Aca_Matricula_Tipo_Documento_Info tipoDocInfo = new Aca_Matricula_Tipo_Documento_Info(); string mensaje = string.Empty; tipoDocInfo = Get_MatriculaTipoDocumento(ref mensaje); if (mensaje != "") { MessageBox.Show("Error " + mensaje, "Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Information); } tipoDocInfo.UsuarioAnulacion = param.IdUsuario; tipoDocInfo.MotivoAnulacion = fr.motivoAnulacion; bool resultado = neg.EliminarDB(tipoDocInfo, ref mensaje); if (resultado) { MessageBox.Show(mensaje, "Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Information); this.ucGe_Menu.Visible_bntGuardar_y_Salir = false; this.ucGe_Menu.Visible_btnGuardar = false; } else { Log_Error_bus.Log_Error(mensaje.ToString()); MessageBox.Show("Error " + mensaje, "Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { MessageBox.Show("El documento de la matricula # " + txtIdTipoDocumento.Text.Trim() + " ya se encuentra anulado.", "Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show("Error " + ex.Message.ToString(), "Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public Aca_Matricula_Tipo_Documento_Info Get_MatriculaTipoDocumento(ref string mensaje) { Aca_Matricula_Tipo_Documento_Info info = new Aca_Matricula_Tipo_Documento_Info(); try { info.IdTipoDocumento = Convert.ToInt16(txtIdTipoDocumento.Text); info.CodTipoDocumento = txtCodigoTipoDocumento.Text; info.Descripcion = txtDescripcion.Text; info.UsuarioCreacion = param.IdUsuario; info.Estado = chkEstado.Checked == true ? "A" : "I"; } catch (Exception ex) { mensaje = ex.Message.ToString(); } return(info); }
private void ucGe_Menu_event_btnconsultar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { matriculaTipoDocumento = (Aca_Matricula_Tipo_Documento_Info)this.gridViewMatriculaTipoDocumento.GetFocusedRow(); if (matriculaTipoDocumento == null) { MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Por_favor_seleccione_item_a_consul), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { llama_frm(Cl_Enumeradores.eTipo_action.consultar); } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ":" + ex.Message, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public List <Aca_Matricula_Tipo_Documento_Info> Get_List_Matricula_Tipo_Documento() { List <Aca_Matricula_Tipo_Documento_Info> lista = new List <Aca_Matricula_Tipo_Documento_Info>(); Aca_Matricula_Tipo_Documento_Info info; try { using (Entities_Academico Base = new Entities_Academico()) { var matriculaTipoDoc = from t in Base.Aca_matricula_Tipo_documento select t; foreach (var item in matriculaTipoDoc) { info = new Aca_Matricula_Tipo_Documento_Info(); info.IdTipoDocumento = item.IdTipoDocumento; info.CodTipoDocumento = item.codTipoDocumento; info.Descripcion = item.descripcion; info.FechaCreacion = item.FechaCreacion; info.FechaModificacion = item.FechaModificacion; info.FechaAnulacion = item.FechaAnulacion; info.UsuarioCreacion = item.UsuarioCreacion; info.UsuarioModificacion = item.UsuarioModificacion; info.UsuarioAnulacion = item.UsuarioAnulacion; info.Estado = item.Estado; lista.Add(info); } } return(lista); } catch (Exception ex) { string arreglo = ToString(); string MensajeError = string.Empty; 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); MensajeError = ex.InnerException + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError); throw new Exception(ex.ToString()); } }