コード例 #1
0
        public void AddData(ModelNotifiedForShippers modelNotifiedForShippers, out string error)
        {
            ShippersBsn  bsn    = new ShippersBsn(wpfConfig);
            ShippersInfo dbItem = new ShippersInfo();

            Cloner.CopyAllTo(typeof(ModelNotifiedForShippers), modelNotifiedForShippers, typeof(ShippersInfo), dbItem);
            bsn.InsertOne(dbItem, out error);
            modelNotifiedForShippers.NewItem = false;
            Cloner.CopyAllTo(typeof(ShippersInfo), dbItem, typeof(ModelNotifiedForShippers), modelNotifiedForShippers);
        }
コード例 #2
0
        public void TryInclude(CreateShippersView viewToInclude, out RestExceptionError error)
        {
            error = null;
            ShippersInfo dbViewToInclude = new ShippersInfo();

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

            try
            {
                ShippersBsn bsn     = new ShippersBsn(restConfig);
                string      dbError = null;
                bsn.InsertOne(dbViewToInclude, out dbError);
                if (dbError != null)
                {
                    error = new RestExceptionError();
                    error.InternalMessage  = "Internal Error Save data for [Shippers.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 [Shippers.TryInclude/Save]";
                error.ExceptionMessage = ex.Message;
                error.SourceError      = RestExceptionError._SourceError.ServerSide;
                error.StackTrace       = ex.StackTrace;
            }
        }