コード例 #1
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            CIncident incident = new CIncident();

            incident = GetIncFromListView(listViewIncidents, new CConfig().WorkDirName);
            if (incident.Initiator != textBoxInitiator.Text ||
                incident.Problem != textBoxProblem.Text ||
                incident.Solution != textBoxSolution.Text ||
                incident.ExtraSolution != textBoxExtraSolution.Text)
            {
                try
                {
                    CIncident newIcincident = new CIncident(new CConfig().WorkDirName, incident.DateExec,
                                                            textBoxInitiator.Text, textBoxProblem.Text, textBoxSolution.Text);
                    newIcincident.ExtraSolution = textBoxExtraSolution.Text;
                    newIcincident.ChangeIncident(incident);

                    UpdateForm(listViewIncidents.SelectedItems[0].Index, SortInlistViewIncidents, listViewIncidents);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
コード例 #2
0
        private void UpdateFormArc(int popositionInlistView, int SortColumnId)
        {
            try
            {
                CIncidents Incidents = new CIncidents();
                Incidents.GetListFromDir(new CConfig().ArchivesDirName);
                Incidents.SortIncidents(SortColumnId);
                var Re = Incidents.Incidents.Where(
                    p => DateTime.ParseExact(p.DateExec, "yyyyMMdd",
                                             System.Globalization.CultureInfo.GetCultureInfo("ru-RU")) >= DateTime.ParseExact(dateTimePickerBeginArc.Text, "yyyyMMdd",
                                                                                                                              System.Globalization.CultureInfo.GetCultureInfo("ru-RU"))).Where(
                    p => DateTime.ParseExact(p.DateExec, "yyyyMMdd",
                                             System.Globalization.CultureInfo.GetCultureInfo("ru-RU")) <= DateTime.ParseExact(dateTimePickerEndArc.Text, "yyyyMMdd",
                                                                                                                              System.Globalization.CultureInfo.GetCultureInfo("ru-RU")));

                CIncidents Inc2 = new CIncidents();


                foreach (CIncident R1 in Re)
                {
                    CIncident ii = new CIncident();
                    ii = R1;
                    Inc2.Incidents.Add(ii);
                }

                UdeteeveryForm(popositionInlistView, SortColumnId, listViewIncidentsArc, Inc2);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #3
0
        private void buttonSendTo_Click(object sender, EventArgs e)
        {
            CIncident newIcincident = new CIncident(new CConfig().WorkDirName, DateTime.Now.ToString("yyyyMMdd"),
                                                    textBoxInitiator.Text, textBoxProblem.Text, textBoxSolution.Text);

            newIcincident.ExtraSolution = textBoxExtraSolution.Text;


            newIcincident.SentIncindentFromMail();
        }
コード例 #4
0
 private void buttonClear_Click(object sender, EventArgs e)
 {
     {
         CIncident newIcincident = new CIncident(new CConfig().WorkDirName, DateTime.Now.ToString("yyyyMMdd"),
                                                 GetUserName(), "", "");
         newIcincident.Executor = GetUserName();
         newIcincident.newIncident();
         UpdateForm(listViewIncidents.Items.Count, SortInlistViewIncidents, listViewIncidents);
     }
 }
コード例 #5
0
        private void OpenDir(ListView lV, string DirName)
        {
            CIncident incident = new CIncident();

            incident = GetIncFromListView(lV, DirName);
            if (System.IO.Directory.Exists(incident.GetIncID()))
            {
                Process.Start(incident.GetIncID());
            }
            else
            {
                MessageBox.Show("Err in name of directory");
            }
        }
コード例 #6
0
        private void buttonMoveToArch_Click(object sender, EventArgs e)
        {
            try
            {
                CIncident incident = new CIncident();
                incident = GetIncFromListView(listViewIncidents, new CConfig().WorkDirName);
                incident.MoveIncidentToArch();
                UpdateForm(listViewIncidents.SelectedItems[0].Index, SortInlistViewIncidents, listViewIncidents);
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #7
0
        private void OpenResurs(ListView lV, String dirName)
        {
            CIncident incident = new CIncident();

            incident = GetIncFromListView(lV, dirName);
            string a = incident.GetIncID();

            if (listBoxResources.SelectedItem != null)
            {
                if (System.IO.File.Exists(a + CIncident.resource + listBoxResources.SelectedItem.ToString()))
                {
                    Process.Start(a + CIncident.resource + listBoxResources.SelectedItem.ToString());
                }
            }
        }
コード例 #8
0
        private void Form1_Load(object sender, EventArgs e)
        {
            actHook          = new UserActivityHook(); // crate an instance with global hooks
            actHook.KeyUp   += new KeyEventHandler(MyKeyUp);
            actHook.KeyDown += new KeyEventHandler(MyKeyDown);
            String Username = GetUserName();

            this.Text = "v. 27.06.2018-1 " + Username + " screenshot Shift + " + new CConfig().HotkeyPrSc;
            CIncident incident = new CIncident();

            dateTimePickerBeginArc.Text = Convert.ToString(DateTime.Now.AddDays(-1));
            dateTimePickerEndArc.Text   = Convert.ToString(DateTime.Now);


            UpdateForm(0, SortInlistViewIncidents, listViewIncidents);
        }
コード例 #9
0
        public void ChangeIncident(CIncident Incident)
        {
            try
            {
                SetDateString();

                string CurDir    = new CConfig().WorkDirName + @"\" + DateExec + @"\" + Incident.Initiator + delimiter + Incident.Problem;
                string NewCurDir = new CConfig().WorkDirName + @"\" + DateExec + @"\" + Initiator + delimiter + Problem;
                if (CurDir != NewCurDir)
                {
                    System.IO.Directory.Move(CurDir, NewCurDir);
                }
                SetSolution(new CConfig().WorkDirName + @"\");
            }
            catch
            {
                throw new System.Exception("could not make changes, maybe the directory is locked or not found");
            }
        }
コード例 #10
0
        public void MyKeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyData.ToString() == new CConfig().HotkeyPrSc&&  KressedKey == "LShiftKey")
            {
                CIncident incident = new CIncident();
                incident = GetIncFromListView(listViewIncidents, new CConfig().WorkDirName);


                if (this.WindowState == FormWindowState.Minimized)
                {
                    notifyIcon1.Visible = false;
                }
                else
                {
                    this.Visible       = false;
                    this.ShowInTaskbar = false;
                }

                GetScreenShot(incident.GetResourcesPath());

                if (this.WindowState == FormWindowState.Minimized)
                {
                    notifyIcon1.Visible = true;
                }
                else
                {
                    this.Visible       = true;
                    this.ShowInTaskbar = true;
                }

                UpdateForm(listViewIncidents.SelectedItems[0].Index, SortInlistViewIncidents, listViewIncidents);
            }

            if (e.KeyData.ToString() == "LShiftKey")
            {
                KressedKey = "";
            }
        }
コード例 #11
0
ファイル: CIncidents.cs プロジェクト: ktvGIT/LAdmin
        public void GetListFromDir(string dirName)
        {
            String curDir = "";


            string        incidentDate = string.Empty;
            DirectoryInfo dirDate      = new DirectoryInfo(dirName);

            foreach (var itemDate in dirDate.GetDirectories())
            {
                curDir       = dirName + @"\" + itemDate.Name;
                incidentDate = itemDate.Name;
                DirectoryInfo dirExecutorAndProblem = new DirectoryInfo(curDir);

                foreach (var itemExecutorAndProblem in dirExecutorAndProblem.GetDirectories())
                {
                    //////////Date........................
                    curDir = dirName + @"\" + itemDate.Name + @"\" + itemExecutorAndProblem;
                    CIncident incident = new CIncident();
                    incident.DateExec     = incidentDate;
                    incident.DateWithTime = (DateTime.Now - File.GetCreationTime(curDir)).ToString("ddhhmmss");
                    //////////FIO and problem......................
                    incident.GetFioAndProblem(itemExecutorAndProblem.Name);

                    //////// solution..............................
                    incident.GetSolution(curDir);

                    incident.SetIncID(dirName);
                    incident.GetExecutorFromDir();

                    // }


                    Incidents.Add(incident);
                }
            }
        }
コード例 #12
0
        private void buttonNewIncident_Click(object sender, EventArgs e)
        {
            CIncident incident = new CIncident();

            incident = GetIncFromListView(listViewIncidents, new CConfig().WorkDirName);
            if (incident.Initiator != textBoxInitiator.Text ||
                incident.Problem != textBoxProblem.Text ||
                incident.Solution != textBoxSolution.Text ||
                incident.ExtraSolution != textBoxExtraSolution.Text)
            {
                CIncident newIcincident = new CIncident(new CConfig().WorkDirName, DateTime.Now.ToString("yyyyMMdd"),
                                                        textBoxInitiator.Text, textBoxProblem.Text, textBoxSolution.Text);
                newIcincident.ExtraSolution = textBoxExtraSolution.Text;
                newIcincident.Executor      = GetUserName();
                newIcincident.newIncident();


                UpdateForm(listViewIncidents.SelectedItems[0].Index, SortInlistViewIncidents, listViewIncidents);
            }
            else
            {
                MessageBox.Show("you have not made any changes");
            }
        }
コード例 #13
0
        private void SetInterfaceElements(ListView lv, string dirName)
        {
            if (lv.SelectedItems.Count != 0)
            {
                CIncident incident = new CIncident();
                incident = GetIncFromListView(lv, dirName);
                incident.GetResurses();
                listBoxResources.Items.Clear();
                if (incident.Resources != null)
                {
                    foreach (string res in incident.GetResourcesFileName())
                    {
                        listBoxResources.Items.Add(res);
                    }
                }


                textBoxInitiator.Text     = incident.Initiator;
                textBoxProblem.Text       = incident.Problem;
                textBoxSolution.Text      = incident.Solution;
                textBoxExtraSolution.Text = incident.ExtraSolution;
                textBoxHost.Text          = "";

                textBoxInitiator.ForeColor = System.Drawing.Color.Black;
                textBoxSolution.ForeColor  = System.Drawing.Color.Black;
                textBoxProblem.ForeColor   = System.Drawing.Color.Black;
            }
            else
            {
                textBoxInitiator.Text     = "";
                textBoxProblem.Text       = "";
                textBoxSolution.Text      = "";
                textBoxExtraSolution.Text = "";
                textBoxHost.Text          = "";
            }
        }