Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session.Count == 0)
        {
            Response.Redirect("~/Admin/AdminLogin.aspx");
        }
        else
        {
            if (!IsPostBack)
            {
                int defectId = (int)Session["DefectId"];
                DefectsDataAccess defectsDataAccess = new DefectsDataAccess();
                OneDefectDataSet  oneDefectDataSet  = defectsDataAccess.GetDefect(defectId);
                this.defectIdLabel.Text    = ((int)oneDefectDataSet.Defects.Rows[0].ItemArray.GetValue(0)).ToString();
                this.testerIdLabel.Text    = (string)oneDefectDataSet.Defects.Rows[0].ItemArray.GetValue(1);
                this.defectTitleLabel.Text = (string)oneDefectDataSet.Defects.Rows[0].ItemArray.GetValue(2);

                this.defectDescriptionTextBox.Text = (string)oneDefectDataSet.Defects.Rows[0].ItemArray.GetValue(3);
                this.defectNotesTextBox.Text       = (string)oneDefectDataSet.Defects.Rows[0].ItemArray.GetValue(4);

                this.fixedCheckBox.Checked     = (bool)oneDefectDataSet.Defects.Rows[0].ItemArray.GetValue(5);
                this.postponedCheckBox.Checked = (bool)oneDefectDataSet.Defects.Rows[0].ItemArray.GetValue(6);

                DateTime dateCreated = (DateTime)oneDefectDataSet.Defects.Rows[0].ItemArray.GetValue(7);
                this.dateCreatedLabel.Text = dateCreated.ToString();

                DateTime dateFixed = (DateTime)oneDefectDataSet.Defects.Rows[0].ItemArray.GetValue(8);
                this.dateFixedLabel.Text = dateFixed.ToString();
            }
        }
    }
    protected void yourDefectsGridView_SelectedIndexChanged(object sender, EventArgs e)
    {
        GridView          gv                = (GridView)sender;
        int               defectID          = (int)gv.SelectedDataKey.Value;
        DefectsDataAccess defectsDataAccess = new DefectsDataAccess();

        this.defectDescriptionTextBox.Text = defectsDataAccess.GetDefectDescription(defectID);
    }
 protected void addDefectButton_Click(object sender, EventArgs e)
 {
     if (this.defectTitleTextBox.Text.Trim().Equals("") || this.defectDescriptionTextBox.Text.Trim().Equals(""))
     {
         this.newDefectLabel.Text = "No blank fields please!";
     }
     else
     {
         string            testerID          = (string)Session["UserId"];
         string            defectTitle       = this.defectTitleTextBox.Text;
         string            defectDescription = this.defectDescriptionTextBox.Text;
         string            notes             = "";
         bool              isFixed           = false;
         bool              isPostponed       = false;
         DateTime          dateCreated       = DateTime.Now;
         DateTime          dateFixed         = DateTime.MaxValue;
         DefectsDataAccess defectsDataAccess = new DefectsDataAccess();
         defectsDataAccess.InsertDefect(testerID, defectTitle, defectDescription, notes, isFixed, isPostponed, dateCreated, dateFixed);
         this.defectTitleTextBox.Text       = "";
         this.defectDescriptionTextBox.Text = "";
     }
 }
Exemplo n.º 4
0
    protected void editDefectUpdateButton_Click(object sender, EventArgs e)
    {
        DefectsDataAccess defectsDataAccess = new DefectsDataAccess();

        string testerId    = this.testerIdLabel.Text;
        string defectTitle = this.defectTitleLabel.Text;

        string defectDescription = this.defectDescriptionTextBox.Text;
        string notes             = this.defectNotesTextBox.Text;

        bool isFixed     = this.fixedCheckBox.Checked;
        bool isPostponed = this.postponedCheckBox.Checked;

        DateTime dateCreated = System.Convert.ToDateTime(this.dateCreatedLabel.Text);
        DateTime dateFixed   = System.Convert.ToDateTime(this.dateFixedLabel.Text);

        int origDefectId = (int)Session["DefectId"];

        defectsDataAccess.UpdateDefect(testerId, defectTitle, defectDescription, notes, isFixed, isPostponed, dateCreated, dateFixed, origDefectId);

        Session.Remove("DefectId");
        Response.Redirect("~/Admin/Defects.aspx");
    }