コード例 #1
0
ファイル: EmployeeBL.cs プロジェクト: nelsonjc/Prueba
        public async Task <RSV_Global <Employee> > Create(Employee employee)
        {
            RSV_Global <Employee> infoResult = new RSV_Global <Employee>();

            try
            {
                EmployeeValidatioResult validation = EmployeeValidator.Validate(employee);

                if (!validation.ISValid)
                {
                    infoResult.Error = validation.Error;
                    return(infoResult);
                }

                infoResult = await _employeeDAC.Create(employee);
            }
            catch (SqlException ex)
            {
                infoResult.Error   = new Error(ex, SqlMessageErrorGenerator.GetMessageError(ex.Number));
                infoResult.Success = false;
            }
            catch (Exception ex)
            {
                infoResult.Error   = new Error(ex, $"Se presentó un error en el método {((MethodInfo)MethodBase.GetCurrentMethod()).Name.ToString()}. {ex.ToString()}");
                infoResult.Success = false;
            }

            return(infoResult);
        }
コード例 #2
0
ファイル: EmployeeBL.cs プロジェクト: nelsonjc/Prueba
        public async Task <RSV_Global <Employee> > Update(Employee employee)
        {
            EmployeeValidatioResult employeeValidatioResult = null;
            RSV_Global <Employee>   infoResult = new RSV_Global <Employee>();


            try
            {
                employeeValidatioResult = Validate(employee);
                if (!employeeValidatioResult.ISValid)
                {
                    infoResult.Error = employeeValidatioResult.Error;
                    return(infoResult);
                }

                infoResult = await _employeeDAC.Update(employee);
            }
            catch (Exception ex)
            {
                infoResult.Error   = new Error(ex, $"Se presentó un error en el método {((MethodInfo)MethodBase.GetCurrentMethod()).Name.ToString()}. {ex.ToString()}");
                infoResult.Success = false;
            }

            finally
            {
                employeeValidatioResult = null;
            }

            return(infoResult);
        }
コード例 #3
0
        public async Task <RSV_Global <bool> > EnviarEmailProveedor(string pNombreProveedor, string pNombreProducto, string pMail)
        {
            RSV_Global <bool> infoResultado = new RSV_Global <bool>();
            string            pBody         = string.Empty;

            try
            {
                if (!(ValidMail(pMail)))
                {
                    throw new System.ArgumentException($"El Mail {pMail} no es valido", new Exception($"El Mail {pMail} no es valido"));
                }

                pBody = "<link href='//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css' rel='stylesheet' id='bootstrap-css'><script src='//axcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js'></script><script src='//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script><link href='//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css' rel='stylesheet' id='bootstrap-css'>-<script src='//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js'></script>-<script src='//code.jquery.com/jquery-1.11.1.min.js'></script><div style='font-family: Helvetica Neue, Helvetica, Helvetica, Arial, sans-serif;'><table style='width: 100%;'><tr><td></td><td bgcolor='#FFFFFF'><div style='padding: 15px; max-width: 600px;margin: 0 auto;display: block; border-radius: 0px;padding: 0px; border: 1px solid lightseagreen;'><table style='width: 100%;background: #ff9000 ;'><tr><td></td> <td><div><table width='100%'><tr><td rowspan='2' style='text-align:center;padding:10px;'><img style='float:left; ' width='200'  src='https://ms-f7-sites-01-cdn.azureedge.net/docs/stories/774590-siigo-professional-services-office365-azure-spa-colombia/resources/7e4ff59a-d2d5-4dce-bc7d-7a0e4efda393/1186398634972771890_1186398634972771890' /></span></span></td></tr></table></div></td><td></td></tr></table><table style='padding: 10px;font-size:14px; width:100%;'><tr><td style='padding:10px;font-size:14px; width:100%;'><p>Hola [NOMBRE],</p><p><br /> Le escribimos para informarle que actualmente requerimos el producto <strong>[PRODUCTO]</strong>.</p><p>Gracias por su atención<br><br><strong>Cordialmente, </strong><br>Area de Ventas,<br></td></tr></table></div>";

                pBody = pBody.Replace("[NOMBRE]", pNombreProveedor);
                pBody = pBody.Replace("[PRODUCTO]", pNombreProducto);

                await SendEmailRestPass($"Solicitud de producto <{pNombreProducto}> - Siigo", pBody, pMail);

                infoResultado.Exitoso = true;
            }
            catch (Exception ex)
            {
                infoResultado.Exitoso = false;
                infoResultado.Error   = new Error(ex, $"Se presento un error en el método {((MethodInfo)MethodBase.GetCurrentMethod()).Name.ToString()}. {ex.Message}");
            }

            infoResultado.Datos = true;
            return(infoResultado);
        }
