Пример #1
0
 public Administration()
 {
     InitializeComponent();
     GridOperations = new DataGridOperations(TableUserMain);
     manager        = new UserManager("UserFile.user");
     LogMenager     = new LogMenager();
 }
Пример #2
0
        public void AddLog()
        {
            LogMenager lm = new LogMenager();
            var        m  = new Permission.Model.UserLog()
            {
                id           = 10,
                account      = "zhanghao123456",
                app          = "frametest",
                browser      = "no",
                ipAddress    = "10.0.1.12",
                module       = "logtest",
                userId       = "asdasdasdadasdad",
                influence    = "",
                oprTime      = DateTime.Now,
                operation    = "add log test",
                isRecovery   = true,
                isRecoveryed = false,
                oprType      = "json",
                userName     = "******",
                result       = "adadddd",
                state        = 1
            };
            var ss = new { name = "zhangsan", age = 23 };
            var cc = new { name = "lisi", age = 33 };

            m.SetOprData("tt", "ff", "aa", ss, cc);
            lm.Writer(m);
        }
Пример #3
0
        private void Further_Click(object sender, RoutedEventArgs e)
        {
            DialogResult dialogResult = System.Windows.Forms.MessageBox.Show("Вы действиетельно хотите создать пользователя", "Создание пользователя", MessageBoxButtons.YesNo);

            if (dialogResult == System.Windows.Forms.DialogResult.Yes)
            {
                LogMenager log  = new LogMenager();
                User       user = new User(GetTextBox());
                manager.CreatedUser(user);
                log.CreateRecord(new string[] { "Создание пользователя: " + nameT.Text + ", " + SurnameT.Text, " Выполнил: " + ActiveUser.user.Name + " " + ActiveUser.user.Surname + " " });
            }
        }
Пример #4
0
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            DialogResult dialogResult = System.Windows.Forms.MessageBox.Show("Вы действиетельно хотите удалить выбраного пользователя", "Удаление пользователя", MessageBoxButtons.YesNo);

            if (dialogResult == System.Windows.Forms.DialogResult.Yes)
            {
                if (userselected == null)
                {
                    System.Windows.Forms.MessageBox.Show("Выберете пользователя");
                }
                LogMenager log = new LogMenager();
                manager.DeleteUser(userselected);
                GridOperations.UpdatingGrid(manager);
                log.CreateRecord(new string[] { "Удаление пользователя: " + nameT.Text + ", " + SurnameT.Text, " Выполнил: " + ActiveUser.user.Name + " " + ActiveUser.user.Surname + " " });
            }
        }
Пример #5
0
        private void SavingResult_Click(object sender, RoutedEventArgs e)
        {
            string path = view.FolderSelection();

            if (path != "")
            {
                if (GraphicsModeC.IsChecked == true)
                {
                    try
                    {
                        int temp = 0;
                        MarketExcelGenerator generator = new MarketExcelGenerator();
                        int countbloks = SearchResultsL.Items.Count / (Settings.CountLine + 1);
                        for (int i = 0; i < countbloks; i++)
                        {
                            string[] mass = new string[Settings.CountLine + 1];
                            for (int j = 0; j < Settings.CountLine + 1; j++)
                            {
                                mass[j] = SearchResultsL.Items[temp].ToString();
                                temp++;
                            }
                            var reportData = new MarketReporter().GetReport(mass, Settings);
                            generator.Bildblok(reportData, Settings, i);
                        }
                        var reportExcel = generator.Generate();
                        File.WriteAllBytes(path + "/" + "Report.xlsx", reportExcel);
                    }
                    catch
                    {
                        MessageBox.Show("Ошибка! Блоки не обнаружены, или они не полны");
                    }
                }
                else
                {
                    StreamWriter fileW = new StreamWriter(path + "/" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.TimeOfDay.Hours + "_" + DateTime.Now.TimeOfDay.Minutes + "_" + "Search_" + ".txt");
                    for (int i = 0; i < SearchResultsL.Items.Count; i++)
                    {
                        fileW.WriteLine(SearchResultsL.Items[i]);
                    }
                    fileW.Close();
                    LogMenager log = new LogMenager();
                    log.CreateRecord(new string[] { "Вывод поиска в папку: " + path + " Выполнил: " + ActiveUser.user.Name + " " + ActiveUser.user.Surname + " ", "" });
                }
            }
        }
Пример #6
0
        private void Run_Click(object sender, RoutedEventArgs e)
        {
            int temp = 0;

            for (int i = 0; i < Path.Length; i++)
            {
                temp += System.IO.File.ReadAllLines(Path[i]).Length;
            }
            ProgressB.Maximum  = temp;
            ProgressB.Value    = 0;
            BarLineAll.Content = ProgressB.Maximum;
            for (int i = 0; i < Path.Length; i++)
            {
                LogMenager log = new LogMenager();
                log.CreateRecord(new string[] { "Создание отчета: " + ProductComboBox.Text + ", " + Path[i], " Выполнил: " + ActiveUser.user.Name + " " + ActiveUser.user.Surname + " " });
                MainStream stream = new MainStream(FormationSettings(i));
                Task       task   = new Task(() => stream.RumWork());
                task.Start();
            }
        }
Пример #7
0
        private void SearchB_Click(object sender, RoutedEventArgs e)
        {
            LogMenager log = new LogMenager();

            log.CreateRecord(new string[] { "Поиск: " + ProductComboBox.Text + ", " + Settings.Path, " Выполнил: " + ActiveUser.user.Name + " " + ActiveUser.user.Surname + " " });
            filtre = null;
            SearchResultsL.Items.Clear();
            string tempreg;

            if (CheckBoxBox.IsChecked == true)
            {
                tempreg = @"\[" + NumberT.Text + @"/(\d+)\] " + BoxT.Text + " ";
                if (BoxT.Text == "0" || BoxT.Text == "")
                {
                    tempreg = @"\[" + NumberT.Text + @"/(\d+)\] ";
                }
                if (NumberT.Text == "0" || NumberT.Text == "")
                {
                    tempreg = @"\] " + BoxT.Text + " ";
                }
                filtre = new Regex(tempreg);
            }
            if (CheckBoxAllline.IsChecked == true)
            {
                tempreg = ":" + DormRoomT.Text + @"$";
                filtre  = new Regex(tempreg);
            }
            if (CheckBoxline.IsChecked == true)
            {
                tempreg = ProductSerialT.Text + @"\s+" + ProductNumberT.Text;
                filtre  = new Regex(tempreg);
            }
            if (filtre == null)
            {
                MessageBox.Show("Укажите параметры поиска");
                return;
            }
            SearchF(filtre, Settings, CheckBoxline.IsChecked.Value);
        }