Esempio n. 1
0
        public void AddData(ModelNotifiedForOrders modelNotifiedForOrders, out string error)
        {
            OrdersBsn  bsn    = new OrdersBsn(wpfConfig);
            OrdersInfo dbItem = new OrdersInfo();

            Cloner.CopyAllTo(typeof(ModelNotifiedForOrders), modelNotifiedForOrders, typeof(OrdersInfo), dbItem);
            bsn.InsertOne(dbItem, out error);
            modelNotifiedForOrders.NewItem = false;
            Cloner.CopyAllTo(typeof(OrdersInfo), dbItem, typeof(ModelNotifiedForOrders), modelNotifiedForOrders);
        }
Esempio n. 2
0
        public void TryInclude(CreateOrdersView viewToInclude, out RestExceptionError error)
        {
            error = null;
            OrdersInfo dbViewToInclude = new OrdersInfo();

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

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