示例#1
0
        public override bool StartLoad()
        {
            aObject   = new progressSetAdd();
            compares  = new List <Compare>();
            _progress = new Progress_Form(aObject);
            _progress.ShowDialog();
            MessageBox.Show("Загрузка окончена!");
            if (message != string.Empty)
            {
                MessageBox.Show($"Не найденные записи в базе: {message.Trim(' ', ',')}");
            }
            if (compares.Count > 0)
            {
                CustomMessage_Window customMessage = new CustomMessage_Window(new CustomMessage_Window.SettingWindow("Показатели не совпавшие по значениям", WindowStartupLocation.CenterScreen, CanResize: true));
                DataGrid             DG            = new DataGrid();

                List <MyTools.C_DGColumn_Bind> list = new List <MyTools.C_DGColumn_Bind>();
                list.Add(new MyTools.C_DGColumn_Bind(ColCompare.replace, MyTools.E_TypeColumnDG.CheckBox, "Select", new MyTools.C_Setting_DGColumn(System.Windows.Data.BindingMode.TwoWay)));
                list.Add(new MyTools.C_DGColumn_Bind(ColCompare.select, MyTools.E_TypeColumnDG.Text, "Number", setting));
                list.Add(new MyTools.C_DGColumn_Bind(ColCompare.wes, MyTools.E_TypeColumnDG.Text, "Wes", setting));
                list.Add(new MyTools.C_DGColumn_Bind(ColCompare.become, MyTools.E_TypeColumnDG.Text, "Become", setting));
                foreach (var one in list)
                {
                    DG.Columns.Add(one.Column);
                }
                DG.AutoGenerateColumns = false;
                DG.ItemsSource         = compares;
                customMessage.ShowControl.SetFromGrid(DG);

                Button bPrint = new Button();
                bPrint.Content = "Распечатать";
                bPrint.Click  += (sender, e) =>
                { MyTools.PrintList(compares, $"{Directory.GetCurrentDirectory()}\\Отчёты\\Синхронизация", $"Отчёт{DateTime.Now.ToShortDateString()}"); };
                customMessage.wpButtons.Children.Add(bPrint);

                Button bForceDownload = new Button();
                bForceDownload.Content = "Загрузить принудительно";
                bForceDownload.Click  += (sender, e) =>
                {
                    ForceDownload = true;
                    StartLoad();
                    if (compares.Count > 0)
                    {
                        DG.ItemsSource = null;
                        DG.ItemsSource = compares;
                    }
                    else
                    {
                        bForceDownload.IsEnabled = false;
                    }
                };
                customMessage.wpButtons.Children.Add(bForceDownload);

                customMessage.ShowDialog();
            }
            CanReStart();
            return(true);
        }
示例#2
0
        /// <summary>Проверка на закрытие</summary>
        public static bool ControlMonth()
        {
            if (DateTime.Now.Day >= 22)
            {
                List <fromMessage> mess = new List <fromMessage>();

                {
                    var dictionary = new Dictionary <uint, fromMessage>();

                    var selectionWells = Helpers.LogicHelper.SelectionWellLogic.Find((int)MyTools.GetNowDate(MyTools.EInputDate.YM), 0);

                    foreach (var selectionWell in selectionWells)
                    {
                        var objecte = selectionWell.Objecte;

                        if (!dictionary.ContainsKey(objecte.ID))
                        {
                            mess.Add(new fromMessage(selectionWell));
                        }
                    }
                }
                //PollutionBase_Class.LoadSample(false, IDObjMass.ToArray());
                //PollutionBase_Class.GetValueMass(false, IDObjMass.ToArray());
                if (mess.Count > 0)
                {
                    CustomMessage_Window CS_W = new CustomMessage_Window(new CustomMessage_Window.SettingWindow(Title: "Сообщение", CanResize: true));
                    var query = G.Volume.QUERRY().SHOW
                                .WHERE
                                .ID(0);
                    foreach (var one in mess)
                    {
                        query.OR.C(C.Volume.Sample, one.Sample.ID);
                    }
                    query.DO();
                    var count = G.Volume.Rows.Count;
                    for (int i = 0; i < count; i++)
                    {
                        uint SampleID = G.Volume.Rows.Get_UnShow <uint>(i, C.Volume.Sample);
                        mess.First(x => x.Sample.ID == SampleID).SetVolume(G.Volume.Rows.GetID(i));
                    }
                    CS_W.MessageText.Text = "Списки отборов не имеющих статуса";
                    if (mess.Where(x => x.Volume == 0).Count() > 0)
                    {
                        TextBlock text = new TextBlock();
                        text.Text       = "Объём нулевой";
                        text.Background = Brushes.LightBlue;
                        CS_W.ShowControl.SetRowFromGrid(MyTools.GL_Auto);
                        CS_W.ShowControl.SetFromGrid(text, Column: 0);
                        foreach (var one in mess.Where(x => x.Volume == 0))
                        {
                            CheckBox  CB = new CheckBox();
                            TextBlock tb = new TextBlock();
                            tb.Background = Brushes.LightBlue;
                            tb.Text       = one.Objecte.Client.Detail.FullName + " - " + one.Objecte.Adres + " папка №" + one.Objecte.NumberFolder + " от " + MyTools.YearMonth_From_YM(one.Sample.YM);
                            CB.Click     += (sender, e) =>
                            { one.Status = (bool)CB.IsChecked ? data.EStatus.NotVolume : data.EStatus.None; };
                            CB.Content = tb;
                            CS_W.ShowControl.SetRowFromGrid(MyTools.GL_Auto);
                            CS_W.ShowControl.SetFromGrid(CB);
                        }
                    }
                    if (mess.Where(x => x.Volume > 0).Count() > 0)
                    {
                        TextBlock text = new TextBlock();
                        text.Text       = "Сумма меньше лимита";
                        text.Background = Brushes.LightCoral;
                        CS_W.ShowControl.SetRowFromGrid(MyTools.GL_Auto);
                        CS_W.ShowControl.SetFromGrid(text, Column: 0);
                        foreach (var one in mess.Where(x => x.Volume > 0))
                        {
                            if (one.Calc())
                            {
                                continue;
                            }
                            CheckBox  CB = new CheckBox();
                            TextBlock tb = new TextBlock();
                            tb.Background = Brushes.LightCoral;
                            tb.Text       = $"{one.Objecte.Client.Detail.FullName} - {one.Objecte.Adres} папка №{one.Objecte.NumberFolder} {one.Summs}";
                            CB.Content    = tb;
                            CB.Click     += (sender, e) =>
                            { one.Status = (bool)CB.IsChecked ? data.EStatus.NotLimit : data.EStatus.None; };
                            CS_W.ShowControl.SetRowFromGrid(MyTools.GL_Auto);
                            CS_W.ShowControl.SetFromGrid(CB, Column: 0);
                        }
                    }
                    CS_W.ShowDialog();
                }
                return(ThisMonth);
            }
            return(true);
        }