Example #1
0
 private void ExecuteDeleteCustomerInvoiceGroup(object obj)
 {
     if (SelectedCustomerInvoiceGroups != null && !SelectedCustomerInvoiceGroups.CIG.DefaultCig)
     {
         _dataService.DeleteCustomerInvoiceGroup(SelectedCustomerInvoiceGroups.CIG.CustomerInvoiceGroupID).Subscribe(
             r =>
         {
             if (r.Success == false)
             {
                 if (r.Response == "Could not delete CustomerInvoiceGroup")
                 {
                     CustomerInvoiceGroups.Remove(SelectedCustomerInvoiceGroups);
                 }
                 else
                 {
                     MessageBox.Show(r.Response);
                 }
             }
             if (r.Success)
             {
                 CustomerInvoiceGroups.Remove(SelectedCustomerInvoiceGroups);
             }
         });
     }
 }
Example #2
0
 public bool CheckAll()
 {
     if (CustomerInvoiceGroups.Where(s => s.IsMail).Select(r => r.Email).Contains(string.Empty))
     {
         if (CustomerInvoiceGroups.Select(l => l.Label).Contains(null) ||
             CustomerInvoiceGroups.Select(s => s.Address1).Contains(null) ||
             CustomerInvoiceGroups.Select(z => z.ZipCode).Contains(null) ||
             CustomerInvoiceGroups.Select(c => c.City).Contains(null) ||
             CustomerInvoiceGroups.Select(cc => cc.Country).Contains(null) ||
             CustomerInvoiceGroups.Select(e => e.Email).Contains(string.Empty))
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     if (CustomerInvoiceGroups.Select(l => l.Label).Contains(null) ||
         CustomerInvoiceGroups.Select(s => s.Address1).Contains(null) ||
         CustomerInvoiceGroups.Select(z => z.ZipCode).Contains(null) ||
         CustomerInvoiceGroups.Select(c => c.City).Contains(null) ||
         CustomerInvoiceGroups.Select(cc => cc.Country).Contains(null))
     {
         return(false);
     }
     return(true);
 }
Example #3
0
 protected virtual void ClearNavigationProperties()
 {
     CustomerInvoiceGroups.Clear();
     User = null;
     TimeEntryTypes.Clear();
     Projects.Clear();
     Tags.Clear();
     UsersCustomers.Clear();
     Users = null;
 }
        private void GetAllCustomerInvoiceGroups()
        {
            _dataService.GetCustomerInvoiceGroupByCustomerId(_customer.Id).Subscribe(
                i =>
            {
                foreach (var customerInvoiceGroup in i)
                {
                    CustomerInvoiceGroups.Add(customerInvoiceGroup);
                }

                NewCigLabel = CustomerInvoiceGroups.Where(d => d.DefaultCig).Select(l => l.Label).First();
            });
        }
        private void CustomerInvoiceGroupsOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
        {
            if (propertyChangedEventArgs.PropertyName == "SelectedItem")
            {
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    if (CustomerInvoiceGroups.Items.Count - 1 != 0)
                    {
                        CustomerInvoiceGroups.CurrentCellInfo = new GridViewCellInfo(CustomerInvoiceGroups.Items[CustomerInvoiceGroups.Items.Count - 1],
                                                                                     CustomerInvoiceGroups.Columns["Label"]);
                        CustomerInvoiceGroups.Focus();

                        CustomerInvoiceGroups.CurrentCell.IsInEditMode = true;
                    }
                }));
            }
        }
Example #6
0
 private void ExecuteAddNew(object obj)
 {
     CustomerInvoiceGroups.Add(
         new EditCustomerInvoiceGroupItemViewModel(
             new CustomerInvoiceGroup
     {
         Attention  = _customer.ContactName,
         Email      = _customer.Email,
         Address1   = _customer.StreetAddress,
         Address2   = _customer.Address2,
         ZipCode    = _customer.ZipCode,
         City       = _customer.City,
         Country    = _customer.Country,
         CustomerID = _customer.CustomerID,
         SendFormat = _customer.SendFormat,
         EmailCC    = _customer.EmailCC
     }));
     CloseAndSaveCIGView.RaiseCanExecuteChanged();
     SelectedCustomerInvoiceGroups = CustomerInvoiceGroups.Last();
 }
 private void ExecuteSaveInvoice(object obj)
 {
     _customerInvoiceGroup.CustomerID = _customer.CustomerID;
     if (CustomerInvoiceGroups.Select(l => l.Label).Contains(NewCigLabel) && !SelectedCIG.DefaultCig)
     {
         var result = MessageBox.Show("Do you want to overwrite existing customer invoice group?", "wait",
                                      MessageBoxButton.OKCancel);
         if (result == MessageBoxResult.OK)
         {
             Overwrite();
         }
     }
     else if (SelectedCIG != null && SelectedCIG.DefaultCig)
     {
         _invoice.CustomerInvoiceGroup = SelectedCIG;
         SaveInvoice();
     }
     else
     {
         _customerInvoiceGroup.Label   = NewCigLabel;
         _invoice.CustomerInvoiceGroup = _customerInvoiceGroup;
         SaveInvoice();
     }
 }
Example #8
0
        private void ExecuteCloseAndSaveCIGView(object obj)
        {
            _dataService.InsertCustomerInvoiceGroup(new ObservableCollection <CustomerInvoiceGroup>(CustomerInvoiceGroups.Select(f => f.CIG))).Subscribe(
                r =>
            {
                if (r.Success == false)
                {
                    MessageBox.Show(r.Response);
                }

                InternalCommands.UpdateCustomerInvoiceGroupList.Execute(_customer);
                InternalCommands.CustomerInvoiceGroupComplete.Execute(null);
            });
        }