Exemplo n.º 1
0
        public Commons.Dashboard.Expired GetExpired(Int32 IdCustomer, Int32 IdAccount)
        {
            Commons.Dashboard.Expired data = new Commons.Dashboard.Expired();
            IRestResponse             WSR  = Task.Run(() => apiClient.getJArray("Dashboard/Expirados", "IdCustomer=" + IdCustomer
                                                                                + "&IdAccount=" + IdAccount)).Result;

            if (WSR.StatusCode == HttpStatusCode.OK)
            {
                data = JObject.Parse(WSR.Content).ToObject <Commons.Dashboard.Expired>();
            }

            return(data);
        }
        public HttpResponseMessage GetExpired(Int32 IdCustomer, Int32 IdAccount)
        {
            HttpResponseMessage respuesta = null;

            try
            {
                Commons.Dashboard.Expired result = Dal.Dashboard.GetExpired(IdCustomer, IdAccount);
                respuesta = Request.CreateResponse(HttpStatusCode.OK, result);
            }
            catch (Exception ex)
            {
                respuesta = Request.CreateErrorResponse(HttpStatusCode.Conflict, (ex.InnerException == null) ? ex.Message : ex.InnerException.Message);
            }
            return(respuesta);
        }
        public static Commons.Dashboard.Expired GetExpired(Int32 IdCustomer, Int32 IdAccount)
        {
            Commons.Dashboard.Expired obj = new Commons.Dashboard.Expired();
            using (IndexEntities db = new IndexEntities())
            {
                spg_DashboardExpired_Result result = db.spg_DashboardExpired(IdCustomer, IdAccount).FirstOrDefault();
                obj.Total            = (Int32)result.Total;
                obj.InTimePercent    = (Decimal)result.InTimePercent;
                obj.InTimeQuantity   = (Decimal)result.InTimeQuantity;
                obj.ToExpirePercent  = (Decimal)result.ToExpirePercent;
                obj.ToExpireQuantity = (Decimal)result.ToExpireQuntity;
                obj.ExpiredPercent   = (Decimal)result.ExpiredPercent;
                obj.ExpiredQuantity  = (Decimal)result.ExpiredQuantity;
            }

            return(obj);
        }