protected void Page_Load(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(Session["problem_id"].ToString()))
     {
         int problemID = int.Parse(Session["problem_id"].ToString());
         populateProblemDetails(RoundingFunctions.getProblem(problemID));
         populate_troublshoot_table(problemID);
     }
 }
    protected void populateProblemDetails(problem prob)
    {
        string ta_name = commonMethods.getTAName(prob.added_by);


        id_lbl.Text       = prob.id.ToString();
        pc_lbl.Text       = prob.pc;
        location_lbl.Text = commonMethods.getLocationName(prob.location_id);
        venue_lbl.Text    = prob.venue;
        desc_lbl.Text     = prob.description;
        added_lbl.Text    = DateTime.Parse(prob.date).ToString("yyy-MM-dd") + " " + prob.shift;

        //by whom
        by_whom_lbl.Text = ta_name;
        type_lbl.Text    = RoundingFunctions.getTypeName(prob.type);
    }
    protected void populate_troublshoot_table(int problem_id)
    {
        Table troublshootTable = new Table();

        troublshootTable.CssClass = "table table-bordered table-striped";

        TableHeaderRow  thr      = new TableHeaderRow();
        TableHeaderCell thc_step = new TableHeaderCell();

        thc_step.Text = "Step";
        TableHeaderCell thc_date = new TableHeaderCell();

        thc_date.Text = "On";
        TableHeaderCell thc_by = new TableHeaderCell();

        thc_by.Text = "Person";

        thr.Cells.Add(thc_step);
        thr.Cells.Add(thc_date);
        thr.Cells.Add(thc_by);

        troublshootTable.Rows.Add(thr);

        foreach (string troubleshoot in RoundingFunctions.getTroublshootingSteps(problem_id))
        {
            TableRow  newRow     = new TableRow();
            TableCell stepCell   = new TableCell();
            TableCell onDayCell  = new TableCell();
            TableCell byWhomCell = new TableCell();

            string[] troubleshootInfo = troubleshoot.Split(',');

            stepCell.Text   = troubleshootInfo[0];
            onDayCell.Text  = troubleshootInfo[1];
            byWhomCell.Text = getUserName(int.Parse(troubleshootInfo[2]));

            newRow.Cells.Add(stepCell);
            newRow.Cells.Add(onDayCell);
            newRow.Cells.Add(byWhomCell);

            troublshootTable.Rows.Add(newRow);
        }

        troubleshoot_ph.Controls.Add(troublshootTable);
    }
Example #4
0
    protected void populate_qc_problems(string location_id)
    {
        Table roundingTable = new Table();

        roundingTable.CssClass = "table table-bordered table-hover table-striped table-responsive";

        TableHeaderRow  thr       = new TableHeaderRow();
        TableHeaderCell thc_venue = new TableHeaderCell();

        thc_venue.Text = "Venue";
        TableHeaderCell thc_desc = new TableHeaderCell();

        thc_desc.Text = "Description";
        TableHeaderCell thc_shift = new TableHeaderCell();

        thc_shift.Text = "Shift";
        TableHeaderCell thc_date = new TableHeaderCell();

        thc_date.Text = "Date";
        TableHeaderCell thc_troubleshoot = new TableHeaderCell();

        thc_troubleshoot.Text = "Troubleshoot";

        thr.Cells.Add(thc_venue);
        thr.Cells.Add(thc_desc);
        thr.Cells.Add(thc_shift);
        thr.Cells.Add(thc_date);
        thr.Cells.Add(thc_troubleshoot);

        roundingTable.Rows.Add(thr);

        int locationID = int.Parse(location_id);

        foreach (problem prob in RoundingFunctions.getProblems(locationID, 'q'))
        {
            TableRow  newRow              = new TableRow();
            TableCell venueCell           = new TableCell();
            TableCell descCell            = new TableCell();
            TableCell shiftCell           = new TableCell();
            TableCell dateCell            = new TableCell();
            TableCell troubleshootBtnCell = new TableCell();

            venueCell.Text = prob.venue;
            descCell.Text  = prob.description;
            shiftCell.Text = prob.shift;
            dateCell.Text  = prob.date;

            Button troubleshootBtn = new Button();
            troubleshootBtn.ID       = prob.id.ToString();
            troubleshootBtn.Text     = "Troubleshoot";
            troubleshootBtn.CssClass = "btn-sm btn-warning";
            troubleshootBtnCell.Controls.Add(troubleshootBtn);

            troubleshootBtn.Click += new EventHandler(this.troubleshootBtn_Click);
            newRow.Cells.Add(venueCell);
            newRow.Cells.Add(descCell);
            newRow.Cells.Add(shiftCell);
            newRow.Cells.Add(dateCell);
            newRow.Cells.Add(troubleshootBtnCell);

            roundingTable.Rows.Add(newRow);
        }

        roundingProblems_ph.Controls.Add(roundingTable);
    }