Example #1
0
    protected void btnChecklistAddIns_Click(object sender, EventArgs e)
    {
        string Mode         = "Ins";
        Guid   InspectionId = Guid.Empty;

        if (null == ViewState["InspectionCheckListDetails"])
        {
            ViewState["InspectionCheckListDetails"] = new Inspection().GetInspectionCheckListById(Guid.Empty);
            InspectionId = Guid.Empty;
        }
        if (FvInspectionDetails.CurrentMode == FormViewMode.Edit)
        {
            InspectionId = (Guid)FvInspectionDetails.DataKey["InspectionId"];

            Mode = "Upd";
        }

        GridView     GvInspectionCheckList        = ((GridView)FvInspectionDetails.FindControl("GvInspectionCheckList" + Mode));
        DataTable    dtInspectionCheckListDetails = (DataTable)ViewState["InspectionCheckListDetails"];
        DropDownList ddlInspectionCheckListId     = ((DropDownList)FvInspectionDetails.FindControl("ddlInspectionCheckListId" + Mode));
        CheckBox     chkbxChecked        = (CheckBox)FvInspectionDetails.FindControl("chkbxChecked" + Mode);
        TextBox      txtCheckListRemarks = (TextBox)FvInspectionDetails.FindControl("txtCheckListRemarks" + Mode);
        DataRow      dr = dtInspectionCheckListDetails.NewRow();

        dr["InspectionId"]          = Guid.Empty;
        dr["InspectionCheckListId"] = ddlInspectionCheckListId.SelectedItem.Value;

        dr["Checked"] = (bool)(chkbxChecked.Checked);

        dr["Remarks"] = txtCheckListRemarks.Text;
        dtInspectionCheckListDetails.Rows.Add(dr);
        ViewState["InspectionCheckListDetails"] = dtInspectionCheckListDetails;
        GvInspectionCheckList.DataSource        = (DataTable)ViewState["InspectionCheckListDetails"];
        GvInspectionCheckList.DataBind();
    }
Example #2
0
    protected void btnQueryAddIns_Click(object sender, EventArgs e)
    {
        string Mode         = "Ins";
        Guid   InspectionId = Guid.Empty;

        if (null == ViewState["InspectionQueryListDetails"])
        {
            ViewState["InspectionQueryListDetails"] = new Inspection().GetInspectionQueriesByInspectionId(Guid.Empty);
            InspectionId = Guid.Empty;
        }
        if (FvInspectionDetails.CurrentMode == FormViewMode.Edit)
        {
            InspectionId = (Guid)FvInspectionDetails.DataKey["InspectionId"];

            Mode = "Upd";
        }

        GridView     GvInspectionQueries          = ((GridView)FvInspectionDetails.FindControl("GvInspectionQueries" + Mode));
        DataTable    dtInspectionQueryListDetails = (DataTable)ViewState["InspectionQueryListDetails"];
        DropDownList ddlCheckListId  = ((DropDownList)FvInspectionDetails.FindControl("ddlCheckListId" + Mode));
        TextBox      txtQuery        = (TextBox)FvInspectionDetails.FindControl("txtQuery" + Mode);
        TextBox      txtQueryRemarks = (TextBox)FvInspectionDetails.FindControl("txtQueryRemarks" + Mode);

        DataRow dr = dtInspectionQueryListDetails.NewRow();

        dr["QueryId"]      = Guid.NewGuid();
        dr["InspectionId"] = Guid.Empty;
        dr["CheckListId"]  = ddlCheckListId.SelectedItem.Value;
        dr["Description"]  = ddlCheckListId.SelectedItem.Text;

        dr["Query"]   = txtQuery.Text;
        dr["Remarks"] = txtQueryRemarks.Text;

        dtInspectionQueryListDetails.Rows.Add(dr);
        ViewState["InspectionQueryListDetails"] = dtInspectionQueryListDetails;
        GvInspectionQueries.DataSource          = (DataTable)ViewState["InspectionQueryListDetails"];
        GvInspectionQueries.DataBind();
    }