コード例 #1
0
        public LogisticianMainWindow()
        {
            InitializeComponent();
            Title += " v" + Settings.version + ". Пользователь " + Auth.getInstance().Full_name + ". Режим логиста.";

            try
            {
                int updateTime = int.Parse(CRMSettingViewModel.instance().getByMashineName("bid_update_time").Setting_value) * 1000;
                if (updateTime != 0)
                {
                    Classes.UpdateTask.Start(Dispatcher,
                                             new Action(() => { BidViewModel.instance().reload(); }),
                                             updateTime,
                                             new Action(() => { updateNotification.Visibility = Visibility.Hidden; }),
                                             new Action(() => { updateNotification.Visibility = Visibility.Visible; }));
                }
            }
            catch {}

            CollectionViewSource newViewSource     = new CollectionViewSource();
            CollectionViewSource inWorkViewSource  = new CollectionViewSource();
            CollectionViewSource forShipmentSource = new CollectionViewSource();
            CollectionViewSource archiveViewSource = new CollectionViewSource();

            tiNewBid.Content      = new View.Controls.LogisticianControls.NewsControl(newViewSource, inWorkViewSource);
            tiInWorkBid.Content   = new View.Controls.LogisticianControls.InWorkControl(inWorkViewSource, forShipmentSource);
            tiForShipment.Content = new View.Controls.LogisticianControls.ForShipmentControl(forShipmentSource, archiveViewSource);
            tiArchiveBid.Content  = new View.Controls.LogisticianControls.ArchiveControl(archiveViewSource);
        }
コード例 #2
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);
        }
コード例 #3
0
 public MainControlCRMSetting()
 {
     InitializeComponent();
     DataContext = new
     {
         CRMSettingCollection = CRMSettingViewModel.instance().Collection
     };
 }
コード例 #4
0
        void sendMail()
        {
            Buyer buyer = bid.BidBuyer;

            CRMSettingViewModel crmSetting = CRMSettingViewModel.instance();

            MailMessage message = new MailMessage();

            message.To.Add(buyer.Email);
            message.From       = new MailAddress(crmSetting.getByMashineName("email").Setting_value);
            message.Subject    = getTheme();
            message.Body       = getMessageBody();
            message.IsBodyHtml = true;

            TSObservableCollection <BidFiles> bidFiles =
                bid.BidFilesCollection;

            List <MemoryStream> streamsList = new List <MemoryStream>();

            for (int i = 0; i < bidFiles.Count; i++)
            {
                if (bidFiles[i].IsCurrent == false)
                {
                    continue;
                }

                MemoryStream stream     = new MemoryStream(bidFiles[i].FileBody);
                Attachment   attachment = new Attachment(stream, bidFiles[i].Name);
                message.Attachments.Add(attachment);
                streamsList.Add(stream);
            }

            SmtpClient smtpClient = new SmtpClient(crmSetting.getByMashineName("smtp_server").Setting_value, int.Parse(crmSetting.getByMashineName("smtp_port").Setting_value));

            smtpClient.Credentials = new NetworkCredential(crmSetting.getByMashineName("mail_user").Setting_value, crmSetting.getByMashineName("mail_password").Setting_value);
            int useSSL = int.Parse(crmSetting.getByMashineName("mail_use_ssl").Setting_value);

            if (useSSL == 1)
            {
                smtpClient.EnableSsl = true;
            }
            smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;

            loadingProgress.Visibility = Visibility.Visible;

            Task.Factory.StartNew(() => {
                try {
                    smtpClient.Send(message);
                    Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { closeStreams(streamsList); saveBid(); }));
                }
                catch (Exception ex) {
                    Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { closeStreams(streamsList); errorSave("Не отправить письмо.\n" + ex.ToString()); }));
                }
            });
        }
