Beispiel #1
0
        private static void OnOrderDocumentFormation()
        {
            var etsViewModel = new ETSMainViewModel {
                Description = "Формирование заявок"
            };
            var etsView = new ETSMainView();

            etsViewModel.View = etsView;

            Workspace.This.Panels.Add(etsViewModel);
        }
        private PanelViewModelBase ReleasedETSMainViewModel(string[] args)
        {
            if (args == null)
            {
                return(null);
            }

            var etsViewModel = new ETSMainViewModel();

            if (args.Length > 2)
            {
                if (args[2] == CustomersEnum.Vostok.GetName())
                {
                    etsViewModel.SetCustomerType(CustomersEnum.Vostok);
                }
                else if (args[2] == CustomersEnum.Inkay.GetName())
                {
                    etsViewModel.SetCustomerType(CustomersEnum.Inkay);
                }
            }

            string orderFile = null;

            try {
                orderFile = args.Skip(2).First(p => p.Contains("заявка"));
            } catch (Exception ex) {
                Debug.WriteLine(GetType().Name + ": " + ex.Message);
            }
            if (orderFile != null)
            {
                etsViewModel.SetOrderFile(orderFile);
            }

            string treatyFile = null;

            try {
                treatyFile = args.Skip(2).First(p => p.Contains("догов"));
            } catch (Exception ex) {
                Debug.WriteLine(GetType().Name + ": " + ex.Message);
            }
            if (treatyFile != null && treatyFile.Length > 0)
            {
                etsViewModel.SetContractFile(treatyFile);
            }

            etsViewModel.Description = "Формирование заявок";
            var etsView = new ETSMainView();

            etsViewModel.View = etsView;

            return(etsViewModel);
        }