예제 #1
0
    protected void btnQueryAddUpd_Click(object sender, EventArgs e)
    {
        if (fldSelectedKey.Value != "")
        {
            Guid   InspectionId = new Guid(fldSelectedKey.Value);
            string Mode         = "Upd";

            if (null == ViewState["InspectionQueryListDetails"])
            {
                ViewState["InspectionQueryListDetails"] = new Inspection().GetInspectionQueriesByInspectionId(InspectionId);
            }

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

            DataRow dr = dtInspectionQueryListDetails.NewRow();
            dr["QueryId"]      = Guid.NewGuid();
            dr["InspectionId"] = Guid.Empty;
            dr["CheckListId"]  = ddlCheckListIdUpd.SelectedItem.Value;
            dr["Description"]  = ddlCheckListIdUpd.SelectedItem.Text;

            dr["Query"]   = txtQueryUpd.Text;
            dr["Remarks"] = txtQueryRemarksUpd.Text;

            dtInspectionQueryListDetails.Rows.Add(dr);
            ViewState["InspectionQueryListDetails"] = dtInspectionQueryListDetails;
            GvInspectionQueriesUpd.DataSource       = (DataTable)ViewState["InspectionQueryListDetails"];
            GvInspectionQueriesUpd.DataBind();
            txtQueryUpd.Text        = "";
            txtQueryRemarksUpd.Text = "";
        }
    }
예제 #2
0
    protected void GvInspectionQueriesUpd_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (fldSelectedKey.Value != "")
        {
            Guid   InspectionId = new Guid(fldSelectedKey.Value);
            string Mode         = "Upd";

            if (null == ViewState["InspectionQueryListDetails"])
            {
                ViewState["InspectionQueryListDetails"] = new Inspection().GetInspectionQueriesByInspectionId(InspectionId);
            }
            GridView GvInspectionQueries = ((GridView)WzInspectionUpd.FindControl("GvInspectionQueries" + Mode));

            DataTable dtInspectionQueryListDetails = (DataTable)ViewState["InspectionQueryListDetails"];

            DropDownList ddlCheckListId  = ((DropDownList)WzInspectionUpd.FindControl("ddlCheckListId" + Mode));
            TextBox      txtQuery        = ((TextBox)WzInspectionUpd.FindControl("txtQuery" + Mode));
            TextBox      txtQueryRemarks = ((TextBox)WzInspectionUpd.FindControl("txtQueryRemarks" + Mode));
            object[]     keys            = { GvInspectionQueries.SelectedDataKey.Value };

            DataRow dr = dtInspectionQueryListDetails.Rows.Find(keys);

            if (null != dr)
            {
                ddlCheckListId.SelectedValue = Convert.ToString(dr["CheckListId"]);

                txtQuery.Text = Convert.ToString(dr["Query"]);

                txtQueryRemarks.Text = Convert.ToString(dr["Remarks"]);
            }

            ((Button)WzInspectionUpd.FindControl("btnQueryAdd" + Mode)).Visible = false;
            ((Button)WzInspectionUpd.FindControl("btnQueryUpdate")).Visible     = true;
        }
    }