예제 #1
0
        private void saveSessionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Boolean validSessions = false;

            foreach (Form form in Application.OpenForms)
            {
                if (form.Tag != null)
                {
                    validSessions = true;
                    break;
                }
            }

            if (validSessions)
            {
                using (var formInputData = new frmInputDialog())
                {
                    formInputData.inputDataAsk = "Type something to help you remember this session";
                    var result = formInputData.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        DialogResult dlgResultCloseForms = MessageBox.Show("Do you want to close Session cards after saving ?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                        seekerSessions sessionDump = new seekerSessions();
                        sessionDump.Description = formInputData.returnInputData;

                        foreach (Form form in Application.OpenForms)
                        {
                            if (form.Tag != null)
                            {
                                sessionDump.Objects.Add(form.Tag as seekerObjects);
                            }
                        }

                        if (dlgResultCloseForms == DialogResult.Yes)
                        {
                            Form[] forms = Application.OpenForms.Cast <Form>().ToArray();
                            foreach (Form thisForm in forms)
                            {
                                thisForm.Close();
                            }
                        }
                        dLibObjSerializer.dLibObjSerializer.XmlSerializeObjectToDisk <seekerSessions>(sessionDump, Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Seeker\Sessions\" + frmMain.domainAccountData[1] + @"\" + sessionDump.SessionID + ".xml");
                    }
                }
                validSessions = false;
            }
            else
            {
                MessageBox.Show("Sorry, but you don't have any Session data to save!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #2
0
        private void btnGetLapsPass_Click(object sender, EventArgs e)
        {
            string ticketNumber = "";

            DialogResult dlgGetPass = MessageBox.Show("Clicking on Yes you'll receive Admin account password for machine " + this.machineToQuery + ". This access will be logged. Do you want to procced ?", "Do you want to procced ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dlgGetPass == DialogResult.Yes)
            {
                computerToUpdate.LapPASExpirationDate = DateTime.Now.ToString();

                using (var form = new frmInputDialog())
                {
                    form.inputDataAsk = "Please fill with your authorization number(for audit purposes)";
                    var result = form.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        ticketNumber = form.returnInputData;
                    }
                }
                computerToUpdate.SerialNumber = Environment.UserName + "," + ticketNumber + "," + DateTime.Now;


                try
                {
                    computerToUpdate.updateComputer();
                    btnGetLapsPass.Enabled   = false;
                    lblLapsPasswordData.Text = computerToUpdate.LapPAS;
                    lblLapsPassNotice.Text   = "Expires in 90minutes...";

                    lblLapsExpDate.Text       = computerToUpdate.LapPASExpirationDate;
                    lblLapsExpDateNotice.Text = "Flagged for change!";
                }
                catch (Exception permissionError)
                {
                    if (permissionError.ToString().ToLower().Contains("denied"))
                    {
                        MessageBox.Show("Sorry, but you are not allowed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }