public BaseResponse <List <EntidadFinancieraResponse> > getEntidadesFinancieras() { BaseResponse <List <EntidadFinancieraResponse> > result = new BaseResponse <List <EntidadFinancieraResponse> >(); result.data = new List <EntidadFinancieraResponse>(); string host = ConfigurationManager.AppSettings["HostAdmin"]; try { using (MesaDineroContext context = new MesaDineroContext()) { result.data = context.Tb_MD_Entidades_Financieras.Where(x => x.iEstadoRegistro == EstadoRegistroTabla.Activo && x.VTipo == "B").Select(x => new EntidadFinancieraResponse { codigo = x.vCodEntidad, nombre = x.vDesEntidad, icon = host + x.vLogoEntidad, formatoNroCuenta = x.vFormatoCuentaBancaria, formatoCCI = x.vFormatoCCI }).ToList(); } result.success = true; } catch (Exception ex) { result.success = false; result.ex = ex; result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; } return(result); }
public BaseResponse <List <SubastasActivasResponse> > getSubastasActivas(string partner) { BaseResponse <List <SubastasActivasResponse> > result = new BaseResponse <List <SubastasActivasResponse> >(); result.data = new List <SubastasActivasResponse>(); try { #region Parametros var partnerParam = new SqlParameter { ParameterName = "partner", Value = partner }; #endregion using (MesaDineroContext context = new MesaDineroContext()) { result.data = context.Database.SqlQuery <SubastasActivasResponse>("exec Proc_Sel_SubastasActivas_Partner @partner", partnerParam).ToList <SubastasActivasResponse>(); } List <int> ids = result.data.Select(x => x.codigo).ToList(); result.other = string.Join(",", ids); result.success = true; } catch (Exception ex) { result.success = false; result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; } return(result); }
public ExportFiles descargarTxt(int idTransaccion) { ExportFiles file = new ExportFiles(); try { using (MesaDineroContext context = new MesaDineroContext()) { Tb_MD_Documentos documento = context.Tb_MD_DocOrdenPagoSubasta.Where(x => x.nNumeroSubasta == idTransaccion).FirstOrDefault().Tb_MD_Documentos; file.Name = documento.vNombre; file.Extension = documento.vExtension; file.FileBytes = documento.vArchivo; //Name = x., // Extension = x.vDesMoneda + " (" + x.vCodMoneda + ")", // FileBytes= } //result.success = true; public string Name { get; set; } //public string Extension { get; set; } //public Byte[] FileBytes { get; set; } } catch (Exception ex) { //result.success = false; //result.ex = ex; //result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; } return(file); }
public async Task <BaseResponse <PersonaJuridicaReuest> > getDatosPersonaJuridicaSimple(string ruc) { BaseResponse <PersonaJuridicaReuest> result = new BaseResponse <PersonaJuridicaReuest>(); result.data = new PersonaJuridicaReuest(); Tb_MD_Per_Juridica empresa = null; try { using (MesaDineroContext context = new MesaDineroContext()) { empresa = context.Tb_MD_Per_Juridica.FirstOrDefault(x => x.vNumDocumento.Equals(ruc)); } if (empresa != null) { result.data.nombre = empresa.vNombreEntidad; result.data.direccion = empresa.vDireccion; } else { result.data = await QuertiumServices.getDatosPersonaJuridica(ruc); } result.success = true; } catch (Exception ex) { result.success = false; result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; throw; } return(result); }
public BaseResponse <List <ComboListItem> > getDistrito() { BaseResponse <List <ComboListItem> > result = new BaseResponse <List <ComboListItem> >(); result.data = new List <ComboListItem>(); try { using (MesaDineroContext context = new MesaDineroContext()) { result.data = context.Tb_MD_Distrito.Where(x => x.iEstadoRegistro == EstadoRegistroTabla.Activo).Select(x => new ComboListItem { value = x.IdDistrito, text = x.Nombre }).ToList(); } result.success = true; } catch (Exception ex) { result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; result.ex = ex; result.success = false; } return(result); }
public BaseResponse <string> compararPassword(string clave, int user) { BaseResponse <string> result = new BaseResponse <string>(); try { using (MesaDineroContext context = new MesaDineroContext()) { Tb_MD_Mae_Usuarios usuario = context.Tb_MD_Mae_Usuarios.FirstOrDefault(x => x.iIdUsuario == user); if (!usuario.vPassword.Equals(clave)) { throw new Exception("El password es incorrecto."); } } result.success = true; } catch (Exception ex) { result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; result.ex = ex; result.success = false; } return(result); }
public BaseResponse <List <ComboListItemString> > getAllTipoDocumentoPersona() { BaseResponse <List <ComboListItemString> > result = new BaseResponse <List <ComboListItemString> >(); result.data = new List <ComboListItemString>(); try { using (MesaDineroContext context = new MesaDineroContext()) { result.data = context.Tb_MD_TipoDocumento.Where(x => x.Tipo.Equals("P") && x.EstadoRegistro == EstadoRegistroTabla.Activo).OrderBy(x => x.Nombre).Select(x => new ComboListItemString { value = x.IdTipoDocumento, text = x.Nombre }).ToList(); } result.success = true; } catch (Exception ex) { result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; result.ex = ex; result.success = false; } return(result); }
public BaseResponse <List <TipoCambioMercadoPartner_Response> > getAllTipoCambioMercadoDelDiaPartnert(string empresa) { BaseResponse <List <TipoCambioMercadoPartner_Response> > result = new BaseResponse <List <TipoCambioMercadoPartner_Response> >(); try { #region Parametros var partnerParam = new SqlParameter { ParameterName = "banco", Value = empresa }; #endregion using (MesaDineroContext context = new MesaDineroContext()) { result.data = context.Database.SqlQuery <TipoCambioMercadoPartner_Response>("exec Proc_Sel_tipoCambioMercadoActual_Partner @banco", partnerParam).ToList <TipoCambioMercadoPartner_Response>(); } result.success = true; } catch (Exception ex) { result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; result.success = false; } return(result); }
public BaseResponse <List <ComboListItem> > getDistritoForProvincia(string pais, int dep, int prov) { BaseResponse <List <ComboListItem> > result = new BaseResponse <List <ComboListItem> >(); result.data = new List <ComboListItem>(); try { using (MesaDineroContext context = new MesaDineroContext()) { result.data = context.Tb_MD_Ubigeo.Where(x => x.CodPais.Equals(pais) && x.CodDepartamento == dep && x.CodProvincia == prov).Select(x => new ComboListItem { value = x.Tb_MD_Distrito.IdDistrito, text = x.Tb_MD_Distrito.Nombre }).ToList(); } result.success = true; } catch (Exception ex) { result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; result.ex = ex; result.success = false; } return(result); }
public BaseResponse <List <ComboListItem> > getProvinciaForDepartamento(string pais, int dep) { BaseResponse <List <ComboListItem> > result = new BaseResponse <List <ComboListItem> >(); result.data = new List <ComboListItem>(); try { using (MesaDineroContext context = new MesaDineroContext()) { result.data = context.Tb_MD_Ubigeo.Where(x => x.iEstadoRegistro == EstadoRegistroTabla.Activo).Where(x => x.CodPais.Equals(pais) && x.CodDepartamento == dep).Select(x => new ComboListItem { value = x.Tb_MD_Provincia.IdProvincia, text = x.Tb_MD_Provincia.Nombre }).Distinct().ToList(); } result.success = true; } catch (Exception ex) { result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; result.ex = ex; result.success = false; } return(result); }
public BaseResponse <List <ComboListItemString> > getAllTipoMoneda() { BaseResponse <List <ComboListItemString> > result = new BaseResponse <List <ComboListItemString> >(); result.data = new List <ComboListItemString>(); try { using (MesaDineroContext context = new MesaDineroContext()) { result.data = context.Tb_MD_TipoMoneda.Where(x => x.iEstadoRegistro == EstadoRegistroTabla.Activo).Select(x => new ComboListItemString { value = x.vCodMoneda, text = x.vDesMoneda + " (" + x.vCodMoneda + ")" }).ToList(); } result.success = true; } catch (Exception ex) { result.success = false; result.ex = ex; result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; } return(result); }
public BaseResponse <List <ComboListItem> > getAllTipoCuentaBanacaria() { BaseResponse <List <ComboListItem> > result = new BaseResponse <List <ComboListItem> >(); result.data = new List <ComboListItem>(); try { using (MesaDineroContext context = new MesaDineroContext()) { result.data = context.Tb_MD_TipoCuentaBancaria.Where(x => x.EstadoRegistro == EstadoRegistroTabla.Activo).OrderBy(x => x.Nombre).Select(x => new ComboListItem { value = x.IdTipoCuenta, text = x.Nombre }).ToList(); } result.success = true; } catch (Exception ex) { result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; //result.ex = ex; result.success = false; result.other = ex.StackTrace.ToString(); } return(result); }
/*Nuevos Filtros */ public BaseResponse <List <ComboListItemString> > getAllEntidadBancaria() { BaseResponse <List <ComboListItemString> > result = new BaseResponse <List <ComboListItemString> >(); result.data = new List <ComboListItemString>(); try { using (MesaDineroContext context = new MesaDineroContext()) { result.data = context.Tb_MD_Entidades_Financieras.Where(p => p.iEstadoRegistro == EstadoRegistroTabla.Activo).Select(x => new ComboListItemString { value = x.vCodEntidad, text = x.vDesEntidad }).ToList(); } result.success = true; } catch (Exception ex) { result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; result.ex = ex; result.success = false; } return(result); }
public PageResultSP <PartnerListaAdjudicacionResponse> getListadoAdjudicacionPartner(PageResultParam param, string numPartner) { PageResultSP <PartnerListaAdjudicacionResponse> result = new PageResultSP <PartnerListaAdjudicacionResponse>(); try { result.data = new List <PartnerListaAdjudicacionResponse>(); string idpartner = ""; int page = param.pageIndex + 1; #region Parametros var pageParam = new SqlParameter { ParameterName = "PageNumber", Value = page }; var itemsParam = new SqlParameter { ParameterName = "ItemsPerPage", Value = param.itemPerPage }; var partnerParam = new SqlParameter { ParameterName = "numPartner", Value = numPartner }; #endregion int total = 0; using (MesaDineroContext context = new MesaDineroContext()) { result.data = context.Database.SqlQuery <PartnerListaAdjudicacionResponse>("exec Proc_Sel_Lista_Adjudicaciones @PageNumber,@ItemsPerPage,@numPartner", pageParam, itemsParam, partnerParam).ToList <PartnerListaAdjudicacionResponse>(); if (result.data.Count > 0) { total = Convert.ToInt32(result.data[0].total); } } #region Copiar Al Cual var pag = Utilities.ResultadoPagination(page, param.itemPerPage, total); result.itemperpage = pag.itemperpage; result.limit = pag.limit; result.numbersPages = pag.numbersPages; result.offset = pag.offset; result.page = pag.page; result.PageCount = pag.pageCount; result.total = pag.total; #endregion result.success = true; } catch (Exception ex) { // copiar result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; result.success = false; } return(result); }
/*--------------------------*/ public BaseResponse <List <ComboListItemString> > getAllComboEmpresas(string filtro) { BaseResponse <List <ComboListItemString> > result = new BaseResponse <List <ComboListItemString> >(); result.data = new List <ComboListItemString>(); try { using (MesaDineroContext context = new MesaDineroContext()) { if (filtro == "") { result.data = context.Tb_MD_Per_Juridica.Select(x => new ComboListItemString { value = x.vNumDocumento, text = x.vRazonSocial }).ToList(); } if (filtro.ToUpper() == TipoUsuario.Lmd) { result.data = context.Tb_MD_Per_Juridica.Where(x => x.IsLmd == true).Select(x => new ComboListItemString { value = x.vNumDocumento, text = x.vRazonSocial }).ToList(); } if (filtro.ToUpper() == TipoUsuario.Partner) { result.data = context.Tb_MD_Per_Juridica.Where(x => x.IsPartner == true).Select(x => new ComboListItemString { value = x.vNumDocumento, text = x.vRazonSocial }).ToList(); } if (filtro.ToUpper() == TipoUsuario.Fideicomiso) { result.data = context.Tb_MD_Per_Juridica.Where(x => x.IsFideicomiso == true).Select(x => new ComboListItemString { value = x.vNumDocumento, text = x.vRazonSocial }).ToList(); } } result.success = true; } catch (Exception ex) { result.success = false; result.ex = ex; result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; } return(result); }
public BaseResponse <string> updateTipoCambioSubasta(int subasta, decimal tipoCambio) { BaseResponse <string> result = new BaseResponse <string>(); using (MesaDineroContext context = new MesaDineroContext()) { using (var transaction = context.Database.BeginTransaction()) { try { Tb_MD_Subasta_Detalle detalle = null; detalle = context.Tb_MD_Subasta_Detalle.FirstOrDefault(x => x.iIdSubastaDEtalle == subasta); if (detalle == null) { throw new Exception("Error Nulll, hay un problema con la subasta."); } result.success = true; if (detalle.vTipoDetalle == "V") { detalle.nValorCompra = tipoCambio; } else { detalle.nValorVenta = tipoCambio; } detalle.TipoCambio = tipoCambio; context.SaveChanges(); transaction.Commit(); } catch (System.Data.Entity.Validation.DbEntityValidationException ex) { #region Error EntityFramework var errorMessages = ex.EntityValidationErrors .SelectMany(x => x.ValidationErrors) .Select(x => x.ErrorMessage); var fullErrorMessage = string.Join("; ", errorMessages); result.success = false; result.error = fullErrorMessage; transaction.Rollback(); #endregion } catch (Exception ex) { result.success = false; result.ex = ex; transaction.Rollback(); result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; } } } return(result); }
public PageResultSP <OperacionesHistoricas> getOperacionesHistoricas(PageResultParam param) { PageResultSP <OperacionesHistoricas> valorRegistrados = new PageResultSP <OperacionesHistoricas>(); try { valorRegistrados.data = new List <OperacionesHistoricas>(); int page = param.pageIndex + 1; #region Parametros var pageParam = new SqlParameter { ParameterName = "PageNumber", Value = page }; var itemsParam = new SqlParameter { ParameterName = "ItemsPerPage", Value = param.itemPerPage }; var filtroParam = new SqlParameter { ParameterName = "vTipoFiltro", Value = param.textFilter }; #endregion int total = 0; using (MesaDineroContext context = new MesaDineroContext()) { valorRegistrados.data = context.Database.SqlQuery <OperacionesHistoricas>("exec Proc_Sel_OperacionesHistoricas @PageNumber,@ItemsPerPage,@vTipoFiltro", pageParam, itemsParam, filtroParam).ToList <OperacionesHistoricas>(); if (valorRegistrados.data.Count > 0) { total = Convert.ToInt32(valorRegistrados.data[0].total); } } #region Copiar Al Cual var pag = Utilities.ResultadoPagination(page, param.itemPerPage, total); valorRegistrados.itemperpage = pag.itemperpage; valorRegistrados.limit = pag.limit; valorRegistrados.numbersPages = pag.numbersPages; valorRegistrados.offset = pag.offset; valorRegistrados.page = pag.page; valorRegistrados.PageCount = pag.pageCount; valorRegistrados.total = pag.total; #endregion valorRegistrados.success = true; } catch (Exception ex) { // copiar valorRegistrados.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; valorRegistrados.success = false; } return(valorRegistrados); }
public BaseResponse <string> insertNewTiempo(TiempoRequest model) { BaseResponse <string> result = new BaseResponse <string>(); using (MesaDineroContext context = new MesaDineroContext()) { using (var transaccion = context.Database.BeginTransaction()) { try { Tb_MD_Tiempos vtiempo = context.Tb_MD_Tiempos.Find(model.codigo); if (vtiempo != null) { throw new Exception("Codigo ya existente,Ingrese otro codigo"); } Tb_MD_Tiempos tiempo = new Tb_MD_Tiempos(); tiempo.vCodTransaccion = model.codigo; tiempo.nTiempoStandar = model.tiempoStandar; tiempo.nTiempoPremiun = model.tiempoPremiun; tiempo.nTiempoVip = model.tiempoVip; tiempo.dFechaCreacion = DateTime.Now; tiempo.iEstadoRegistro = model.estado; context.Tb_MD_Tiempos.Add(tiempo); context.SaveChanges(); transaccion.Commit(); result.success = true; } catch (System.Data.Entity.Validation.DbEntityValidationException ex) { #region Error EntityFramework var errorMessages = ex.EntityValidationErrors .SelectMany(x => x.ValidationErrors) .Select(x => x.ErrorMessage); var fullErrorMessage = string.Join("; ", errorMessages); result.success = false; result.error = fullErrorMessage; transaccion.Rollback(); #endregion } catch (Exception ex) { result.success = false; transaccion.Rollback(); result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; } } } return(result); }
public BaseResponse <string> CambioPasswordXCorreoAdmin(string secredId, string password) { BaseResponse <string> result = new BaseResponse <string>(); using (MesaDineroContext context = new MesaDineroContext()) { using (var transaction = context.Database.BeginTransaction()) { try { Guid sid = Guid.NewGuid(); try { sid = Guid.Parse(secredId); } catch (Exception) { throw new Exception("Ocurrio un error con el servicio, puede ser que su key de sesiĆ³n no sea correcta."); } Tb_MD_RecuperarPassword recuperar = null; recuperar = context.Tb_MD_RecuperarPassword.FirstOrDefault(x => x.SecredId == sid); if (recuperar == null) { throw new Exception("La operacion que intenta realizar no cuenta con autorizaciĆ³n para hacerla."); } Tb_MD_Mae_Usuarios usuario = null; usuario = context.Tb_MD_Mae_Usuarios.FirstOrDefault(x => x.iIdUsuario == recuperar.IdUsuario); if (usuario == null) { throw new Exception("No se encontro el usuario."); } string clave = Encrypt.EncryptKey(password); usuario.vPassword = clave; context.SaveChanges(); transaction.Commit(); result.success = true; } catch (Exception ex) { result.success = false; result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; transaction.Rollback(); } } } return(result); }
public Tb_MD_Mae_Usuarios getClienteAdmBySecredId(Guid secredId) { Tb_MD_Mae_Usuarios entity = null; using (MesaDineroContext context = new MesaDineroContext()) { entity = context.Tb_MD_Mae_Usuarios.FirstOrDefault(x => x.SecretId == secredId); } return(entity); }
public Tb_MD_Pre_Clientes getPreClienteBySecredId(Guid secredId) { Tb_MD_Pre_Clientes entity = null; using (MesaDineroContext context = new MesaDineroContext()) { entity = context.Tb_MD_Pre_Clientes.FirstOrDefault(x => x.SecretId.Equals(secredId)); } return(entity); }
public Tb_MD_ClienteUsuario getUsuarioAutorizadoBySecredId(Guid secredId) { Tb_MD_ClienteUsuario entity = null; using (MesaDineroContext context = new MesaDineroContext()) { entity = context.Tb_MD_ClienteUsuario.Where(y => y.SecredId == secredId).FirstOrDefault(); } return(entity); }
public PageResultSP <OrigenFondoResponse> getAllOrigenFondo(PageResultParam param) { PageResultSP <OrigenFondoResponse> result = new PageResultSP <OrigenFondoResponse>(); result.data = new List <OrigenFondoResponse>(); try { int page = param.pageIndex + 1; int total = 0; #region Parametros var pageParam = new SqlParameter { ParameterName = "PageNumber", Value = page }; var itemsParam = new SqlParameter { ParameterName = "ItemsPerPage", Value = param.itemPerPage }; #endregion using (MesaDineroContext context = new MesaDineroContext()) { result.data = context.Database.SqlQuery <OrigenFondoResponse>("exec Proc_Sel_OrigenFondo @PageNumber,@ItemsPerPage", pageParam, itemsParam).ToList <OrigenFondoResponse>(); if (result.data.Count > 0) { total = Convert.ToInt32(result.data[0].total); } } #region Copiar Al Cual var pag = Utilities.ResultadoPagination(page, param.itemPerPage, total); result.itemperpage = pag.itemperpage; result.limit = pag.limit; result.numbersPages = pag.numbersPages; result.offset = pag.offset; result.page = pag.page; result.PageCount = pag.pageCount; result.total = pag.total; result.success = true; #endregion } catch (Exception ex) { result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; result.success = false; } return(result); }
public BaseResponse <string> insertNewTipoDocumento(TipoDocumentoRequest model) { BaseResponse <string> result = new BaseResponse <string>(); using (MesaDineroContext context = new MesaDineroContext()) { using (var transaccion = context.Database.BeginTransaction()) { try { Tb_MD_TipoDocumento tipo = context.Tb_MD_TipoDocumento.Find(model.codigo); if (tipo != null) { throw new Exception("Codigo ya existente,Ingrese otro codigo"); } Tb_MD_TipoDocumento tipodoc = new Tb_MD_TipoDocumento(); tipodoc.IdTipoDocumento = model.codigo; tipodoc.Nombre = model.nombre; tipodoc.Tipo = model.tipo; tipodoc.EstadoRegistro = model.estado; context.Tb_MD_TipoDocumento.Add(tipodoc); context.SaveChanges(); transaccion.Commit(); result.success = true; } catch (System.Data.Entity.Validation.DbEntityValidationException ex) { #region Error EntityFramework var errorMessages = ex.EntityValidationErrors .SelectMany(x => x.ValidationErrors) .Select(x => x.ErrorMessage); var fullErrorMessage = string.Join("; ", errorMessages); result.success = false; result.error = fullErrorMessage; transaccion.Rollback(); #endregion } catch (Exception ex) { result.success = false; transaccion.Rollback(); result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; } } } return(result); }
public IEnumerable <MenuAccess> GetAccessMenu(int currentUser) { using (MesaDineroContext context = new MesaDineroContext()) { string raizRuta = ConfigurationManager.AppSettings["RutaMenu"]; var usuario = context.Tb_MD_Mae_Usuarios.First(x => x.iIdUsuario == currentUser); IEnumerable <Tb_MD_Perfiles> perfiles; perfiles = usuario.Tb_MD_PerfilUsuario.Select(x => x.Tb_MD_Perfiles).ToList(); var result = perfiles.SelectMany(x => x.Tb_MD_PefilPagina.Where(y => y.Tb_MD_Pagina.EsMenu == true).OrderBy(y => y.Tb_MD_Pagina.Orden).Select(y => new MenuAccess { Nombre = y.Tb_MD_Pagina.Nombre, RouteUrl = y.Tb_MD_Pagina.Ruta, Orden = y.Tb_MD_Pagina.Orden, MenuId = y.Tb_MD_Pagina.iIdPagina, ParentMenuId = y.Tb_MD_Pagina.ParentMenu, Modulo = y.Tb_MD_Pagina.Modulo ?? "", Icon = y.Tb_MD_Pagina.Icon ?? "" })); List <MenuAccess> menues = new List <MenuAccess>(); result.ToList().ForEach(x => { if (menues.Where(y => y.Nombre == x.Nombre).ToList().Count() == 0) { MenuAccess men = new MenuAccess(); string ruta = ""; men.Nombre = x.Nombre; if (x.RouteUrl == null) { ruta = ""; } else { if (x.RouteUrl.Length > 0) { ruta = raizRuta + x.RouteUrl.Substring(1, x.RouteUrl.Length - 1).Trim(); } } men.RouteUrl = ruta; men.Orden = x.Orden; men.MenuId = x.MenuId; men.ParentMenuId = x.ParentMenuId; men.Modulo = x.Modulo ?? ""; men.Icon = x.Icon ?? ""; menues.Add(men); } }); //var lista2 = menues.ToList(); //var listas = result.Select(x => x.Nombre).Distinct(); //return result.ToList(); return(menues.ToList()); } }
public BaseResponse <string> EditarUbigeo(UbigeoRequest model) { BaseResponse <string> result = new BaseResponse <string>(); using (MesaDineroContext context = new MesaDineroContext()) { using (var transaccion = context.Database.BeginTransaction()) { try { Tb_MD_Ubigeo ubigeo = context.Tb_MD_Ubigeo.Find(model.codigo); if (ubigeo == null) { throw new Exception("Entidad Nula, Registro de Ubigeo no encontrado"); } ubigeo.CodPais = model.codigoPais; ubigeo.CodDepartamento = model.codigoDepartamento; ubigeo.CodProvincia = model.codigoProvincia; ubigeo.CodDistrito = model.codigoDistrito; ubigeo.iEstadoRegistro = model.estado; context.SaveChanges(); transaccion.Commit(); result.success = true; } catch (System.Data.Entity.Validation.DbEntityValidationException ex) { #region Error EntityFramework var errorMessages = ex.EntityValidationErrors .SelectMany(x => x.ValidationErrors) .Select(x => x.ErrorMessage); var fullErrorMessage = string.Join("; ", errorMessages); result.success = false; result.error = fullErrorMessage; transaccion.Rollback(); #endregion } catch (Exception ex) { result.success = false; transaccion.Rollback(); result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; } } } return(result); }
public BaseResponse <string> EditarPerfil(PerfilRequest model, string usuarioDoc) { BaseResponse <string> result = new BaseResponse <string>(); using (MesaDineroContext context = new MesaDineroContext()) { using (var transaccion = context.Database.BeginTransaction()) { try { Tb_MD_Perfiles perfil = context.Tb_MD_Perfiles.Find(model.codigo); if (perfil == null) { throw new Exception("Entidad Nula, Cargo no encontrado"); } //Tb_MD_Cargo cargo = new Tb_MD_Cargo(); perfil.NombrePerfil = model.nombre; perfil.EstadoRegistro = model.estado; perfil.FechaModificacion = DateTime.Now; perfil.vUsuarioCreacion = usuarioDoc; //context.Tb_MD_Cargo.Add(cargo); context.SaveChanges(); transaccion.Commit(); result.success = true; } catch (System.Data.Entity.Validation.DbEntityValidationException ex) { #region Error EntityFramework var errorMessages = ex.EntityValidationErrors .SelectMany(x => x.ValidationErrors) .Select(x => x.ErrorMessage); var fullErrorMessage = string.Join("; ", errorMessages); result.success = false; result.error = fullErrorMessage; transaccion.Rollback(); #endregion } catch (Exception ex) { result.success = false; transaccion.Rollback(); result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; } } } return(result); }
public BaseResponse <string> EditarTipoMoneda(TipoMonedaRequest model) { BaseResponse <string> result = new BaseResponse <string>(); using (MesaDineroContext context = new MesaDineroContext()) { using (var transaccion = context.Database.BeginTransaction()) { try { Tb_MD_TipoMoneda tipo = context.Tb_MD_TipoMoneda.Find(model.codigo); if (tipo == null) { throw new Exception("Entidad Nula, Tipo de Moneda no encontrado"); } tipo.vDesMoneda = model.nombre; tipo.vSimboloMoneda = model.simbolo; tipo.dFechaModificacion = DateTime.Now; tipo.iEstadoRegistro = model.estado; context.SaveChanges(); transaccion.Commit(); result.success = true; } catch (System.Data.Entity.Validation.DbEntityValidationException ex) { #region Error EntityFramework var errorMessages = ex.EntityValidationErrors .SelectMany(x => x.ValidationErrors) .Select(x => x.ErrorMessage); var fullErrorMessage = string.Join("; ", errorMessages); result.success = false; result.error = fullErrorMessage; transaccion.Rollback(); #endregion } catch (Exception ex) { result.success = false; transaccion.Rollback(); result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; } } } return(result); }
public BaseResponse <string> sendCorreoRecuperarPasswordAdmin(string email) { BaseResponse <string> result = new BaseResponse <string>(); using (MesaDineroContext context = new MesaDineroContext()) { using (var transaction = context.Database.BeginTransaction()) { try { Guid SecredId = Guid.NewGuid(); DateTime ahora = DateTime.Now; Tb_MD_Mae_Usuarios usuario = null; usuario = context.Tb_MD_Mae_Usuarios.FirstOrDefault(x => x.vEstadoRegistro == EstadoRegistroTabla.Activo && x.vEmailUsuario.Equals(email)); Tb_MD_Per_Natural persona = null; persona = context.Tb_MD_Per_Natural.FirstOrDefault(y => y.vNumDocumento == usuario.vNroDocumento); if (usuario == null) { throw new Exception("No se encontro un cliente de LMD con este Email"); } Tb_MD_RecuperarPassword entity = new Tb_MD_RecuperarPassword { Email = usuario.vEmailUsuario, FechaCreacion = ahora, FechaExpiracion = ahora.AddDays(1), IdUsuario = usuario.iIdUsuario, SecredId = SecredId, TipoUsuario = "CL" }; context.Tb_MD_RecuperarPassword.Add(entity); context.SaveChanges(); transaction.Commit(); result.success = true; CorreoHelper.SedCorreoRecuperarContrasenhaAdmin(usuario.vEmailUsuario, SecredId.ToString(), persona.vNombre + " " + persona.vApellido + " " + persona.vApellidoMat); } catch (Exception ex) { result.success = false; result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; transaction.Rollback(); } } } return(result); }
public BaseResponse <List <PartnerListaAdjudicacionResponse> > ListaAdjudicacionExcel(string numPartner, string operaciones) { BaseResponse <List <PartnerListaAdjudicacionResponse> > result = new BaseResponse <List <PartnerListaAdjudicacionResponse> >(); result.data = new List <PartnerListaAdjudicacionResponse>(); using (MesaDineroContext context = new MesaDineroContext()) { try { result.data = new List <PartnerListaAdjudicacionResponse>(); #region Parametros var partnerParam = new SqlParameter { ParameterName = "numPartner", Value = numPartner }; var codigoParam = new SqlParameter { ParameterName = "Parametros", Value = operaciones }; #endregion result.data = context.Database.SqlQuery <PartnerListaAdjudicacionResponse>("exec Proc_Sel_Lista_Adjudicaciones_excel @numPartner,@Parametros", partnerParam, codigoParam).ToList <PartnerListaAdjudicacionResponse>(); result.success = true; return(result); } catch (System.Data.Entity.Validation.DbEntityValidationException ex) { #region Error EntityFramework var errorMessages = ex.EntityValidationErrors .SelectMany(x => x.ValidationErrors) .Select(x => x.ErrorMessage); var fullErrorMessage = string.Join("; ", errorMessages); result.success = false; result.error = fullErrorMessage; #endregion } catch (Exception ex) { result.success = false; result.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message; } } return(result); }