Пример #1
0
        public void PopulateDashboardItems()
        {
            bug.setBugID(bugid);
            bug.setUsername(sessionusername);
            BugController bc = new BugController();

            bc.populatetesterdashboard(bug);
            historytable = bc.getHistory(bug);

            if (historytable != null && historytable.Rows.Count > 0)
            {
                this.lbllastupdatedby.Text = historytable.Rows[0][4].ToString();
                this.lbllastupdateon.Text  = historytable.Rows[0][3].ToString();
                this.richremarks.Text      = historytable.Rows[0][7].ToString();
            }
            else
            {
                this.lbllastupdatedby.Text = "Unkown";
                this.lbllastupdateon.Text  = "Unknown";
                this.richremarks.Text      = "";
            }
            this.richsourcecode.Text = bug.getCode();
            this.richbugdesc.Text    = bug.getbugdesc();
            this.imgscreenshot.Image = bug.GetImage();
            this.txtclassname.Text   = bug.getClass();
            this.txtcomponent.Text   = bug.getComponentName();
            this.txtproject.Text     = bug.getProjectName();
            this.txtmethodname.Text  = bug.getMethod();
            this.txtlinefrom.Text    = bug.getlinenofrom().ToString();
            this.txtlineto.Text      = bug.getlinenoto().ToString();
            this.lblbugstatus.Text   = bug.getStatus();
            this.lblversion.Text     = bug.getVersion();
            imgnew = bug.GetImage();


            //setting bug image
            if (bug.getSeverity() == "Critical")
            {
                this.imgbugseverity.Image = Properties.Resources.bugred;
            }
            else if (bug.getSeverity() == "Low")
            {
                this.imgbugseverity.Image = Properties.Resources.buggreen;
            }
            else
            {
                this.imgbugseverity.Image = Properties.Resources.buggreen;
            }
        }
        /// <summary>
        /// Update Bug Information
        /// </summary>
        /// <param name="bug"></param>
        /// <returns></returns>

        public bool UpdateBug(BugModel bug)
        {
            bool flag = false;

            try
            {
                String          sql  = "update tbl_bug set code=@code, status=@status, version=@version where bug_id = @bug_id";
                MySqlConnection conn = DBUtils.GetDBConnection();

                conn.Open();

                MySqlCommand cmd = new MySqlCommand();

                cmd.Connection = conn;

                cmd.CommandText = sql;

                // Add and set value for parameter.
                Debug.WriteLine("UpdateBUg Called");

                cmd.Parameters.AddWithValue("@code", bug.getCode());
                cmd.Parameters.AddWithValue("@status", bug.getStatus());
                cmd.Parameters.AddWithValue("@bug_id", bug.getBUGID());
                cmd.Parameters.AddWithValue("@version", bug.getVersion());
                Debug.WriteLine(bug.getCode() + bug.getStatus() + bug.getBUGID());
                int rowCount = cmd.ExecuteNonQuery();
                if (rowCount > 0)
                {
                    Debug.WriteLine("Updated");

                    flag = setHistory(bug);
                }
                else
                {
                    flag = false;
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine("Error Message: " + e);
                Debug.WriteLine(e.StackTrace);
            }
            return(flag);
        }
        /// <summary>
        /// Get History for Audit
        /// </summary>
        /// <param name="bug"></param>
        public bool setHistory(BugModel bug)
        {
            bool flag = false;

            try {
                String sql = "INSERT INTO `tbl_history`( `bug_id`,`version`, `updatedate`, `updatedby`, `code`, `status`, `remarks`) " +
                             "VALUES (@bug_id,@version,@updatedate,@updatedby,@code,@status,@remarks)";

                MySqlConnection conn = DBUtils.GetDBConnection();

                conn.Open();

                MySqlCommand cmd = new MySqlCommand();

                cmd.Parameters.AddWithValue("@bug_id", bug.getBUGID());
                cmd.Parameters.AddWithValue("@version", bug.getVersion());
                cmd.Parameters.AddWithValue("@updatedate", DateTime.Now.ToString("yyyy-MM-dd H:mm:ss"));
                cmd.Parameters.AddWithValue("@updatedby", bug.getUsername());
                cmd.Parameters.AddWithValue("@code", bug.getCode());
                cmd.Parameters.AddWithValue("@status", bug.getStatus());
                cmd.Parameters.AddWithValue("@remarks", bug.getRemarks());
                Debug.WriteLine("setHistory Called");
                cmd.Connection = conn;

                cmd.CommandText = sql;
                int rowCount = cmd.ExecuteNonQuery();

                if (rowCount > 0)
                {
                    flag = true;
                }
                else
                {
                    flag = false;
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine("Error Message: " + e);
                Debug.WriteLine(e.StackTrace);
            }
            return(flag);
        }
Пример #4
0
        /// <summary>
        ///populate dashboard
        /// </summary>


        public void PopulateDashboardItems()
        {
            bug.setBugID(bugid);
            BugController bc = new BugController();

            bc.populatepmdashboard(bug);
            this.richsourcecode.Text = bug.getCode();
            this.richbugdesc.Text    = bug.getbugdesc();
            this.imgscreenshot.Image = bug.GetImage();
            this.txtclassname.Text   = bug.getClass();
            this.txtcomponent.Text   = bug.getComponentName();
            this.txtproject.Text     = bug.getProjectName();
            this.txtmethodname.Text  = bug.getMethod();
            this.txtlinefrom.Text    = bug.getlinenofrom().ToString();
            this.txtlineto.Text      = bug.getlinenoto().ToString();
            this.lblbugstatus.Text   = bug.getStatus();
            imgnew = bug.GetImage();


            //setting bug image
            if (bug.getSeverity() == "Critical")
            {
                this.imgbugseverity.Image = Properties.Resources.bugred;
            }
            else if (bug.getSeverity() == "Low")
            {
                this.imgbugseverity.Image = Properties.Resources.buggreen;
            }

            //enabling disabling assign bug feature
            if (bug.getAssignedTo() != "")
            {
                this.txtdeveloperusername.ReadOnly = true;
                this.txtdeveloperusername.Text     = bug.getAssignedTo();
                this.btnassignbug.Enabled          = false;
            }
            else
            {
                this.txtdeveloperusername.ReadOnly = false;
                this.btnassignbug.Enabled          = true;
            }
        }