public HttpResponseMessage P0005SHPR_USUA(BESHMC_USUA oBe)
        {
            var oBr = new BRSHMC_USUA();

            try
            {
                oBr.P0006SHPR_USUA(oBe);
                return(Request.CreateResponse(HttpStatusCode.OK, oBe));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotAcceptable, ex.Message));
            }
        }
Пример #2
0
        public HttpResponseMessage P0002SHPR_USUA_LIST(BESHMC_USUA oBe)
        {
            try
            {
                if (string.IsNullOrWhiteSpace((string)HttpContext.Current.Session["username"]))
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, "Acceso no autorizado."));
                }

                var oBr   = new BRSHMC_USUA();
                var oList = oBr.P0002SHPR_USUA_LIST(oBe);
                return(Request.CreateResponse(HttpStatusCode.OK, oList));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
Пример #3
0
 public HttpResponseMessage P0001SHPR_USUA_LIST(BESHMC_USUA oBe)
 {
     try
     {
         var oBr   = new BRSHMC_USUA();
         var oList = oBr.P0001SHPR_USUA_LIST(oBe);
         if (oList.Count == 0)
         {
             throw new ArgumentException("Credenciales de usuario invalidas.");
         }
         HttpContext.Current.Session["username"] = oBe.COD_USUA;
         return(Request.CreateResponse(HttpStatusCode.OK, oBe));
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
     }
 }
Пример #4
0
        public HttpResponseMessage P0005SHPR_USUA(BESHMC_USUA oBe)
        {
            try
            {
                if (string.IsNullOrWhiteSpace((string)HttpContext.Current.Session["username"]))
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, "Acceso no autorizado."));
                }

                if (oBe.COD_AGEN == 0)
                {
                    throw new ArgumentException("Seleccione un colaborador.");
                }
                if (string.IsNullOrEmpty(oBe.COD_USUA))
                {
                    throw new ArgumentException("Especifique un nombre de usuario.");
                }
                if (string.IsNullOrEmpty(oBe.ALF_PASS))
                {
                    throw new ArgumentException("La contraseña no puede ser un datos en blanco.");
                }
                if (!oBe.ALF_PASS.Equals(oBe.ALF_PASS_REPE))
                {
                    throw new ArgumentException("Las contraseñas no coinciden.");
                }
                if (oBe.COD_TIPO_USUA == 0)
                {
                    throw new ArgumentException("Seleccione un tipo de usuario.");
                }

                var oBr = new BRSHMC_USUA();
                oBe.COD_USUA_CREA = (string)HttpContext.Current.Session["username"];
                oBe.COD_USUA_MODI = (string)HttpContext.Current.Session["username"];
                oBr.P0005SHPR_USUA(oBe);
                return(Request.CreateResponse(HttpStatusCode.OK, oBe));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
Пример #5
0
        public HttpResponseMessage P0005SHPR_USUA(BESHMC_USUA oBe)
        {
            var oBr  = new BRSHMC_USUA();
            var oBeR = new BESHMC_USUA_RESP();

            try
            {
                oBr.P0006SHPR_USUA(oBe);
                oBeR.IND_ESTA = true;
                oBeR.ALF_MESA = "";
                oBeR.ALF_AGEN = oBe.ALF_AGEN;
                return(Request.CreateResponse(HttpStatusCode.OK, oBeR));
            }
            catch (Exception ex)
            {
                oBeR.IND_ESTA = false;
                oBeR.ALF_MESA = ex.Message;
                oBeR.ALF_AGEN = "";
                return(Request.CreateResponse(HttpStatusCode.NotAcceptable, oBeR));
            }
        }