Example #1
0
        public void SaveData(ModelNotifiedForCustomers modelNotifiedForCustomers, out string error)
        {
            CustomersBsn  bsn    = new CustomersBsn(wpfConfig);
            CustomersInfo dbItem = new CustomersInfo();

            Cloner.CopyAllTo(typeof(ModelNotifiedForCustomers), modelNotifiedForCustomers, typeof(CustomersInfo), dbItem);

            bsn.UpdateOne(dbItem, out error);
        }
Example #2
0
        public void TryUpdate(UpdateCustomersView viewToUpdate, out RestExceptionError error)
        {
            error = null;
            CustomersInfo dbViewToInclude = new CustomersInfo();

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

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