Пример #1
0
        public void SaveData(ModelNotifiedForOrders modelNotifiedForOrders, out string error)
        {
            OrdersBsn  bsn    = new OrdersBsn(wpfConfig);
            OrdersInfo dbItem = new OrdersInfo();

            Cloner.CopyAllTo(typeof(ModelNotifiedForOrders), modelNotifiedForOrders, typeof(OrdersInfo), dbItem);

            bsn.UpdateOne(dbItem, out error);
        }
Пример #2
0
        public void TryUpdate(UpdateOrdersView viewToUpdate, out RestExceptionError error)
        {
            error = null;
            OrdersInfo dbViewToInclude = new OrdersInfo();

            try
            {
                Cloner.CopyAllTo(typeof(UpdateOrdersView), viewToUpdate, typeof(OrdersInfo), dbViewToInclude);
            }
            catch (Exception ex)
            {
                error = new RestExceptionError();
                error.InternalMessage  = "Internal Error parsing data for (Orders.TryUpdate/Parsing)";
                error.ExceptionMessage = ex.Message;
                error.SourceError      = RestExceptionError._SourceError.ServerSide;
                error.StackTrace       = ex.StackTrace;
            }

            try
            {
                OrdersBsn bsn     = new OrdersBsn(restConfig);
                string    dbError = null;
                bsn.UpdateOne(dbViewToInclude, out dbError);
                if (dbError != null)
                {
                    error = new RestExceptionError();
                    error.InternalMessage  = "Internal Error Save data for [Orders.TryUpdate]";
                    error.ExceptionMessage = dbError;
                    error.SourceError      = RestExceptionError._SourceError.ServerSide;
                    error.StackTrace       = "";
                }
            }
            catch (Exception ex)
            {
                error = new RestExceptionError();
                error.InternalMessage  = "Internal Error Update data for [Orders.TryUpdate]";
                error.ExceptionMessage = ex.Message;
                error.SourceError      = RestExceptionError._SourceError.ServerSide;
                error.StackTrace       = ex.StackTrace;
            }
        }