public ro_DocumentoxEmp_Info get_info(int IdEmpresa, int IdEmpleado, int IdDocumento) { try { ro_DocumentoxEmp_Info info = new ro_DocumentoxEmp_Info(); using (Entities_rrhh Context = new Entities_rrhh()) { ro_DocumentoxEmp Entity = Context.ro_DocumentoxEmp.FirstOrDefault(q => q.IdEmpresa == IdEmpresa && q.IdEmpleado == IdEmpleado && q.IdDocumento == IdDocumento); if (Entity == null) { return(null); } info = new ro_DocumentoxEmp_Info { IdEmpresa = Entity.IdEmpresa, IdEmpleado = Entity.IdEmpleado, IdDocumento = Entity.IdDocumento, Documento = Entity.Documento, Dc_Descripcion = Entity.Dc_Descripcion, Dc_Nombre = Entity.Dc_Nombre, Estado = Entity.Estado, tipo = Entity.tipo }; } return(info); } catch (Exception) { throw; } }
public bool guardarDB(ro_DocumentoxEmp_Info info) { try { using (Entities_rrhh Context = new Entities_rrhh()) { ro_DocumentoxEmp Entity = new ro_DocumentoxEmp { IdEmpresa = info.IdEmpresa, IdEmpleado = info.IdEmpleado, IdDocumento = info.IdDocumento, Documento = info.Documento, Dc_Descripcion = info.Dc_Descripcion, Dc_Nombre = info.Dc_Nombre, Estado = info.Estado, tipo = info.tipo, FechaReg = info.FechaReg }; Context.ro_DocumentoxEmp.Add(Entity); Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public Boolean AnularDB(ro_DocumentoxEmp_Info Info, ref string msg) { try { using (EntitiesRoles context = new EntitiesRoles()) { var address = context.ro_DocumentoxEmp.First(A => A.IdEmpresa == Info.IdEmpresa && A.IdEmpleado == Info.IdEmpleado && A.IdDocumento == Info.IdDocumento); address.Estado = "I"; address.Documento = null; address.Dc_Descripcion = Info.Dc_Descripcion; address.FechaElimin = Info.FechaElimin; address.UsuarioElimin = Info.UsuarioElimin; address.MotivoElimin = Info.MotivoElimin; context.SaveChanges(); } msg = "Guardado con exito"; 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()); } }
public bool anularDB(ro_DocumentoxEmp_Info info) { try { return(odata.anularDB(info)); } catch (Exception) { throw; } }
public Boolean AnularDB(ro_DocumentoxEmp_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("", "AnularDB", ex.Message), ex) { EntityType = typeof(ro_DocumentoxEmp_Bus) }; } }
public bool anularDB(ro_DocumentoxEmp_Info info) { try { using (Entities_rrhh Context = new Entities_rrhh()) { Context.Database.ExecuteSqlCommand("delete ro_DocumentoxEmp where idEmpresa='" + info.IdEmpresa + "' and IdEmpleado='" + info.IdEmpleado + "' "); Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public Boolean EliminarDB(List <ro_DocumentoxEmp_Info> List, ref string msg) { try { using (EntitiesRoles context = new EntitiesRoles()) { // pregunto si existe documentos por ese empleado para que no se caiga ro_DocumentoxEmp_Info info = List.FirstOrDefault(); var Query = from q in context.ro_DocumentoxEmp where q.IdEmpresa == info.IdEmpresa && q.IdEmpleado == info.IdEmpleado select q; if (Query.Count() > 0) { foreach (var item in Query.ToList()) { var address = context.ro_DocumentoxEmp.First(A => A.IdEmpresa == item.IdEmpresa && A.IdEmpleado == item.IdEmpleado && item.IdDocumento == item.IdDocumento); context.ro_DocumentoxEmp.Remove(address); context.SaveChanges(); } } } msg = "Guardado con exito"; 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()); } }
public List <ro_DocumentoxEmp_Info> ConsultaXEmpleado(int idempresa, decimal idempleado) { List <ro_DocumentoxEmp_Info> Lst = new List <ro_DocumentoxEmp_Info>(); EntitiesRoles oEnti = new EntitiesRoles(); try { var Query = from q in oEnti.ro_DocumentoxEmp where q.IdEmpresa == idempresa && q.IdEmpleado == idempleado select q; foreach (var item in Query) { ro_DocumentoxEmp_Info Obj = new ro_DocumentoxEmp_Info(); Obj.IdEmpresa = item.IdEmpresa; Obj.IdEmpleado = item.IdEmpleado; Obj.IdDocumento = item.IdDocumento; Obj.Dc_Nombre = item.Dc_Nombre; Obj.Dc_Descripcion = item.Dc_Descripcion; Obj.Documento = item.Documento; Obj.Estado = item.Estado; Obj.FechaReg = item.FechaReg; Obj.tipo = item.tipo; Obj.check = true; Lst.Add(Obj); } return(Lst); } 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 GuardarDB(List <ro_DocumentoxEmp_Info> LstInfo) { try { ro_DocumentoxEmp_Info info = new ro_DocumentoxEmp_Info(); info = LstInfo.FirstOrDefault(); if (EliminarDB(LstInfo, ref msg)) { return(oData.GuardarDB(LstInfo)); } else { return(false); } } 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("", "GuardarDB", ex.Message), ex) { EntityType = typeof(ro_DocumentoxEmp_Bus) }; } }
public Boolean GrabarBD(ro_DocumentoxEmp_Info item) { try { using (EntitiesRoles Context = new EntitiesRoles()) { // var contact = ro_DocumentoxEmp.Createro_DocumentoxEmp(0, 0, 0, "", "", "", DateTime.Now, ""); var Address = new ro_DocumentoxEmp(); Address.IdEmpresa = item.IdEmpresa; Address.IdEmpleado = item.IdEmpleado; Address.IdDocumento = item.IdDocumento; Address.Dc_Nombre = item.Dc_Nombre; Address.tipo = item.tipo; Address.Dc_Descripcion = item.Dc_Descripcion; Address.Documento = item.Documento; Address.FechaReg = item.FechaReg; Address.Estado = item.Estado; Context.ro_DocumentoxEmp.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()); } }