public Boolean GrabarDB(ro_Cargo_Info info, ref int IdCargo, ref string msg) { try { Boolean valorRetornar = false; if (oData.GetExiste(info, ref msg)) { valorRetornar = oData.ModificarDB(info, ref msg); IdCargo = info.IdCargo; } else { valorRetornar = oData.GrabarDB(info, ref IdCargo, ref msg); } return(valorRetornar); } 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("", "GrabarDB", ex.Message), ex) { EntityType = typeof(ro_Cargo_Bus) }; ; } }
public Boolean GetExiste(ro_Cargo_Info info, ref string msg) { try { Boolean valorRetornar = false; using (EntitiesRoles db = new EntitiesRoles()) { int cont = (from a in db.ro_cargo where a.IdEmpresa == info.IdEmpresa && a.IdCargo == info.IdCargo select a).Count(); if (cont > 0) { valorRetornar = true; } else { valorRetornar = false; } } return(valorRetornar); } 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); throw new Exception(ex.InnerException.ToString()); } }
public Boolean ModificarDB(ro_Cargo_Info info, ref string msg) { try { using (EntitiesRoles context = new EntitiesRoles()) { var contact = context.ro_cargo.First(obj => obj.IdCargo == info.IdCargo && obj.IdEmpresa == info.IdEmpresa); contact.ca_descripcion = info.ca_descripcion; contact.IdUsuarioUltMod = info.IdUsuarioUltMod; contact.Fecha_UltMod = info.Fecha_UltMod; contact.nom_pc = info.nom_pc; contact.ip = info.ip; contact.Estado = info.Estado; contact.MotivoAnulacion = ""; contact.considera_pago_utilidad = info.considera_pago_utilidad; context.SaveChanges(); msg = "Se ha procedido a modificar el registro del cargo # : " + info.IdCargo.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); throw new Exception(ex.InnerException.ToString()); } }
private void gridViewCargo_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { try { InfoTipCargo = (ro_Cargo_Info)gridViewCargo.GetFocusedRow(); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString()); } }
public Boolean EliminarDB(ro_Cargo_Info info, ref string msg) { try { return(oData.EliminarDB(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("", "EliminarDB", ex.Message), ex) { EntityType = typeof(ro_Cargo_Bus) }; } }
public ro_Cargo_Info get_TipoCargo() { try { InfoTipoCargo = listTipoCargo.FirstOrDefault(v => v.IdCargo == Convert.ToDecimal(cmb_Cargo.EditValue)); return(InfoTipoCargo); } 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 ro_Cargo_Info()); } }
public List <ro_Cargo_Info> Get_List_Cargo(int idempresa, int IdDepart) { List <ro_Cargo_Info> LstCargo = new List <ro_Cargo_Info>(); try { EntitiesRoles EORoles = new EntitiesRoles(); var select = from C in EORoles.ro_cargo where C.IdEmpresa == idempresa select C; foreach (var item in select) { ro_Cargo_Info Cargo = new ro_Cargo_Info(); Cargo.IdEmpresa = Convert.ToInt32(item.IdEmpresa); Cargo.IdCargo = Convert.ToInt32(item.IdCargo); Cargo.ca_descripcion = item.ca_descripcion; Cargo.IdUsuario = item.IdUsuario; Cargo.Fecha_Transac = item.Fecha_Transac; Cargo.IdUsuarioUltMod = item.IdUsuarioUltMod; Cargo.Fecha_UltMod = item.Fecha_UltMod; Cargo.IdUsuarioUltAnu = item.IdUsuarioUltAnu; Cargo.Fecha_UltAnu = item.Fecha_UltAnu; Cargo.nom_pc = item.nom_pc; Cargo.ip = item.ip; Cargo.Estado = item.Estado; Cargo.MotivoAnulacion = item.MotivoAnulacion; Cargo.considera_pago_utilidad = item.considera_pago_utilidad; LstCargo.Add(Cargo); } return(LstCargo); } 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); throw new Exception(ex.InnerException.ToString()); } }
void ucGe_Menu_Mantenimiento_x_usuario_event_btnAnular_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (InfoTipCargo == null) { MessageBox.Show("Seleccione un registro", "Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else { InfoTipCargo = (ro_Cargo_Info)gridViewCargo.GetFocusedRow(); if (InfoTipCargo.IdCargo > 0) { if (MessageBox.Show("¿Está seguro que desea anular el Cargo ID : " + InfoTipCargo.IdCargo + " ?", "Anulación", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (InfoTipCargo.Estado == "A") { string msg = ""; getparamanular(); FrmGe_MotivoAnulacion oFrm = new FrmGe_MotivoAnulacion(); oFrm.ShowDialog(); string motivoAnulacion = oFrm.motivoAnulacion; InfoTipCargo.MotivoAnulacion = motivoAnulacion; BusTipoCargo.EliminarDB(InfoTipCargo, ref msg); MessageBox.Show(msg, "SISTEMAS", MessageBoxButtons.OK, MessageBoxIcon.Information); CargaTipoCargo(); } else { MessageBox.Show("No se pudo anular el cargo ID : " + InfoTipCargo.IdCargo + " debido a que ya se encuentra anulado", "Anulación", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString()); } }
public Boolean EliminarDB(ro_Cargo_Info info, ref string msg) { try { EntitiesRoles OERoles = new EntitiesRoles(); var select = from q in OERoles.ro_cargo where q.IdCargo == info.IdCargo && q.IdEmpresa == info.IdEmpresa select q; if (select.ToList().Count > 0) { using (EntitiesRoles context = new EntitiesRoles()) { var contact = context.ro_cargo.First(obj => obj.IdCargo == info.IdCargo && obj.IdEmpresa == info.IdEmpresa); contact.Estado = "I"; contact.IdUsuarioUltAnu = info.IdUsuarioUltAnu; contact.Fecha_UltAnu = info.Fecha_UltAnu; contact.MotivoAnulacion = info.MotivoAnulacion; context.SaveChanges(); msg = "Se ha procedido anular el registro del Cargo #: " + info.IdCargo.ToString() + " exitosamente"; } return(true); } else { msg = "No es posible anular el registro del Cargo #: " + info.IdCargo.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); mensaje = ex.InnerException + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(ex.InnerException.ToString()); } }
public Boolean GrabarDB(ro_Cargo_Info InfoCargo, ref int IdCargo, ref string msg) { try { using (EntitiesRoles context = new EntitiesRoles()) { ro_cargo address = new ro_cargo(); address.IdCargo = InfoCargo.IdCargo = IdCargo = GetId(InfoCargo.IdEmpresa); address.IdEmpresa = InfoCargo.IdEmpresa; address.IdCargo = IdCargo; address.ca_descripcion = InfoCargo.ca_descripcion; address.IdUsuario = InfoCargo.IdUsuario == null ? "" : InfoCargo.IdUsuario; address.Fecha_Transac = (DateTime)InfoCargo.Fecha_Transac; address.nom_pc = InfoCargo.nom_pc; address.ip = InfoCargo.ip; address.Estado = "A"; address.considera_pago_utilidad = InfoCargo.considera_pago_utilidad; context.ro_cargo.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.InnerException + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(ex.InnerException.ToString()); } }