コード例 #4
0
        public async Task <RSV_Global <Employee> > Update(Employee employee)
        {
            RSV_Global <Employee> infoResult = new RSV_Global <Employee> {
                Data = employee
            };
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                ParameterHelper.NewParameter("@pIDEmployee", SqlDbType.Int, 10, ParameterDirection.Input, employee.IDEmployee),
                ParameterHelper.NewParameter("@pIDDocumentType", SqlDbType.Int, 10, ParameterDirection.Input, employee.IDDocumentType),
                ParameterHelper.NewParameter("@pDocumentNumber", SqlDbType.VarChar, 50, ParameterDirection.Input, employee.DocumentNumber),
                ParameterHelper.NewParameter("@pName", SqlDbType.VarChar, 50, ParameterDirection.Input, employee.Name),
                ParameterHelper.NewParameter("@pSecondName", SqlDbType.VarChar, 50, ParameterDirection.Input, employee.SecondName),
                ParameterHelper.NewParameter("@pSurname", SqlDbType.VarChar, 50, ParameterDirection.Input, employee.Surname),
                ParameterHelper.NewParameter("@pSecondSurname", SqlDbType.VarChar, 50, ParameterDirection.Input, employee.SecondSurname),
                ParameterHelper.NewParameter("@pIDSubArea", SqlDbType.Int, 10, ParameterDirection.Input, employee.IDSubArea),
                ParameterHelper.NewParameter("@pURLImage", SqlDbType.VarChar, 255, ParameterDirection.Input, employee.URLImage),
                ParameterHelper.NewParameter("@pActive", SqlDbType.Bit, 4, ParameterDirection.Input, employee.Active)
            };

            var command = this.Database.GetDbConnection().CreateCommand();

            command.CommandText = "[General].[EmployeeUpdate]";
            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.AddRange(parameters.ToArray());
            await command.Connection.OpenAsync();

            infoResult.Data.IDEmployee = (int)await command.ExecuteScalarAsync();

            command.Connection.Close();
            return(infoResult);
        }
コード例 #5
0
ファイル: BaseController.cs プロジェクト: carlostoalz/DotNet
        protected RSV_Global <U> SetError <U>(RSV_Global <U> infoResultado, Exception ex)
        {
            infoResultado.Exitoso         = false;
            infoResultado.Error           = new Error(ex.Message, ex.StackTrace);
            infoResultado.CodigoRespuesta = 500;

            return(infoResultado);
        }
コード例 #6
0
        public async Task <ActionResult> GetByNit(long pNit)
        {
            RSV_Global <Tercero> infoResultado = new RSV_Global <Tercero>();

            try
            {
                infoResultado = await _terceroBL.GetByNit(pNit);
            }
            catch (Exception ex)
            {
                infoResultado.Error   = new Error(ex, $"Se presento un error en el metodo {((MethodInfo)MethodBase.GetCurrentMethod()).Name.ToString()}. {ex.Message}");
                infoResultado.Exitoso = false;
            }

            return(Ok(infoResultado));
        }
コード例 #7
0
        public async Task <ActionResult> SendMailProveedor(string pMail, string pNombreProducto, string pNombreProveedor)
        {
            RSV_Global <bool> infoResultado = new RSV_Global <bool>();

            try
            {
                infoResultado = await _notificacionBusiness.EnviarEmailProveedor(pNombreProveedor, pNombreProducto, pMail);
            }
            catch (Exception ex)
            {
                infoResultado.Error   = new Error(ex, $"Se presento un error en el metodo {((MethodInfo)MethodBase.GetCurrentMethod()).Name.ToString()}. {ex.Message}");
                infoResultado.Exitoso = false;
            }

            return(Ok(infoResultado));
        }
コード例 #8
0
        public async Task <ActionResult> ChangePassword(int id, string password)
        {
            RSV_Global <bool> infoResultado = new RSV_Global <bool>();

            try
            {
                infoResultado = await wUsuarioBL.ChangePassword(id, password);
            }
            catch (Exception ex)
            {
                infoResultado.Error   = new Error(ex, $"Se presento un error en el metodo {((MethodInfo)MethodBase.GetCurrentMethod()).Name.ToString()}. {ex.Message}");
                infoResultado.Exitoso = false;
            }

            return(Ok(infoResultado));
        }
