示例#1
0
 protected virtual void OnCustomerSave(CustomerEventArgs e)
 {
     if (CustomerSave != null)
     {
         CustomerSave(this, e);
     }
 }
 /// <summary>
 /// Raise customer updated event
 /// </summary>
 /// <param name="source">Source</param>
 /// <param name="e">Arguments</param>
 public virtual void OnCustomerUpdated(object source, CustomerEventArgs e)
 {
     if (this.CustomerUpdated != null)
     {
         this.CustomerUpdated(source, e);
     }
 }
示例#3
0
 protected virtual void OnCustomerEdit(CustomerEventArgs e)
 {
     if (CustomerEdit != null)
     {
         CustomerEdit(this, e);
     }
 }
示例#4
0
        private void OnCustomerAdded(object sender, CustomerEventArgs e)
        {
            CustomerViewModel vm = new CustomerViewModel(e.Customer, this.repository);

            vm.PropertyChanged += this.OnCustomerViewModelPropertyChanged;

            this.AllCustomers.Add(vm);
        }
        /// <summary>
        /// Inspect the response message and do the schema validation.
        /// </summary>
        /// <param name="reply">The message to be transformed into types and handed back to the client application.</param>
        /// <param name="correlationState">Correlation state data</param>
        public void AfterReceiveReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
        {
            this.lastRawResponseMessage = reply.ToString();

            if (this.ValidationEvent != null)
            {
                CustomerEventArgs args = new CustomerEventArgs { RawRequestXml = this.lastRawRequestMessgae, RawResponseXml = this.lastRawResponseMessage };
                this.ValidationEvent(this, args);
            }
        }
示例#6
0
        private void OnCustomerRemoved(object sender, CustomerEventArgs e)
        {
            CustomerViewModel viewModel = this.GetOnlySelectedViewModel();

            if (viewModel != null)
            {
                if (viewModel.Customer == e.Customer)
                {
                    this.AllCustomers.Remove(viewModel);
                }
            }
        }
示例#7
0
        public override void OnCustomerLoadComplete(object sender, CustomerEventArgs e)
        {
            if (PlugInManager.IsModelMappedForPlugIn(e.Customer.Model.Id, this.Id))
            {
                var customer = e.Customer;

                // Hide all accounts under class: 'Income Expenses'
                foreach (Account acct in customer.Accounts.AccountsWithClass(C.IncomeExpenses))
                {
                    acct.Hidden = true;
                }
            }
        }
示例#8
0
        private CustomerEventArgs NewCustomerRequestedHandler(object sender, CustomerEventArgs args)
        {
            args = new CustomerEventArgs();
            CreateCustomer createCustomerWindow = new CreateCustomer();

            if ((bool)createCustomerWindow.ShowDialog())
            {
                args.Name    = createCustomerWindow.tb_CustomerName.Text;
                args.Company = createCustomerWindow.tb_CompanyName.Text;
                return(args);
            }

            return(null);
        }
 private void OnCustomerSend(object sender, CustomerEventArgs e)
 {
     if (sender is AddCustomerViewModel)
     {
         Customers.Add(e.Customer);
     }
     else if (sender is EditCustomerViewModel)
     {
         foreach (var customer in Customers.Where(x => x.Id.Equals(e.Customer.Id)))
         {
             customer.Name            = e.Customer.Name;
             customer.LastName        = e.Customer.LastName;
             customer.Address         = e.Customer.Address;
             customer.TelephoneNumber = e.Customer.TelephoneNumber;
         }
         Customers = new ObservableCollection <Customer>(Customers);
     }
 }
        /// <summary>
        /// Validate the response xml.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">An CustomerEventArgs that contains event data.</param>
        public void ValidateSchema(object sender, CustomerEventArgs e)
        {
            if (!string.IsNullOrEmpty(e.RawRequestXml))
            {
                this.site.Log.Add(LogEntryKind.Debug, "The raw xml request message is:\r\n{0}", e.RawRequestXml);
                XmlDocument requestXml = new XmlDocument();
                requestXml.LoadXml(e.RawRequestXml);
                SchemaValidation.LastRawRequestXml = requestXml.DocumentElement;
            }
            else
            {
                SchemaValidation.LastRawRequestXml = null;
            }

            if (!string.IsNullOrEmpty(e.RawResponseXml))
            {
                this.site.Log.Add(LogEntryKind.Debug, "The raw xml response message is:\r\n{0}", e.RawResponseXml);

                MemoryStream ms = new MemoryStream(System.Text.ASCIIEncoding.ASCII.GetBytes(e.RawResponseXml));
                XmlReader xmlReader = XmlReader.Create(ms);
                e.ValidationXmlReaderOut = xmlReader;

                XmlDocument responseDoc = new XmlDocument();
                responseDoc.LoadXml(e.RawResponseXml);
                SchemaValidation.LastRawResponseXml = responseDoc.DocumentElement;

                if (this.performSchemaValidation)
                {
                    SchemaValidation.ValidateXml(this.site, this.ignoreSoapFaultSchemaValidationForSoap12);

                    if (this.throwException 
                        && ((ValidationResult.Error == SchemaValidation.ValidationResult)
                           || (ValidationResult.Warning == SchemaValidation.ValidationResult)))
                    {
                        throw new XmlSchemaValidationException(SchemaValidation.GenerateValidationResult());
                    }
                }
            }
            else
            {
                SchemaValidation.LastRawResponseXml = null;
            }
        }
示例#11
0
        private void OnCustomerAdded(object sender, CustomerEventArgs e)
        {
            CustomerViewModel viewModel = new CustomerViewModel(e.Customer, repositorys);

            this.AllCustomers.Add(viewModel);
        }