コード例 #1
0
ファイル: TsortImages.aspx.cs プロジェクト: jpheary/Argix08
    protected DataSet getSearchData()
    {
        //Get image data
        SearchDS searchDS = new SearchDS();

        SearchDS.SearchTableRow searchRow = searchDS.SearchTable.NewSearchTableRow();
        searchRow.ScopeName     = this.cboDocClass.SelectedValue;
        searchRow.DocumentClass = this.cboDocClass.SelectedValue;
        searchRow.PropertyName  = this.cboProp1.SelectedValue;
        searchRow.PropertyValue = this.txtSearch1.Text.Trim();
        if (this.txtSearch2.Text.Trim().Length > 0)
        {
            searchRow.Operand1       = this.cboOperand1.SelectedValue;
            searchRow.PropertyName1  = this.cboProp2.SelectedValue;
            searchRow.PropertyValue1 = this.txtSearch2.Text.Trim();
        }
        if (this.txtSearch3.Text.Trim().Length > 0)
        {
            searchRow.Operand2       = this.cboOperand2.SelectedValue;
            searchRow.PropertyName2  = this.cboProp3.SelectedValue;
            searchRow.PropertyValue2 = this.txtSearch3.Text.Trim();
        }
        if (this.txtSearch4.Text.Trim().Length > 0)
        {
            searchRow.Operand3       = this.cboOperand3.SelectedValue;
            searchRow.PropertyName3  = this.cboProp4.SelectedValue;
            searchRow.PropertyValue3 = this.txtSearch4.Text.Trim();
        }
        searchDS.SearchTable.AddSearchTableRow(searchRow);
        Argix.Freight.ImagingService isvc = new Argix.Freight.ImagingService();
        return(isvc.SearchSharePointImageStore(searchDS));
    }
コード例 #2
0
        private string getWhereClause(SearchDS search)
        {
            //Build a WHERE clause
            string        propertyName;
            StringBuilder sb = new StringBuilder();

            if (search.SearchTable[0].PropertyValue.Trim().Length > 0)
            {
                propertyName = XmlConvert.EncodeName(search.SearchTable[0].PropertyName);
                if (propertyName.ToLower().Contains("date") || propertyName.ToLower() == "created")
                {
                    sb.Append(getDateClause(propertyName, search.SearchTable[0].PropertyValue.Trim()));
                }
                else
                {
                    sb.Append("Property LIKE 'SearchText' ".Replace("Property", propertyName).Replace("SearchText", search.SearchTable[0].PropertyValue.Trim()));
                }
            }
            if (!search.SearchTable[0].IsPropertyName1Null() && !search.SearchTable[0].IsPropertyValue1Null() && !search.SearchTable[0].IsOperand1Null() && search.SearchTable[0].PropertyValue1.Trim().Length > 0)
            {
                sb.Append(" " + search.SearchTable[0].Operand1);
                propertyName = XmlConvert.EncodeName(search.SearchTable[0].PropertyName1);
                if (propertyName.ToLower().Contains("date") || propertyName.ToLower() == "created")
                {
                    sb.Append(getDateClause(propertyName, search.SearchTable[0].PropertyValue1.Trim()));
                }
                else
                {
                    sb.Append(" " + "Property LIKE 'SearchText' ".Replace("Property", propertyName).Replace("SearchText", search.SearchTable[0].PropertyValue1.Trim()));
                }
            }
            if (!search.SearchTable[0].IsPropertyName2Null() && !search.SearchTable[0].IsPropertyValue2Null() && !search.SearchTable[0].IsOperand2Null() && search.SearchTable[0].PropertyValue2.Trim().Length > 0)
            {
                sb.Append(" " + search.SearchTable[0].Operand2);
                propertyName = XmlConvert.EncodeName(search.SearchTable[0].PropertyName2);
                if (propertyName.ToLower().Contains("date") || propertyName.ToLower() == "created")
                {
                    sb.Append(getDateClause(propertyName, search.SearchTable[0].PropertyValue2.Trim()));
                }
                else
                {
                    sb.Append(" " + "Property LIKE 'SearchText' ".Replace("Property", propertyName).Replace("SearchText", search.SearchTable[0].PropertyValue2.Trim()));
                }
            }
            if (!search.SearchTable[0].IsPropertyName3Null() && !search.SearchTable[0].IsPropertyValue3Null() && !search.SearchTable[0].IsOperand3Null() && search.SearchTable[0].PropertyValue3.Trim().Length > 0)
            {
                sb.Append(" " + search.SearchTable[0].Operand3);
                propertyName = XmlConvert.EncodeName(search.SearchTable[0].PropertyName3);
                if (propertyName.ToLower().Contains("date") || propertyName.ToLower() == "created")
                {
                    sb.Append(getDateClause(propertyName, search.SearchTable[0].PropertyValue3.Trim()));
                }
                else
                {
                    sb.Append(" " + "Property LIKE 'SearchText' ".Replace("Property", propertyName).Replace("SearchText", search.SearchTable[0].PropertyValue3.Trim()));
                }
            }
            return(sb.ToString());
        }
コード例 #3
0
        public DataSet SearchSharePointImageStore(SearchDS search)
        {
            //
            DataSet ds = null;

            try {
                string SQL = getSQLQuery(search.SearchTable[0].ScopeName);
                SQL = SQL.Replace("selectStmnt", getSelectClause(search.SearchTable[0].DocumentClass)).Replace("whereClause", getWhereClause(search)).Replace("MaxSearchResults", search.SearchTable[0].MaxResults.ToString());
                rgxvmsp.QueryService qs = new rgxvmsp.QueryService();
                qs.Credentials     = getCredentials();
                qs.PreAuthenticate = true;
                //qs.Timeout = 500000;    //Default 100000 msec
                qs.Url         = WebConfigurationManager.AppSettings["rgxvmsp.spsearch"].ToString();
                qs.Credentials = getCredentials();
                ds             = qs.QueryEx(SQL);
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error in SearchSharePointImageStore(SearchDS).", ex); }
            return(ds);
        }
コード例 #4
0
        public byte[] GetSharePointImageStream(SearchDS search)
        {
            //Return an image from SharePoint as a byte[]
            byte[] bytes = null;
            try {
                //Search for image
                DataSet ds = SearchSharePointImageStore(search);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    //Get image url
                    string url = ds.Tables[0].Rows[0]["DAV%3ahref"].ToString();

                    //Pull the image from a remote client and load into an image object
                    WebClient wc = new WebClient();
                    wc.Credentials = getCredentials();
                    bytes          = wc.DownloadData(url);
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected error in GetSharePointImageStream(SearchDS).", ex); }
            return(bytes);
        }