コード例 #5
0
        public ManagerMainWindow()
        {
            InitializeComponent();
            Title += " v" + Settings.version + ". Пользователь " + Auth.getInstance().Full_name + ". Режим менеджера-оператора.";

            try
            {
                int updateTime = int.Parse(CRMSettingViewModel.instance().getByMashineName("bid_update_time").Setting_value) * 1000;
                if (updateTime != 0)
                {
                    Classes.UpdateTask.Start(Dispatcher,
                                             new Action(() => { BidViewModel.instance().reload(); }),
                                             updateTime,
                                             new Action(() => { updateNotification.Visibility = Visibility.Hidden; }),
                                             new Action(() => { updateNotification.Visibility = Visibility.Visible; }));
                }
            }
            catch {}

            List <BidStatus> bidStatus = BidStatusViewModel.instance().Collection.ToList();

            for (int i = 0; i < bidStatus.Count; i++)
            {
                try
                {
                    TabItem tabItem = new TabItem();
                    tabItem.Header = bidStatus[i].Name;
                    tcMain.Items.Add(tabItem);
                    tabItem.Content = View.Helpers.ManagerMainWindowHelper.GetControl(bidStatus[i].Id);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            TabItem archiveTabItem = new TabItem();

            archiveTabItem.Header = "Архив заявок";
            tcMain.Items.Add(archiveTabItem);
            archiveTabItem.Content = new MainControlArchive();

            TabItem otherTabItem = new TabItem();

            otherTabItem.Header = "Заявки других менеджеров";
            tcMain.Items.Add(otherTabItem);
            otherTabItem.Content = new OtherControl();
        }
コード例 #6
0
        public PlannedShipmentDateSetWindow(Bid bid,
                                            Action <DateTime> okCallback = null,
                                            Action cancelCallback        = null)
        {
            InitializeComponent();
            Title        = "Установка предполагаемой даты отгрузки для заявки №" + bid.Id.ToString();
            defaultBrush = dpPlannedShipmentDate.Background;

            CRMSetting crmSetting = CRMSettingViewModel.instance().getByMashineName("planned_shipment_day_count");
            int        dayCount   = 0;

            if (crmSetting != null)
            {
                try
                {
                    dayCount = int.Parse(crmSetting.Setting_value);
                } catch {}
            }
            if (bid.Planned_shipment_date == null)
            {
                dpPlannedShipmentDate.SelectedDate = DateTime.Now.AddDays(dayCount);
            }
            else
            {
                dpPlannedShipmentDate.SelectedDate = bid.Planned_shipment_date;
            }
            dpPlannedShipmentDate.SelectedDateChanged += delegate { dpPlannedShipmentDate.Background = defaultBrush; };

            tbxComment.Text = bid.Comment;

            this.bid            = bid;
            this.okCallback     = okCallback;
            this.cancelCallback = cancelCallback;


            CollectionViewSource viewSource = new CollectionViewSource();

            viewSource.Source = TransportCompanyViewModel.instance().Collection;
            cbxPlannedTransportCompany.ItemsSource = viewSource.View;
            viewSource.SortDescriptions.Add(new SortDescription("Row_order", ListSortDirection.Descending));
            cbxPlannedTransportCompany.SelectedIndex = -1;
        }
コード例 #7
0
        public TechnicalMainWindow()
        {
            InitializeComponent();
            Title += " v" + Settings.version + ". Пользователь " + Auth.getInstance().Full_name + ". Режим специалиста технического отдела.";

            try
            {
                int updateTime = int.Parse(CRMSettingViewModel.instance().getByMashineName("bid_update_time").Setting_value) * 1000;
                if (updateTime != 0)
                {
                    Classes.UpdateTask.Start(Dispatcher,
                                             new Action(() => { BidViewModel.instance().reload(); }),
                                             updateTime,
                                             new Action(() => { updateNotification.Visibility = Visibility.Hidden; }),
                                             new Action(() => { updateNotification.Visibility = Visibility.Visible; }));
                }
            }
            catch {}

            tiEquipmentBid.Content        = new View.Controls.TechnicalControls.MainControlInWork();
            tiArchiveEquipmentBid.Content = new View.Controls.TechnicalControls.MainControlArchive();
        }
コード例 #8
0
        public AccountantMainWindow()
        {
            InitializeComponent();
            Title += " v" + Settings.version + ". Пользователь " + Auth.getInstance().Full_name + ". Режим бухгалтера.";

            try
            {
                int updateTime = int.Parse(CRMSettingViewModel.instance().getByMashineName("bid_update_time").Setting_value) * 1000;
                if (updateTime != 0)
                {
                    Classes.UpdateTask.Start(Dispatcher,
                                             new Action(() => { BidViewModel.instance().reload(); }),
                                             updateTime,
                                             new Action(() => { updateNotification.Visibility = Visibility.Hidden; }),
                                             new Action(() => { updateNotification.Visibility = Visibility.Visible; }));
                }
            }
            catch {}

            tiNewBid.Content     = new MainControlNewBid();
            tiInWorkBid.Content  = new MainControlInWork();
            tiArchiveBid.Content = new MainControlArchiveBid();
        }
コード例 #9
0
        public AdministratorMainWindow()
        {
            InitializeComponent();
            Title += " v" + Settings.version + ". Пользователь " + Auth.getInstance().Full_name + ". Режим администратора.";

            try
            {
                int updateTime = int.Parse(CRMSettingViewModel.instance().getByMashineName("bid_update_time").Setting_value) * 1000;
                if (updateTime != 0)
                {
                    Classes.UpdateTask.Start(Dispatcher,
                                             new Action(() => { BidViewModel.instance().reload(); }),
                                             updateTime,
                                             new Action(() => { updateNotification.Visibility = Visibility.Hidden; }),
                                             new Action(() => { updateNotification.Visibility = Visibility.Visible; }));
                }
            }
            catch {}

            menuOpenEquipmentWindow.Click += delegate
            {
                EquipmentWindow window = new EquipmentWindow();
                window.ShowDialog();
            };

            menuOpenComplectationItemWindow.Click += delegate
            {
                ComplectationItemWindow window = new ComplectationItemWindow();
                window.ShowDialog();
            };

            menuOpenBuyerWindow.Click += delegate
            {
                BuyerWindow window = new BuyerWindow();
                window.ShowDialog();
            };

            menuOpenSellerWindow.Click += delegate
            {
                SellerWindow window = new SellerWindow();
                window.ShowDialog();
            };

            menuOpenBidStatusWindow.Click += delegate
            {
                BidStatusWindow window = new BidStatusWindow();
                window.ShowDialog();
            };

            menuOpenPaymentStatusWindow.Click += delegate
            {
                PaymentStatusWindow window = new PaymentStatusWindow();
                window.ShowDialog();
            };

            menuOpenManagerWindow.Click += delegate
            {
                ManagerWindow window = new ManagerWindow();
                window.ShowDialog();
            };

            menuOpenTransportCompanyWindow.Click += delegate
            {
                TransportCompanyWindow window = new TransportCompanyWindow();
                window.ShowDialog();
            };

            menuOpenMessageTemplatesWindow.Click += delegate
            {
                MessageTemplatesWindow window = new MessageTemplatesWindow();
                window.ShowDialog();
            };

            tiCRMSetting.Content = new MainControlCRMSetting();
            tiBid.Content        = new MainControlBid();
        }