Exemplo n.º 1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Response.Clear();

            Regex rgxClient = new Regex(@"[0-9]{6}");

            if (!rgxClient.IsMatch(txtBoxClientId.Text))
            {
                div_xml.InnerText = "Please enter a Code Code in format 6 numbers with a leading '0' if needed.";
                return;
            }

            SolCaseService testWebService = new SolCaseService();
            XmlElement     xmlReturn      = testWebService.getClientDocs(txtBoxClientId.Text);

            Globals.xmlDoc = new XmlDocument();
            Globals.xmlDoc = xmlReturn.OwnerDocument;
            XmlReader xmlReader = new XmlNodeReader(Globals.xmlDoc);

            Globals.solcaseDocs = new DataSet();
            Globals.solcaseDocs.ReadXml(xmlReader);

            // populate the client name
            try
            {
                div_clientName.InnerText = Globals.solcaseDocs.Tables["Client"].Rows[0]["CL-NAME"].ToString();
            } catch
            {
                div_clientName.InnerText = "";
            }

            // create an additional column for the dataset
            // create a new dataset table "SolDoc" column to generate the proposed file name if not exists
            if (!Globals.solcaseDocs.Tables["SolDoc"].Columns.Contains("PROPOSED-FILE-NAME"))
            {
                Globals.solcaseDocs.Tables["SolDoc"].Columns.Add("PROPOSED-FILE-NAME", typeof(String));
            }
            // Now populate the new column
            foreach (DataRow row in Globals.solcaseDocs.Tables["SolDoc"].Rows)
            {
                row["PROPOSED-FILE-NAME"] = FileNameCorrector.ToValidFileName(row["HST-DESCRIPTION"].ToString() + "." + row["EXTENSION"].ToString());
            }

            xmlReader.Close();

            // populate the tree view
            TreeViewMatterList.Nodes.Clear();

            foreach (DataRow row in Globals.solcaseDocs.Tables["Matter"].Rows)
            {
                TreeNode matterNode = new TreeNode(row["MT-CODE"].ToString());

                TreeViewMatterList.Nodes.Add(matterNode);
            }

            // clear the grid view
            GridViewClientDocs.DataSource = null;
            GridViewClientDocs.DataBind();
        }
Exemplo n.º 2
0
        protected void TreeViewMatterList_SelectedNodeChanged(object sender, EventArgs e)
        {
            SelectedMatter      = TreeViewMatterList.SelectedNode.Text;
            SelectedMatterIndex = TreeViewMatterList.Nodes.IndexOf(TreeViewMatterList.SelectedNode);

            div_matterDesc.InnerText = Globals.solcaseDocs.Tables["Matter"].Rows[SelectedMatterIndex]["MAT-DESCRIPTION"].ToString();

            div_clientName.InnerText = string.Format("[MT-CODE] = '{0}'", SelectedMatter);

            string[] selectedColumns = new[] { "MT-CODE", "HISTORY-NO", "HST-DESCRIPTION", "PROPOSED-FILE-NAME" };

            DataTable displayedColumns = new DataView(Globals.solcaseDocs.Tables["SolDoc"]).ToTable(false, selectedColumns);
            DataView  dataView         = displayedColumns.DefaultView;

            dataView.RowFilter = string.Format("[MT-CODE] = '{0}'", SelectedMatter);


            //GridViewClientDocs.DataSource = Globals.solcaseDocs.Tables["SolDoc"];
            GridViewClientDocs.DataSource = dataView;
            GridViewClientDocs.DataBind();
        }