Ejemplo n.º 1
0
 private void bugSaveBtn_Click(object sender, EventArgs e)
 {
     if (bugListBox.SelectedIndex == 0)
     {
         //insert new bug
         bugs.InsertBug(submitDateTextBox.Text, bugDetailTextBox.Text, bugDescTextBox.Text, repStepsTextBox.Text, fixDateTextBox.Text);
         MessageBox.Show("New Bug Inserted");
         LoadBugListBox();
     }
     else
     {
         //update bug
         bugs.UpdateBug(submitDateTextBox.Text, bugDetailTextBox.Text, bugDescTextBox.Text, repStepsTextBox.Text, fixDateTextBox.Text);
         MessageBox.Show("Bug Updated");
         LoadBugListBox();
     }
 }
        }//end box list

        /// <summary>
        /// this method will save the data into the method or update the data based on the passed in id
        /// </summary>
        /// <param name="sender">sender object</param>
        /// <param name="e"> arguments e</param>
        private void Save_Bug_Click(object sender, EventArgs e)
        {
            Bugs bugs = new Bugs();
            Bug  bug  = (Bug)BugListBox.SelectedValue;

            try
            {
                int bugID = Int32.Parse(BugID.Text.ToString());
                //int userID =
                DateTime bugSubmitDate = Convert.ToDateTime(DateTime.UtcNow.Date);
                string   bugDesc       = BugDesc.Text.ToString();
                string   bugDetails    = bugDetail.Text.ToString();
                string   bugRepSteps   = bugRepStep.Text.ToString();
                // string bugUpdate = BugUpdateComment.Text.ToString();



                if (bug.BugID == 0)
                {
                    bugs.InsertBug(bugAppID, currentlyLoggedInUserId, bugSubmitDate, bugDesc, bugDetails, bugRepSteps);
                    LoadBugList();
                    //inserting and loading bug
                }
                else
                {
                    bugs.UpdateBug(currentlyLoggedInUserId, bugDesc, bugDetails, bugRepSteps, bugFixDate, bugID, currentSatusID);
                    LoadBugList();
                    //updating and loading bug
                }
            }
            catch (SqlException sqlex)
            {
                DisplayErrorMessage(sqlex.Message);
            }

            catch (Exception sqlex)
            {
                DisplayErrorMessage(sqlex.Message);
            }
        }//end save bug_click