コード例 #9
0
        public async Task <ActionResult> GetById(int pID)
        {
            RSV_Global <Producto> infoResultado = new RSV_Global <Producto>();

            try
            {
                infoResultado = await _productBusiness.GetById(pID);
            }
            catch (Exception ex)
            {
                infoResultado.Error   = new Error(ex, $"Se presento un error en el metodo {((MethodInfo)MethodBase.GetCurrentMethod()).Name.ToString()}. {ex.Message}");
                infoResultado.Exitoso = false;
            }

            return(Ok(infoResultado));
        }
コード例 #10
0
        public async Task <ActionResult> Autocomplete(string pValorBusqueda)
        {
            RSV_Global <List <Producto> > infoResultado = new RSV_Global <List <Producto> >();

            try
            {
                infoResultado = await _productBusiness.Autocomplete(pValorBusqueda);
            }
            catch (Exception ex)
            {
                infoResultado.Error   = new Error(ex, $"Se presento un error en el metodo {((MethodInfo)MethodBase.GetCurrentMethod()).Name.ToString()}. {ex.Message}");
                infoResultado.Exitoso = false;
            }

            return(Ok(infoResultado));
        }
コード例 #11
0
ファイル: EmployeeController.cs プロジェクト: nelsonjc/Prueba
        public async Task <RSV_Global <Employee> > GetByID(int IDEmployee)
        {
            RSV_Global <Employee> infoResult = new RSV_Global <Employee>();

            try
            {
                _employeeService = new EmployeeService(_appsettings);
                infoResult       = await _employeeService.GetByID(IDEmployee);
            }
            catch (Exception ex)
            {
                infoResult.error = new Error(ex, $"Se presento un error en el método {((MethodInfo)MethodBase.GetCurrentMethod()).Name.ToString()}. {ex.Message}");
            }

            return(infoResult);
        }
コード例 #12
0
        public async Task <RSV_Global <List <DataList> > > GetByType(string NameDateListType)
        {
            var infoResult = new RSV_Global <List <DataList> >();

            try
            {
                infoResult = await _dataListDAC.GetByType(NameDateListType);
            }
            catch (Exception ex)
            {
                infoResult.Error   = new Error(ex, $"Se presentó un error en el método {((MethodInfo)MethodBase.GetCurrentMethod()).Name.ToString()}. {ex.ToString()}");
                infoResult.Success = false;
            }

            return(infoResult);
        }
コード例 #13
0
        public async Task <RSV_Global <List <Employee> > > GetAll()
        {
            RSV_Global <List <Employee> > infoResult = new RSV_Global <List <Employee> >();
            var command = this.Database.GetDbConnection().CreateCommand();

            command.CommandText = "[General].[EmployeeGetAll]";
            command.CommandType = CommandType.StoredProcedure;
            await command.Connection.OpenAsync();

            using (var reader = await command.ExecuteReaderAsync())
            {
                infoResult.Data = reader.Translate <Employee>().ToList();
            }
            command.Connection.Close();
            return(infoResult);
        }
コード例 #14
0
ファイル: AreaBL.cs プロジェクト: nelsonjc/Prueba
        public async Task <RSV_Global <List <Area> > > GetAll()
        {
            var infoResult = new RSV_Global <List <Area> >();

            try
            {
                infoResult = await _areaDAC.Get(-1);
            }
            catch (Exception ex)
            {
                infoResult.Error   = new Error(ex, $"Se presentó un error en el método {((MethodInfo)MethodBase.GetCurrentMethod()).Name.ToString()}. {ex.ToString()}");
                infoResult.Success = false;
            }

            return(infoResult);
        }
コード例 #15
0
ファイル: EmployeeBL.cs プロジェクト: nelsonjc/Prueba
        public async Task <RSV_Global <Employee> > GetByID(int IDEmployee)
        {
            var infoResult = new RSV_Global <Employee>();

            try
            {
                infoResult = await _employeeDAC.GetByID(IDEmployee);
            }
            catch (Exception ex)
            {
                infoResult.Error   = new Error(ex, $"Se presentó un error en el método {((MethodInfo)MethodBase.GetCurrentMethod()).Name.ToString()}. {ex.ToString()}");
                infoResult.Success = false;
            }

            return(infoResult);
        }
