Esempio n. 1
0
        public LoggerShow(object _lm, string _userName, string _pName, string _asin, string _sku, string _mpName, string _eUserName, int _appUserId)
        {
            InitializeComponent();

            logModel      = (LoggerModel)_lm;
            logController = new LoggerController(this);

            imageList = new List <ImageModel> {
            };

            lb_Asin.Text        = ASIN = _asin;
            lb_cUser.Text       = userName = _userName;
            lb_editDate.Text    = logModel.EditDate.ToString().Substring(0, 10);
            lb_editUser.Text    = editUserName = _eUserName;
            lb_marketPlace.Text = marketplaceName = _mpName;
            lb_ProductName.Text = productName = _pName;
            lb_Sku.Text         = SKU = _sku;
            _lbcDate.Text       = logModel.CreationDate.ToString().Substring(0, 10);
            richTextBox1.Text   = logModel.Text;
            appUserId           = _appUserId;

            this.Text = "Просмотр записи";
            editMode  = false;

            LoadImages();
            DrawPictures();
        }
Esempio n. 2
0
        /* Фоновый процесс, работающий через главную форму */
        public LoggerNotification(MainFormView _lv, object _lm, string _userName, string _pName, string _text)
        {
            InitializeComponent();

            mainFormViewForm = _lv;
            logModel         = (LoggerModel)_lm;
            userName         = _userName;
            productName      = _pName;
            text             = _text;

            FromMainForm = true;

            label1.Text = userName + " к товару \"" + productName + "\":";
            label3.Text = text;

            this.TopMost = true;

            this.Height   = label3.Location.Y + label3.Height + 10;
            this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width, Screen.PrimaryScreen.WorkingArea.Height - this.Height);

            try
            {
                SoundPlayer audio = new SoundPlayer(Resources.notification2);
                audio.Stream.Position = 0;
                audio.Play();
            }
            catch (Exception ex) { }



            timer1.Start();
        }
Esempio n. 3
0
        /* Фоновый процесс при свернутом окне логгера */
        public LoggerNotification(LoggerView _lv, object _lm, string _userName, string _pName, string _asin, string _sku, string _mpName, string _eUserName, string _text, int _AppUserId)
        {
            InitializeComponent();

            loggerViewForm  = _lv;
            logModel        = (LoggerModel)_lm;
            userName        = _userName;
            productName     = _pName;
            ASIN            = _asin;
            SKU             = _sku;
            marketPlaceName = _mpName;
            editUserName    = _eUserName;
            text            = _text;
            appUserId       = _AppUserId;

            FromMainForm = false;

            label1.Text = userName + " к товару \"" + productName + "\":";
            label3.Text = text;

            this.TopMost = true;

            this.Height   = label3.Location.Y + label3.Height + 10;
            this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width, Screen.PrimaryScreen.WorkingArea.Height - this.Height);

            try
            {
                SoundPlayer audio = new SoundPlayer(Resources.notification2);
                audio.Stream.Position = 0;
                audio.Play();
            } catch (Exception ex) { }

            timer1.Start();
        }
Esempio n. 4
0
        /* Заносим данные в List<ProductsModel> */
        private void SetDataToList(IDataRecord record)
        {
            LoggerModel lModel = new LoggerModel();

            logList.Add(lModel);
            for (int i = 0; i < record.FieldCount; i++)
            {
                logList[logList.Count - 1].WriteData(i, record[i]);
            }
        }
Esempio n. 5
0
        private void Timer1_Tick(object sender, EventArgs e)
        {
            logController.GetAllRecords();
            if (LogsCount != logList.Count)
            {
                string      prodName = "ПРодуктище"; // GetProductNameById(logList[logList.Count - 1].ProductId);
                string      userName = "******";    // GetUserNameByUserId(logList[logList.Count - 1].CreationUserId);
                string      text     = logList[logList.Count - 1].Text;
                LoggerModel lm       = new LoggerModel();
                lm = logList[logList.Count - 1];

                LoggerNotification logNotific = new LoggerNotification(this, lm, userName, prodName, text);

                logNotific.Show();


                LogsCount = logList.Count;
            }
        }
Esempio n. 6
0
        /* Открываем запись на редактирование */
        private void Dgv_Log_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            LoggerModel lm = new LoggerModel();

            if (dgv_Log.RowCount > 0 && e.RowIndex >= 0 && e.ColumnIndex >= 0)
            {
                for (int i = 0; i < logList.Count; i++)
                {
                    if (logList[i].RecordId == int.Parse(dgv_Log.Rows[e.RowIndex].Cells[0].Value.ToString()))
                    {
                        lm = logList[i];
                    }
                }

                string eUserName = "";
                int    euserId   = -1;

                for (int i = 0; i < logList.Count; i++)
                {
                    if (logList[i].RecordId == int.Parse(dgv_Log.Rows[e.RowIndex].Cells[0].Value.ToString()))
                    {
                        euserId = logList[i].EditUserId;
                    }
                }
                if (euserId != -1)
                {
                    for (int i = 0; i < uList.Count; i++)
                    {
                        if (uList[i].UserId == euserId)
                        {
                            eUserName = uList[i].Name;
                        }
                    }
                }

                LoggerShow ls = new LoggerShow(this, lm, dgv_Log.Rows[e.RowIndex].Cells[2].Value.ToString(), dgv_Log.Rows[e.RowIndex].Cells[4].Value.ToString(), dgv_Log.Rows[e.RowIndex].Cells[5].Value.ToString(), dgv_Log.Rows[e.RowIndex].Cells[6].Value.ToString(), dgv_Log.Rows[e.RowIndex].Cells[8].Value.ToString(), eUserName);

                timer1.Stop();
                ls.Show();
                this.Visible = false;
            }
        }
Esempio n. 7
0
        /* Обновляем таблицу каждую 1 секунду */
        private void Timer1_Tick(object sender, EventArgs e)
        {
            if (startDate < endDate)        //да "С" должна быть раньше даты "ПО"
            {
                try
                {
                    logController.GetRecordsByFilters(ChooseFilter());

                    if (logList.Count != previousCountOfLogs && logList.Count != 0) //если после запроса к БД количество строк изменилось, то перерисовываем таблицу
                    {
                        dgv_Log.Visible     = true;
                        label6.Visible      = false;
                        previousCountOfLogs = logList.Count;
                        Draw_dgv_Logs();

                        if (WindowState == FormWindowState.Minimized)
                        {
                            string      prodName = GetProductNameById(logList[logList.Count - 1].ProductId);
                            string      userName = GetUserNameByUserId(logList[logList.Count - 1].CreationUserId);
                            string      text     = logList[logList.Count - 1].Text;
                            LoggerModel lm       = new LoggerModel();
                            lm = logList[logList.Count - 1];

                            LoggerNotification logNotific = new LoggerNotification(this, lm, userName, prodName, logList[logList.Count - 1].SKU, GetProductSkuById(logList[logList.Count - 1].ProductId), GetProductMarketPlaceNameBySKU(logList[logList.Count - 1].SKU), GetUserNameByUserId(logList[logList.Count - 1].EditUserId), text, userModel.UserId);

                            logNotific.Show();
                        }
                    }
                    else if (logList.Count == 0)        //если по фильтрам поиска ничего не нашли
                    {
                        label6.Visible      = true;
                        dgv_Log.Visible     = false;
                        previousCountOfLogs = logList.Count;
                    }
                }
                catch (Exception ex) { MessageBox.Show("При установке соединения с БД произошел сбой. Logger будет закрыт", "Ошибка"); this.Close(); }
            }
        }