Beispiel #1
0
        public void AddData(ModelNotifiedForCustomerDemographics modelNotifiedForCustomerDemographics, out string error)
        {
            CustomerDemographicsBsn  bsn    = new CustomerDemographicsBsn(wpfConfig);
            CustomerDemographicsInfo dbItem = new CustomerDemographicsInfo();

            Cloner.CopyAllTo(typeof(ModelNotifiedForCustomerDemographics), modelNotifiedForCustomerDemographics, typeof(CustomerDemographicsInfo), dbItem);
            bsn.InsertOne(dbItem, out error);
            modelNotifiedForCustomerDemographics.NewItem = false;
            Cloner.CopyAllTo(typeof(CustomerDemographicsInfo), dbItem, typeof(ModelNotifiedForCustomerDemographics), modelNotifiedForCustomerDemographics);
        }
Beispiel #2
0
        public void TryInclude(CreateCustomerDemographicsView viewToInclude, out RestExceptionError error)
        {
            error = null;
            CustomerDemographicsInfo dbViewToInclude = new CustomerDemographicsInfo();

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

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