Beispiel #1
0
        private bool loadModels()
        {
            CRMSettingViewModel.instance();

            ComplectationItemViewModel.instance();

            EquipmentViewModel.instance();
            ModificationViewModel.instance();
            SellerViewModel.instance();
            BuyerViewModel.instance();
            BidStatusViewModel.instance();
            PaymentStatusViewModel.instance();
            MessageTemplatesViewModel.instance();

            RoleViewModel.instance();
            ManagerViewModel.instance();

            BidViewModel.instance();



            //EquipmentBidViewModel.instance();
            //ComplectationViewModel.instance();

            //ComplectationItemViewModel.instance();

            return(true);
        }
Beispiel #2
0
        string getMessageBody()
        {
            int transportCompanyId            = (int)cbxTransportCompany.SelectedValue;
            TransportCompany transportCompany = TransportCompanyViewModel.instance().getById(transportCompanyId);

            if (transportCompany == null)
            {
                return("");
            }

            MessageTemplates messageTemplate = MessageTemplatesViewModel.instance().getById(transportCompany.Id_message_template);

            if (messageTemplate == null)
            {
                return("");
            }

            string msg = messageTemplate.Template;

            msg = msg.Replace("{SHIPMENT_DATE}", dpShipmentDate.SelectedDate.Value.ToString("dd.MM.yyyy"));
            msg = msg.Replace("{TRANSPORT_COMPANY_NAME}", transportCompany.Name);
            msg = msg.Replace("{WAYBILL}", tbxWaybill.Text);
            msg = msg.Replace("{TRANSPORT_COMPANY_SITE}", transportCompany.Site);

            return(msg);
        }
Beispiel #3
0
        //Изменение выбранной транспортной компании
        void CbxTransportCompany_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            if (bid.BidBuyer.Email != "" && IsEmail.Valid(bid.BidBuyer.Email))
            {
                cbIsMailSend.IsChecked = true;
                gbxBidFiles.Visibility = Visibility.Visible;
            }
            else
            {
                cbIsMailSend.IsChecked = false;
                cbIsMailSend.IsEnabled = false;
                gbxBidFiles.Visibility = Visibility.Collapsed;
                return;
            }

            if (e.AddedItems.Count == 0)
            {
                return;
            }

            TransportCompany tc = e.AddedItems[0] as TransportCompany;

            if (tc == null)
            {
                cbIsMailSend.IsChecked = false;
                cbIsMailSend.IsEnabled = false;
                gbxBidFiles.Visibility = Visibility.Collapsed;
                return;
            }

            MessageTemplates messageTemplate = MessageTemplatesViewModel.instance().getById(tc.Id_message_template);

            //Если шаблон null
            if (messageTemplate == null)
            {
                cbIsMailSend.IsChecked = false;
                cbIsMailSend.IsEnabled = false;
                gbxBidFiles.Visibility = Visibility.Collapsed;
                return;
            }

            // Если шаблон пустой
            if (messageTemplate.Template == "")
            {
                cbIsMailSend.IsChecked = false;
                cbIsMailSend.IsEnabled = false;
                gbxBidFiles.Visibility = Visibility.Collapsed;
            }
            else
            {
                cbIsMailSend.IsEnabled = true;
                cbIsMailSend.IsChecked = true;
                gbxBidFiles.Visibility = Visibility.Visible;
            }
        }
Beispiel #4
0
        public MessageTemplatesWindow()
        {
            InitializeComponent();

            viewSource.Source = MessageTemplatesViewModel.instance().Collection;

            viewSource.Filter += delegate(object sender, FilterEventArgs e)
            {
                MessageTemplates messageTemplate = e.Item as MessageTemplates;
                if (messageTemplate == null)
                {
                    return;
                }
                e.Accepted = messageTemplate.IsVisible;
            };
            DataContext = new { MessageTemplatesCollection = viewSource.View };
        }
Beispiel #5
0
        string getTheme()
        {
            int transportCompanyId            = (int)cbxTransportCompany.SelectedValue;
            TransportCompany transportCompany = TransportCompanyViewModel.instance().getById(transportCompanyId);

            if (transportCompany == null)
            {
                return("");
            }

            MessageTemplates messageTemplate = MessageTemplatesViewModel.instance().getById(transportCompany.Id_message_template);

            if (messageTemplate == null)
            {
                return("");
            }

            return(messageTemplate.Theme);
        }
        public TransportCompanySaveWindow(TransportCompany transportCompany = null)
        {
            InitializeComponent();
            defaultBrush = tbxName.Background;

            cbxMessageTemplate.ItemsSource = MessageTemplatesViewModel.instance().Collection;

            if (transportCompany != null)
            {
                Title        = "Редактирование транспортной компании (" + transportCompany.Name + ")";
                tbxName.Text = transportCompany.Name;
                tbxSite.Text = transportCompany.Site;
                cbxMessageTemplate.SelectedValue = transportCompany.Id_message_template;

                this.transportCompany = transportCompany;
            }
            else
            {
                this.transportCompany = new TransportCompany();
            }
            tbxName.TextChanged += delegate { tbxName.Background = defaultBrush; };
            cbxMessageTemplate.SelectionChanged += delegate { cbxMessageTemplate.Background = defaultBrush; };
        }
Beispiel #7
0
 void TbxSearch_TextChanged(object sender, TextChangedEventArgs e)
 {
     MessageTemplatesViewModel.instance().search(tbxSearch.Text);
     viewSource.View.Refresh();
 }