Exemplo n.º 1
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\admin\Documents\BugHandler.mdf;Integrated Security=True;Connect Timeout=30");

            con.Open();
            SqlCommand sqlCmd = new SqlCommand("Select * from Issue where Title ='" + comboBox1.Text + "'", con);

            sqlCmd.ExecuteNonQuery();
            SqlDataReader sdr;

            sdr = sqlCmd.ExecuteReader();
            while (sdr.Read())
            {
                string description = (string)sdr["Description"].ToString();
                textEditorControl1.Text = description;

                string solution = (string)sdr["Solution"].ToString();
                textEditorControl2.Text = solution;

                BugHandlerEntities1 bte = new BugHandlerEntities1();
                var          item       = bte.Issues.Where(a => a.Title == comboBox1.Text).SingleOrDefault();
                byte[]       arr        = item.Image;
                MemoryStream ms         = new MemoryStream(arr);
                pictureBox1.Image = Image.FromStream(ms);
            }
            con.Close();
        }
Exemplo n.º 2
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (textBox1.Text.Trim() == "" || textEditorControl1.Text.Trim() == "")
     {
         MessageBox.Show("One or More Fields Are Empty");
     }
     try
     {
         MemoryStream ms = new MemoryStream();
         img.Save(ms, img.RawFormat);
         BugHandlerEntities1 bte = new BugHandlerEntities1();
         var InsIssue            = new Issue
         {
             Title       = textBox1.Text.Trim(),
             Description = textEditorControl1.Text.Trim(),
             Image       = ms.ToArray(),
             Status      = "PENDING",
             InsertedBy  = session.Username
         };
         bte.Issues.Add(InsIssue);
         bte.SaveChanges();
         MessageBox.Show("Issue Saved");
     }
     catch (Exception)
     {
         MessageBox.Show("Error Occured", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 3
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         BugHandlerEntities1 bte = new BugHandlerEntities1();
         var data = bte.Issues.Where(a => a.Title == comboBox1.Text).SingleOrDefault();
         data.Description = textEditorControl1.Text;
         data.SolvedBy    = comboBox2.Text;
         if (data.Status == "ReOpened")
         {
             MessageBox.Show("Issue is already Re-Opened", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             if (checkBox1.Checked)
             {
                 data.Status = "ReOpened";
             }
             bte.Entry(data).State = EntityState.Modified;
             bte.SaveChanges();
             MessageBox.Show("Saved");
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Error Occured", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            //SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\admin\Documents\BugHandler.mdf;Integrated Security=True;Connect Timeout=30");
            BugHandlerEntities1 bhe = new BugHandlerEntities1();
            var regUser             = new Login
            {
                Username = textBox1.Text.Trim(),
                Password = textBox2.Text.Trim(),
                Role     = "Client"
            };

            bhe.Logins.Add(regUser);
            bhe.SaveChanges();
            MessageBox.Show("User Saved");
        }
Exemplo n.º 5
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         BugHandlerEntities1 bte = new BugHandlerEntities1();
         var data = bte.Issues.Where(a => a.Title == comboBox1.Text).SingleOrDefault();
         data.Solution         = textEditorControl2.Text;
         data.Status           = "On Progress";
         bte.Entry(data).State = EntityState.Modified;
         bte.SaveChanges();
         MessageBox.Show("Saved");
     }
     catch (Exception)
     {
         MessageBox.Show("Error Occured", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 6
0
        //connecting to the database and loading the windows
        private void button1_Click(object sender, EventArgs e)
        {
            
            SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\admin\Documents\BugHandler.mdf;Integrated Security=True;Connect Timeout=30");
            SqlDataAdapter sda = new SqlDataAdapter("Select Role from Login where Username = '******' and Password = '******' ",con);
            DataTable dt = new System.Data.DataTable();
            sda.Fill(dt);
            if(dt.Rows.Count == 1)
            {
                BugHandlerEntities1 bte = new BugHandlerEntities1();
                var role = bte.Logins.Where(a => a.Username == textBox1.Text).SingleOrDefault();
                SessionModule session = new SessionModule();
                session.Username = role.Username;

                if (role.Role=="Admin")
                {
                    BugHandlerAdmin bhs = new BugHandlerAdmin(session);
                    this.Hide();
                    bhs.Show();
                }
                else if (role.Role == "Client")
                {
                    BugHandlerSoftware abc = new BugHandlerSoftware(session);
                    this.Hide();
                    abc.Show();
                }
                else
                {
                    BugHandlerProgrammer bhp = new BugHandlerProgrammer(session);
                    this.Hide();
                    bhp.Show();
                }
                
            }
            //to display error in wrong password
            else
            {
                MessageBox.Show("Incorrect Username or Password!");
            }
        }
Exemplo n.º 7
0
 private void button1_Click(object sender, EventArgs e)
 {
     //to remove all the unnecessary space
     if (textBox1.Text.Trim() == "" || textBox2.Text.Trim() == "")
     {
         MessageBox.Show("One or More Fields Are Empty");
     }
     try
     {
         //using local variable for selecting the role of admin or programmer
         string userrole = "";
         if (checkBox1.Checked)
         {
             userrole = "Admin";
         }
         else
         {
             userrole = "Programmer";
         }
         //to insert data in the database table Login
         BugHandlerEntities1 bhe = new BugHandlerEntities1();
         var InsUser             = new Login
         {
             Username = textBox1.Text.Trim(),
             Password = textBox2.Text.Trim(),
             Role     = userrole
         };
         //to show that the data are stored
         bhe.Logins.Add(InsUser);
         bhe.SaveChanges();
         MessageBox.Show("User Saved");
     }
     catch (Exception)
     {
         MessageBox.Show("Error Occured", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }