Exemplo n.º 1
0
        protected override void LoadData()
        {
            ISalesOrderService svcSalesOrder = DI.Resolve <ISalesOrderService>();
            ErrorList          errorList     = new ErrorList();

            try
            {
                SalesOrder_ReadOutput outRead;
                using (TimeTracker.ServiceCall)
                    outRead = svcSalesOrder.Read((int)obj.SalesOrderIdProperty.TransportValue);
                obj.FromDataContract(outRead);
            }
            catch (Exception ex)
            {
                errorList.MergeWith(ErrorList.FromException(ex));
            }
            try
            {
                IEnumerable <SalesOrderDetail_ReadListOutput> outDetail_ReadList;
                using (TimeTracker.ServiceCall)
                    outDetail_ReadList = svcSalesOrder.Detail_ReadList((int)obj.SalesOrderIdProperty.TransportValue);
                obj.DetailList.FromDataContract(outDetail_ReadList);
            }
            catch (Exception ex)
            {
                errorList.MergeWith(ErrorList.FromException(ex));
            }
            if (svcSalesOrder is IDisposable)
            {
                ((IDisposable)svcSalesOrder).Dispose();
            }
            errors.List.DataSource = errorList.Errors;
            errors.List.DataBind();
            Page.DataBind();
        }
Exemplo n.º 2
0
        public ActionResult Detail_ReadList([FromRoute] int _salesOrderId)
        {
            ActionResult response = null;

            try
            {
                if (ModelState.IsValid)
                {
                    Output <ICollection <SalesOrderDetail_ReadListOutput> > output = svc.Detail_ReadList(_salesOrderId);
                    response = StatusCode((int)output.HttpStatus, output);
                    return(response);
                }
                else
                {
                    ModelValidation.AddModelErrors(currentErrors, ModelState);
                }
            }
            catch (Exception ex)
            {
                currentErrors.MergeWith(errorsParser.FromException(ex));
            }
            response = StatusCode((int)currentErrors.HttpStatus, new Output(currentErrors));
            return(response);
        }