コード例 #16
0
        public RSV_Global <TipoDocumento> Seleccionar(decimal id)
        {
            RSV_Global <TipoDocumento> infoResultado = new RSV_Global <TipoDocumento>();

            try
            {
                infoResultado.Datos           = this.Business.SeleccionarTipoDocumento(id);
                infoResultado.Exitoso         = true;
                infoResultado.CodigoRespuesta = 200;
            }
            catch (Exception ex)
            {
                infoResultado = this.SetError(infoResultado, ex);
            }

            return(infoResultado);
        }
コード例 #17
0
        public RSV_Global <Empleado> Actualizar(Empleado entity)
        {
            RSV_Global <Empleado> infoResultado = new RSV_Global <Empleado>();

            try
            {
                infoResultado.Datos           = this.Business.ActualizarEmpleado(entity);
                infoResultado.Exitoso         = true;
                infoResultado.CodigoRespuesta = 200;
            }
            catch (Exception ex)
            {
                infoResultado = this.SetError(infoResultado, ex);
            }

            return(infoResultado);
        }
コード例 #18
0
        public RSV_Global <SubArea> Actualizar([FromBody] SubArea entity)
        {
            RSV_Global <SubArea> infoResultado = new RSV_Global <SubArea>();

            try
            {
                infoResultado.Datos           = this.Business.ActualizarSubArea(entity);
                infoResultado.Exitoso         = true;
                infoResultado.CodigoRespuesta = 200;
            }
            catch (Exception ex)
            {
                infoResultado = this.SetError(infoResultado, ex);
            }

            return(infoResultado);
        }
コード例 #19
0
        public RSV_Global <TipoDocumento> Actualizar([FromBody] TipoDocumento entity)
        {
            RSV_Global <TipoDocumento> infoResultado = new RSV_Global <TipoDocumento>();

            try
            {
                infoResultado.Datos           = this.Business.ActualizarTipoDocumento(entity);
                infoResultado.Exitoso         = true;
                infoResultado.CodigoRespuesta = 201;
            }
            catch (Exception ex)
            {
                infoResultado = this.SetError(infoResultado, ex);
            }

            return(infoResultado);
        }
コード例 #20
0
        public RSV_Global <bool> Eliminar(decimal id)
        {
            RSV_Global <bool> infoResultado = new RSV_Global <bool>();

            try
            {
                infoResultado.Datos           = this.Business.EliminarSubArea(id);
                infoResultado.Exitoso         = true;
                infoResultado.CodigoRespuesta = 200;
            }
            catch (Exception ex)
            {
                infoResultado = this.SetError(infoResultado, ex);
            }

            return(infoResultado);
        }
コード例 #21
0
        public RSV_Global <List <SubArea> > Buscar(decimal idArea)
        {
            RSV_Global <List <SubArea> > infoResultado = new RSV_Global <List <SubArea> >();

            try
            {
                infoResultado.Datos           = this.Business.BuscarSubAreas(idArea);
                infoResultado.Exitoso         = true;
                infoResultado.CodigoRespuesta = 200;
            }
            catch (Exception ex)
            {
                infoResultado = this.SetError(infoResultado, ex);
            }

            return(infoResultado);
        }
コード例 #22
0
        public RSV_Global <bool> Registrar([FromBody] Usuario usuario)
        {
            RSV_Global <bool> infoResultado = new RSV_Global <bool>();

            try
            {
                infoResultado.Datos           = this.Business.RegistrarUsuario(usuario);
                infoResultado.Exitoso         = true;
                infoResultado.CodigoRespuesta = 201;
            }
            catch (Exception ex)
            {
                infoResultado = this.SetError(infoResultado, ex);
            }

            return(infoResultado);
        }
コード例 #23
0
ファイル: AreaController.cs プロジェクト: carlostoalz/DotNet
        public RSV_Global <List <Area> > Obtener()
        {
            RSV_Global <List <Area> > infoResultado = new RSV_Global <List <Area> >();

            try
            {
                infoResultado.Datos           = this.Business.ObtenerAreas();
                infoResultado.Exitoso         = true;
                infoResultado.CodigoRespuesta = 200;
            }
            catch (Exception ex)
            {
                infoResultado = this.SetError(infoResultado, ex);
            }

            return(infoResultado);
        }
コード例 #24
0
        public RSV_Global <UserToken> Login(UserInfo user)
        {
            RSV_Global <UserToken> infoResultado = new RSV_Global <UserToken>();

            try
            {
                infoResultado.Datos           = this.Business.Login(user);
                infoResultado.Exitoso         = true;
                infoResultado.CodigoRespuesta = 200;
            }
            catch (Exception ex)
            {
                infoResultado = this.SetError(infoResultado, ex);
            }

            return(infoResultado);
        }
