Ejemplo n.º 1
0
        public OrderEditWindowViewModel(OrdersTabViewModel orderTabViewModel, OrderEditWindow orderEditWindow,
            Order order)
            : base(orderTabViewModel, orderEditWindow, order)
        {
            CompaniesList = new List<Company>();
            using (var con = new BaudiDbContext())
            {
                OrderTypesList = con.OrderTypes.ToList();
                MenagersList = con.Menagers.ToList();
                CompaniesList = con.Companies.ToList();
                NotificationsList = con.Notifications.ToList();
                if (Update)
                {
                    Order = con.Orders.Find(order.ExpenseTargetID);
                    SelectedOrderType = Order.OrderType;

                    var companies = new List<Company>();
                    var orderType = con.OrderTypes.Find(SelectedOrderType.OrderTypeID);
                    orderType.Specializations.ForEach(s => companies.AddRange(s.Companies));
                    CompaniesList = companies;

                    SelectedCompany = Order.Company;
                    SelectedMenager = Order.Menager;
                    SelectedNotification = Order.Notification;
                    SelectedOrderStatus = Order.Status;

                }
                else
                {
                    Order = new Order();
                    Order.FilingDate = DateTime.Now;
                    Order.LastChanged = DateTime.Now;
                }
            }
        }
Ejemplo n.º 2
0
        public ExpenseTable(Order order,DateTime dateFrom, DateTime dateTo)
        {
            TableRows = new List<ExpenseTableRow>();
            CompanyName = order.Company.Name;
            Description = order.Description;
            Cost = order.Cost.ToString(CultureInfo.CurrentCulture);
            ResposiblePerson = FullNameHelper.ToFullName(order.Menager.Name, order.Menager.Surname);

            var expenses = order.Expenses.Where(e => e.Date >= dateFrom && e.Date <= dateTo);

            foreach (var expense in expenses)
            {
                TableRows.Add(new ExpenseTableRow(expense));
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="ordersTabViewModel">Orders tabs View model</param>
 /// <param name="order">Order</param>
 public OrderEditWindow(OrdersTabViewModel ordersTabViewModel, Order order)
 {
     InitializeComponent();
     DataContext = new OrderEditWindowViewModel(ordersTabViewModel, this, order);
 }