void form_CustomerUpdated(object sender, EventArgs e)
        {
            LoadCustomers();

            var source = (SortableBindingList<CustomerDisplayModel>)customerDisplayModelBindingSource.DataSource;
            if (source != null)
            {
                if (selectedId == 0)
                    selectedId = source.Max(a => a.Id);

                if (selectedId != 0)
                {
                    CustomerDisplayModel item = source.FirstOrDefault(a => a.Id == selectedId);
                    int index = customerDisplayModelBindingSource.IndexOf(item);

                    customerDisplayModelBindingSource.Position = index;
                    dataGridView1.Rows[index].Selected = true;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// For a customer master data model, populate customer display model with project information
        /// </summary>
        private async Task <CustomerDisplayModel> GetAccountModel(AccountResponseModel accountData)
        {
            var customerModel = new CustomerDisplayModel
            {
                CustomerName = accountData.Name,
                CustomerUid  = accountData.Id
            };

            var headers = CustomHeaders;

            // We want to remove any customer UID passed in, and replace it with the customer in question
            if (headers.ContainsKey(HeaderConstants.X_VISION_LINK_CUSTOMER_UID))
            {
                headers.Remove(HeaderConstants.X_VISION_LINK_CUSTOMER_UID);
            }

            headers.Add(HeaderConstants.X_VISION_LINK_CUSTOMER_UID, accountData.Id);

            var projects = await projectProxy.GetProjects(accountData.Id, headers);

            customerModel.Projects = await ExecuteAgainstMultiple(projects, y => GetProjectModel(y, headers));

            return(customerModel);
        }
Esempio n. 3
0
 public CreateCustomerResponse(CustomerDisplayModel customer)
 {
     Customer = customer;
 }
Esempio n. 4
0
 public static DisplayCustomerDto ToDisplayDto(this CustomerDisplayModel customer)
 {
     return(new DisplayCustomerDto(customer.Id, customer.FullName));
 }
Esempio n. 5
0
 public GetSpecificCustomerResponse(CustomerDisplayModel customer)
 {
     Customer = customer;
 }