コード例 #1
0
 void MiDataRefresh_Click(object sender, RoutedEventArgs e)
 {
     Classes.UpdateTask.StartSingle(Dispatcher,
                                    new Action(() => {
         BuyerViewModel.instance().reload();
         ComplectationItemViewModel.instance().reload();
         BidViewModel.instance().reload();
     }),
                                    new Action(() => { updateNotification.Visibility = Visibility.Visible; }),
                                    new Action(() => { updateNotification.Visibility = Visibility.Hidden; }));
 }
コード例 #2
0
        public ComplectationItemWindow()
        {
            InitializeComponent();
            viewSource.Source = ComplectationItemViewModel.instance().Collection;

            viewSource.Filter += delegate(object sender, FilterEventArgs e)
            {
                ComplectationItem complectationItem = e.Item as ComplectationItem;
                if (complectationItem == null)
                {
                    return;
                }
                e.Accepted = complectationItem.IsVisible;
            };
            DataContext = new { ComplectationItemCollection = viewSource.View };
        }
コード例 #3
0
        //Изменение наименования комплектации, устанавливает статус "Не сохранено"
        void DlcComplectationItem_TextChanged(object sender, TextChangedEventArgs e)
        {
            StangradCRM.Controls.DownListControl downListControl
                = sender as StangradCRM.Controls.DownListControl;

            if (downListControl == null)
            {
                return;
            }

            DataGridRow row = FindItem.FindParentItem <DataGridRow>(downListControl);

            if (row == null)
            {
                return;
            }

            Complectation complectation = (Complectation)row.Item;

            if (complectation == null)
            {
                return;
            }

            ComplectationItem citem = ComplectationItemViewModel.instance()
                                      .getByName(downListControl.Text);

            if (citem != null)
            {
                complectation.Id_complectation_item = citem.Id;
            }
            else
            {
                complectation.Id_complectation_item    = 0;
                complectation.NewComplectationItemName = downListControl.Text;
            }
            complectation.IsSaved = false;
        }
コード例 #4
0
        //Выбор существующего наименования из выпадающего списка
        void DlcComplectationItem_OnSelect(object sender, StangradCRM.Controls.SelectionChanged e)
        {
            StangradCRM.Controls.DownListControl downList
                = sender as StangradCRM.Controls.DownListControl;
            if (downList == null)
            {
                return;
            }

            DataGridRow row = FindItem.FindParentItem <DataGridRow>(downList);

            if (row == null)
            {
                return;
            }

            Complectation complectation = (Complectation)row.Item;

            if (complectation == null)
            {
                return;
            }

            if (e.Value != null)
            {
                int id_complectation_item = (int)e.Value;
                if (complectation.Id_complectation_item == id_complectation_item)
                {
                    complectation.IsSaved = true;
                    return;
                }
                ComplectationItem item = ComplectationItemViewModel.instance().getById(id_complectation_item);
                complectation.Id_complectation_item = id_complectation_item;
                complectation.IsSaved = false;
            }
        }
コード例 #5
0
 void TbxSearch_TextChanged(object sender, TextChangedEventArgs e)
 {
     ComplectationItemViewModel.instance().search(tbxSearch.Text);
     viewSource.View.Refresh();
 }
コード例 #6
0
ファイル: Indicators.cs プロジェクト: biletnam/StangradCRM
        //Статистика комплектаций
        private void ComplectationStatistic()
        {
            Dictionary <int, int> complectationDict
                = new Dictionary <int, int>();

            for (int i = 0; i < archiveBid.Count; i++)
            {
                for (int j = 0; j < archiveBid[i].EquipmentBidCollection.Count; j++)
                {
                    for (int k = 0; k < archiveBid[i].EquipmentBidCollection[j].ComplectationCollection.Count; k++)
                    {
                        Complectation complectation = archiveBid[i].EquipmentBidCollection[j].ComplectationCollection[k];
                        if (!complectationDict.ContainsKey(complectation.Id_complectation_item))
                        {
                            complectationDict.Add(complectation.Id_complectation_item, 1);
                        }
                        else
                        {
                            complectationDict[complectation.Id_complectation_item]++;
                        }
                    }
                }
            }
            if (complectationDict.Count == 0)
            {
                return;
            }

            ReportRow rowH = new ReportRow();

            rowH.Add(new ReportCell("Статистика комплектаций:"));
            Rows.Add(rowH);

            ReportRow rowT = new ReportRow();

            rowT.Add(new ReportCell("Наименование")
            {
                BorderColor = System.Drawing.Color.Black, ColumnSpan = 1
            });
            rowT.Add(null);
            rowT.Add(new ReportCell("Кол-во комплектаций")
            {
                ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
            });
            Rows.Add(rowT);

            foreach (KeyValuePair <int, int> kv in complectationDict.OrderByDescending(x => x.Value))
            {
                ComplectationItem citem = ComplectationItemViewModel.instance().getById(kv.Key);
                if (citem == null)
                {
                    continue;
                }

                ReportRow row = new ReportRow();
                row.Add(new ReportCell(citem.Name)
                {
                    ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
                });
                row.Add(null);
                row.Add(new ReportCell(kv.Value.ToString())
                {
                    ColumnSpan = 1, BorderColor = System.Drawing.Color.Black
                });
                Rows.Add(row);
            }
        }