コード例 #25
0
        public async Task <RSV_Global <List <SubArea> > > GetSubAreaByIDArea(int IDArea)
        {
            RSV_Global <List <SubArea> > infoResult = new RSV_Global <List <SubArea> >();

            _Service = new SubAreaService(_appsettings);

            try
            {
                infoResult = await _Service.GetSubAreaByIDArea(IDArea);
            }
            catch (Exception ex)
            {
                infoResult.error = new Error(ex, $"Se presento un error en el método {((MethodInfo)MethodBase.GetCurrentMethod()).Name.ToString()}. {ex.Message}");
            }

            return(infoResult);
        }
コード例 #26
0
        public RSV_Global <List <Empleado> > ObtenerEmpelados(int pPaginaActual = 1, int pTamanoPagina = 10, string ptermino = null)
        {
            RSV_Global <List <Empleado> > infoResultado = new RSV_Global <List <Empleado> >();
            int cantidadPaginas = 0;

            try
            {
                infoResultado.Datos           = this.Business.ObtenerEmpleados(ref cantidadPaginas, pPaginaActual, pTamanoPagina, ptermino);
                infoResultado.CatidadPaginas  = cantidadPaginas;
                infoResultado.Exitoso         = true;
                infoResultado.CodigoRespuesta = 200;
            }
            catch (Exception ex)
            {
                infoResultado = this.SetError(infoResultado, ex);
            }

            return(infoResultado);
        }
コード例 #27
0
        public async Task <RSV_Global <Usuario> > GetById(long id)
        {
            RSV_Global <Usuario> infoResultado = new RSV_Global <Usuario>();

            try
            {
                infoResultado.Datos = new Usuario();
                infoResultado.Datos = await _usuarioDA.UsuarioById_G(id);

                infoResultado.Exitoso = true;
            }
            catch (Exception ex)
            {
                infoResultado.Exitoso = false;
                infoResultado.Error   = new Error(ex, $"Se presento un error en el método {((MethodInfo)MethodBase.GetCurrentMethod()).Name.ToString()}. {ex.Message}");
            }

            return(infoResultado);
        }
コード例 #28
0
ファイル: DataListController.cs プロジェクト: nelsonjc/Prueba
        public async Task <RSV_Global <List <DataList> > > GetByType(string nameTypeList)
        {
            RSV_Global <List <DataList> > infoResult = new RSV_Global <List <DataList> >();

            _Service = new DataListService(_appsettings);

            try
            {
                var infoResulAPI = await _Service.GetByType(nameTypeList);

                infoResult = infoResulAPI.Response;
            }
            catch (Exception ex)
            {
                infoResult.error = new Error(ex, $"Se presento un error en el método {((MethodInfo)MethodBase.GetCurrentMethod()).Name.ToString()}. {ex.Message}");
            }

            return(infoResult);
        }
コード例 #29
0
ファイル: TerceroBL.cs プロジェクト: avargasma/back.siigohack
        public async Task <RSV_Global <Tercero> > GetByNit(long pNit)
        {
            RSV_Global <Tercero> infoResultado = new RSV_Global <Tercero>();

            try
            {
                //Envio la contraseña a generar
                infoResultado.Datos = await _terceroDA.TerceroByNit_G(pNit);

                infoResultado.Exitoso = true;
            }
            catch (Exception ex)
            {
                infoResultado.Exitoso = false;
                infoResultado.Error   = new Error(ex, $"Se presento un error en el método {((MethodInfo)MethodBase.GetCurrentMethod()).Name.ToString()}. {ex.Message}");
            }

            return(infoResultado);
        }
コード例 #30
0
ファイル: EmployeeBL.cs プロジェクト: nelsonjc/Prueba
        public async Task <RSV_Global <List <Employee> > > Autocomplete(Employee employee)
        {
            var infoResult = new RSV_Global <List <Employee> >();

            try
            {
                if (ValidateAutoComplete(employee).ISValid)
                {
                    infoResult = await _employeeDAC.AutoComplete(SetStringEmpty(employee));
                }
            }
            catch (Exception ex)
            {
                infoResult.Error   = new Error(ex, $"Se presentó un error en el método {((MethodInfo)MethodBase.GetCurrentMethod()).Name.ToString()}. {ex.ToString()}");
                infoResult.Success = false;
            }

            return(infoResult);
        }