예제 #1
0
    protected void WzInspectionUpd_FinishButtonClick(object sender, WizardNavigationEventArgs e)
    {
        if (fldSelectedKey.Value != "")
        {
            Guid InspectionId = new Guid(fldSelectedKey.Value);

            Inspection objInspection = new Inspection();

            InspectionDetailsRow InspectionDetails = Inspection.GetInspectionDetailsRow();
            InspectionDetails.InspectionTypeId    = new Guid(ddlInspectionTypeIdUpd.SelectedValue);
            InspectionDetails.InspectingOfficerId = new Guid(ddlInspectingOfficerIdUpd.SelectedValue);
            InspectionDetails.InspectorOfficeName = txtInspectorOfficeNameUpd.Text;
            InspectionDetails.InspectedOfficeId   = new Guid(ddlInspectedOfficeIdUpd.SelectedValue);
            InspectionDetails.LicenseId           = new Guid(ddlLicenseIdUpd.SelectedValue);
            InspectionDetails.IsDiscrepancyFound  = IsdescripancyFoundUpd.Checked;
            InspectionDetails.Remarks             = txtInspectionRemarksUpd.Text;

            Wizard Container = (Wizard)Master.FindControl("Main").FindControl("WzInspectionUpd");
            List <CheckListInspectionRow> CheckListRows = new List <CheckListInspectionRow>();

            string      filename = Server.MapPath("~\\Inspection\\InspectionCheckList.xml");
            XmlDocument InspectionCheckListXml = new XmlDocument();
            InspectionCheckListXml.Load(filename);

            foreach (XmlNode Node in InspectionCheckListXml.SelectNodes("DocumentElement/Items"))
            {
                CheckListInspectionRow CheckListRow = Inspection.GetCheckListRow();
                TextBox  txtRemarks = (TextBox)Container.FindControl("txt" + Node.Attributes["ItemId"].Value);
                CheckBox chkYesNo   = (CheckBox)Container.FindControl("chk" + Node.Attributes["ItemId"].Value);

                CheckListRow.InspectionCheckListId = new Guid(Node.Attributes["ItemId"].Value);

                if (null != txtRemarks)
                {
                    CheckListRow.Remarks = txtRemarks.Text;
                }
                else
                {
                    CheckListRow.SetRemarksNull();
                }

                if (null != chkYesNo)
                {
                    CheckListRow.Checked = chkYesNo.Checked;
                }
                else
                {
                    CheckListRow.Checked = false;
                }

                CheckListRows.Add(CheckListRow);
            }


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

            objInspection.UpdateInspection(InspectionDetails, CheckListRows, InspectionQueries, InspectionId);
        }
    }
예제 #2
0
    protected void WzInspectionUpd_DataBinding(object sender, EventArgs e)
    {
        if (fldSelectedKey.Value != "")
        {
            Guid InspectionId = new Guid(fldSelectedKey.Value);

            Inspection objInspection       = new Inspection();
            DataRow    drInspectionDetails = objInspection.GetInspectionDetailsById(InspectionId).Rows[0];

            //ddlInspectionTypeIdUpd.DataValueField = ((Guid) drInspectionDetails["InspectionTypeId"]).ToString();
            // ddlInspectingOfficerIdUpd.DataValueField = ((Guid) drInspectionDetails["InspectingOfficerId"]).ToString();

            //ddlInspectionTypeIdUpd.DataTextField = ((Guid) drInspectionDetails["InspectionTypeId"]).ToString();
            //ddlInspectingOfficerIdUpd.DataTextField = ((Guid) drInspectionDetails["InspectingOfficerId"]).ToString();

            //txtInspectorOfficeNameUpd.Text = ((Guid) drInspectionDetails["InspectorOfficeName"]).ToString();
            txtInspectorOfficeNameUpd.Text = Convert.ToString(drInspectionDetails["InspectorOfficeName"]);
            IsdescripancyFoundUpd.Checked  = (bool)(drInspectionDetails["IsDiscrepancyFound"]);
            txtInspectionRemarksUpd.Text   = Convert.ToString(drInspectionDetails["Remarks"]);

            DataTable dtQueries = new DataTable();

            dtQueries = objInspection.GetInspectionQueriesByInspectionId(InspectionId);

            GvInspectionQueriesUpd.DataSource = dtQueries;
            GvInspectionQueriesUpd.DataBind();

            Wizard Container = (Wizard)Master.FindControl("Main").FindControl("WzInspectionUpd");
            List <CheckListInspectionRow> CheckListRows = new List <CheckListInspectionRow>();

            string      filename = Server.MapPath("~\\Inspection\\InspectionCheckList.xml");
            XmlDocument InspectionCheckListXml = new XmlDocument();
            InspectionCheckListXml.Load(filename);

            foreach (XmlNode Node in InspectionCheckListXml.SelectNodes("DocumentElement/Items"))
            {
                CheckListInspectionTable dtChecklist = new CheckListInspectionTable();
                dtChecklist = (CheckListInspectionTable)objInspection.GetInspectionCheckListById(InspectionId);
                CheckListInspectionRow drCheckListRow = Inspection.GetCheckListRow();
                Guid[] keys = { InspectionId,
                                new Guid(Node.Attributes["ItemId"].Value) };
                drCheckListRow = (CheckListInspectionRow)dtChecklist.FindByInspectionIdInspectionCheckListId(keys[0], keys[1]);
                TextBox  txtRemarks = (TextBox)Container.FindControl("txt" + Node.Attributes["ItemId"].Value);
                CheckBox chkYesNo   = (CheckBox)Container.FindControl("chk" + Node.Attributes["ItemId"].Value);
                if (null != txtRemarks)
                {
                    txtRemarks.Text = Convert.ToString(drCheckListRow["Remarks"]);
                }
                if (null != chkYesNo)
                {
                    chkYesNo.Checked = (bool)drCheckListRow["Checked"];
                }
            }
        }
    }
예제 #3
0
    protected void btnSetControls_Click(object sender, EventArgs e)
    {
        Control ctrl = Master.FindControl("Main");
        List <CheckListInspectionRow> objdict = new List <CheckListInspectionRow>();
        DetailsList bll = new DetailsList();


        string filename = @"E:\Projects\IGRSS\FINAL\WebApp\Inspection\InspectionCheckList.xml";

        XmlDocument doc = new XmlDocument();

        doc.Load(filename);

        foreach (XmlNode Node in doc.SelectNodes("DocumentElement/Items"))
        {
            //CheckListInspectionRow row = InspectionCheckList.GetCheckListRow();
            CheckListInspectionRow row = DetailsList.GetCheckListRow();


            string Remarks = string.Empty;
            bool   Checked = false;

            TextBox  txt = (TextBox)ctrl.FindControl("txt" + Node.Attributes["ItemId"].Value);
            CheckBox chk = (CheckBox)ctrl.FindControl("chk" + Node.Attributes["ItemId"].Value);

            if (null != txt)
            {
                Remarks = txt.Text;
            }

            if (null != chk)
            {
                Checked = chk.Checked;
            }

            row.InspectionCheckListId = new Guid(Node.Attributes["ItemId"].Value);
            row.Remarks = Remarks;
            row.Checked = Checked;

            objdict.Add(row);
        }

        bll.Insert(objdict);
    }