Inheritance: System.Web.Services.WebService
示例#1
0
        public List<search> GetSearchMethodForTwtUser(oAuthTwitter OAuth, string SearchKey, string pageindex)
        {
            search objSearch = new search();

            Twitter.Core.SearchMethods.Search search = new Twitter.Core.SearchMethods.Search();
            JObject jsonResult = search.SearchMethodForTwtUser(OAuth, SearchKey, pageindex);
             JArray data = (JArray)jsonResult["results"];

            if (data!=null)
            {
                foreach (var userdetails in data)
                {
                    objSearch.id = (string)userdetails["from_user_id_str"];
                    objSearch.link = (string)userdetails["profile_image_url"];
                    objSearch.authorObject.name = (string)userdetails["from_user"];
                    SearchMethod.Add(objSearch);
                } 
            }
            return SearchMethod;

        }
示例#2
0
        /// <summary>
        /// Search
        /// </summary>
        /// <param name="User">Twitter User And Password</param>
        /// <param name="Count">SearchKey For Search</param>
        /// <returns>Return Search Result</returns>
        public List<search> GetSearchMethod(TwitterUser User, string SearchKey)
        {
            search objSearch = new search();

            Twitter.Core.SearchMethods.Search search = new Twitter.Core.SearchMethods.Search();
            xmlResult = search.SearchMethod(User, SearchKey);
            XmlNodeList xmlNodeList = xmlResult.GetElementsByTagName("entry");

            foreach (XmlNode xn in xmlNodeList)
            {
                XmlElement idElement = (XmlElement)xn;
                objSearch.id = idElement.GetElementsByTagName("id")[0].InnerText; 

                XmlElement imageUrlElement = (XmlElement)xn;
                objSearch.content = imageUrlElement.GetElementsByTagName("content")[0].InnerText;

                XmlElement followersCountElement = (XmlElement)xn;
                objSearch.link = followersCountElement.GetElementsByTagName("updated")[0].NextSibling.Attributes["href"].InnerText;

                XmlElement friendCountElement = (XmlElement)xn;
                objSearch.authorObject.name = friendCountElement.GetElementsByTagName("name")[0].InnerText;

                SearchMethod.Add(objSearch);
            }
            return SearchMethod;

        }
示例#3
0
        /// <summary>
        /// ReTweet
        /// </summary>
        /// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
        /// <param name="UserToFollow">TweetId</param>
        /// <returns>Returm True If ReTweet Success</returns>
        //public bool ReTweetStatus(oAuthTwitter OAuth, string TweetId)
        //{
        //    try
        //    {
        //        Twitter.Core.StatusMethods.Status status = new Twitter.Core.StatusMethods.Status();
        //        xmlResult = status.ReTweetStatus(OAuth, TweetId);
        //        return true;
        //    }
        //    catch
        //    {
        //        return false;
        //    }
        //}

        #endregion

        #region Search
        /// <summary>
        /// Search
        /// </summary>
        /// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
        /// <param name="Count">SearchKey For Search</param>
        /// <returns>Return Search Result</returns>
        public List<search> GetSearchMethod(oAuthTwitter OAuth, string SearchKey,string pageindex)
        {
            search objSearch = new search();

            Twitter.Core.SearchMethods.Search search = new Twitter.Core.SearchMethods.Search();
            xmlResult = search.SearchMethod(OAuth, SearchKey, pageindex);
            XmlNodeList xmlNodeList = xmlResult.GetElementsByTagName("entry");

            foreach (XmlNode xn in xmlNodeList)
            {
                XmlElement idElement = (XmlElement)xn;
                objSearch.id = idElement.GetElementsByTagName("id")[0].InnerText.Replace("tag:search.twitter.com,2005:", "");

                XmlElement idPostedTime = (XmlElement)xn;
                objSearch.PostedTime = idElement.GetElementsByTagName("published")[0].InnerText;

                XmlElement imageUrlElement = (XmlElement)xn;
                objSearch.content = imageUrlElement.GetElementsByTagName("content")[0].InnerText;

                XmlElement followersCountElement = (XmlElement)xn;
                objSearch.link = followersCountElement.GetElementsByTagName("updated")[0].NextSibling.Attributes["href"].InnerText;

                XmlElement friendCountElement = (XmlElement)xn;
                string name = friendCountElement.GetElementsByTagName("name")[0].InnerText;
                int FirstPoint = name.IndexOf("(");
                objSearch.authorObject.name = name.Substring(0, FirstPoint).Replace("(", "").Replace(" ", "");

                SearchMethod.Add(objSearch);
            }
            return SearchMethod;

        }
 private void searchB_Click(object sender, EventArgs e)
 {
     searchform = new search(itemList, listoffilenames, fileIndex, filename);
     searchform.Show();
     searchListOpen = true;
 }
        public void DragDropEvent(object sender, DragEventArgs e)
        {
            string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
            int sayi = 0;
            for (sayi = 0; sayi < files.Length; sayi++)
            {
                string file = files[sayi].ToString();
                string[] fileName = file.Split('\\');
                string[] fileType = fileName[fileName.Length - 1].Split('.');
                string fullPath = files[sayi].ToString();
                string typeOffile = "";

                DirectoryInfo director = new DirectoryInfo(file);

                if (fileType[fileType.Length - 1].ToLower() == "cmpl")
                {
                    typeOffile = "cmpl";
                }
                else if (fileType[fileType.Length - 1].ToLower() == "wma" || fileType[fileType.Length - 1].ToLower() == "snd" || fileType[fileType.Length - 1].ToLower() == "aif" || fileType[fileType.Length - 1].ToLower() == "aiff" || fileType[fileType.Length - 1].ToLower() == "au" || fileType[fileType.Length - 1].ToLower() == "mp3" || fileType[fileType.Length - 1] == "mp4" || fileType[fileType.Length - 1].ToLower() == "avi" || fileType[fileType.Length - 1].ToLower() == "mpg" || fileType[fileType.Length - 1].ToLower() == "mpeg" || fileType[fileType.Length - 1].ToLower() == "wmv" || fileType[fileType.Length - 1].ToLower() == "mov" || fileType[fileType.Length - 1].ToLower() == "flv" || fileType[fileType.Length - 1].ToLower() == "wav" || fileType[fileType.Length - 1].ToLower() == "wma" || fileType[fileType.Length - 1].ToLower() == "vob" || fileType[fileType.Length - 1].ToLower() == "dat" || fileType[fileType.Length - 1].ToLower() == "3gp")
                {
                    typeOffile = "media";
                }
                else if (director.Attributes == director.Attributes)
                {
                    typeOffile = "director";
                }

                else
                    typeOffile = fileType[fileType.Length - 1].ToString();
                switch (typeOffile)
                {
                    case "cmpl":
                        int filesayi = 0;
                        StreamReader sr = new StreamReader(fullPath);
                        fileNames = new String[1000];
                        filesayi = 0;
                        while (!sr.EndOfStream)
                        {
                            fileNames[filesayi] = sr.ReadLine().ToString();
                            filesayi++;
                        }
                        addList(fileNames, filesayi);
                        break;
                    case "media":
                        string[] mp3files = new String[1000];
                        mp3files[0] = files[sayi].ToString();
                        addList(mp3files, 1);
                        break;
                    case "director":
                        this.filesayisi = 0;
                        this.NumOfDirs = 0;
                        DirectoryInfo basedirectory = new DirectoryInfo(files[sayi].ToString());
                        if (basedirectory.GetFiles().Length > 0)
                            fileadderfromdirectory(basedirectory);
                        MakeDecision(basedirectory.ToString());
                        break;
                    default:
                        MessageBox.Show(typeOffile + " format is not supported.\n Be sure that this file is a valid media file.");
                        break;
                }
            }
            searchform = new search(itemList, listoffilenames, fileIndex, filename);
            searchform.Refresh();
        }
 public From1(ListBox itemlist, ListBox filenames, int width, int height, int x, int y, Label filename)
 {
     InitializeComponent();
     UpdateToolStrip();
     this.itemList.Items.Clear();
     this.itemList.Items.AddRange(itemlist.Items);
     this.listoffilenames.Items.Clear();
     this.listoffilenames.Items.AddRange(filenames.Items);
     this.filename = filename;
     setHeight(height);
     setWidth(width);
     setX(x);
     setY(y);
     fileIndex = getfileindex();
     newPlayerIsCreated = false;
     searchform = new search(itemList, listoffilenames, fileIndex, filename);
     searchform.Refresh();
 }
 public From1(ListBox items, ListBox filenames, int fileindex, bool doubleClick, Label filename)
 {
     InitializeComponent();
     this.itemList = items;
     this.filename = filename;
     this.listoffilenames = filenames;
     itemList.SelectedIndex = fileindex;
     try
     {
         m_obj_BasicAudio.Volume = volumeValue;
         m_CurrentStatus = MediaStatus.Running;
         m_obj_MediaControl.Run();
     }
     catch { }
     OpenFileFuncTh(itemList.SelectedIndex);
     searchform = new search(itemList, listoffilenames, fileindex, filename);
     searchform.Refresh();
 }
 public From1(ListBox itemlistfromsc, ListBox filenames, string TargetFile)
 {
     InitializeComponent();
     this.itemList.Items.Clear();
     itemList = itemlistfromsc;
     this.listoffilenames.Items.Clear();
     listoffilenames = filenames;
     this.Refresh();
     if (fileIndex == -1)
         fileIndex = 0;
     if (!running)
         OpenFileFuncTh(fileIndex);
     searchform = new search(itemList, listoffilenames, 0, filename);
     searchform.Refresh();
     fromweb = true;
     UpdateToolStrip();
 }
 public From1(ListBox itemlist, ListBox filenames, Label filename, int fileindex)
 {
     InitializeComponent();
     UpdateToolStrip();
     this.filename = filename;
     this.itemList.Items.Clear();
     this.itemList.Items.AddRange(itemlist.Items);
     this.listoffilenames.Items.Clear();
     this.listoffilenames.Items.AddRange(filenames.Items);
     itemList.SelectedIndex = fileindex;
     fileIndex = itemList.SelectedIndex;
     if (!running)
         OpenFileFuncTh(0);
     searchform = new search(itemList, listoffilenames, 0, filename);
     searchform.Refresh();
 }
 public From1(ListBox itemList, ListBox listoffilenames, bool playercontrolform, int indexoffile, int indexOfItem)
 {
     InitializeComponent();
     UpdateToolStrip();
     this.itemList.Items.Clear();
     this.itemList = itemList;
     this.listoffilenames.Items.Clear();
     this.listoffilenames = listoffilenames;
     fromPlayerControlForm = true;
     indexOfFromControlForm = indexOfItem;
     searchform = new search(itemList, listoffilenames, 0, filename);
 }
示例#11
0
 //查詢操作
 public int SearchOperation(XmlDocument Search, string account)
 {
     int FileCount = 0;
     //轉換成XDocument
     this.SearchXml = XDocument.Parse(Search.OuterXml);
     //做LogRecord
     // alternatively you can call the Log() method
     // and pass log level as the parameter.
     Log.Log(LogLevel.Info, "Sample informational message");
     //把結果給學弟
     try
     {
         search SearchFun = new search();
         FileCount = SearchFun.ProcessXML(SearchXml, account);
     }
     catch (Exception e)
     {
         throw e.GetBaseException();
     }
     return FileCount;
 }
示例#12
0
        //最後階段
        public XDocument FinalSection()
        {
            XDocument SearchXml = OpenXml("SearchTemp", Path_Info.SearchPath, "STUDYXML-1.xml");
            //呼叫查詢
            search SearchFun = new search();
            int FileCount = SearchFun.ProcessXML(SearchXml, "ServerTemp");

            //進行資料新增
            string Operation = "InsertQuery", ReadFileName = "Insert.xml";
            XDocument QueryXml = OpenXml("Query", Path_Info.SearchPath, FileCount.ToString().Trim());
            //Insert Xml
            XDocument Doc = OpenXml(Operation, Path_Info.InsertPath, ReadFileName);
            foreach (XElement element in Doc.Root.Elements())
            {
                string FieldName = element.Attribute("FieldName").Value;
                foreach (XElement Element in QueryXml.Root.Elements())
                {
                    string QueryName = Element.Attribute("FieldName").Value;
                    if (FieldName.Equals(QueryName))
                    {
                        element.SetValue(Element.Value);
                        break;
                    }
                }
                if (FieldName.Equals("SeriesInstanceUID"))
                    break;
            }
            WriteXml(Doc, Operation, Path_Info.InsertPath, ReadFileName);
            return Doc;
        }
示例#13
0
        public XLWorkbook Export(search materials)
        {
            Dictionary <string, List <Material> > materialDict = search.GetResult(materials);

            var workbook = new XLWorkbook();

            foreach (var item in materialDict)
            {
                var sheetName = item.Key;
                switch (sheetName)
                {
                case "notebook":
                    sheetName = "Notebooks";
                    break;

                case "display":
                    sheetName = "Bildschirme";
                    break;

                case "book":
                    sheetName = "Bücher";
                    break;

                case "equipment":
                    sheetName = "Zubehör";
                    break;

                case "furniture":
                    sheetName = "Mobiliar";
                    break;
                }

                if (item.Value.Count > 0)
                {
                    var worksheet = workbook.Worksheets.Add(sheetName);

                    if (sheetName.Equals("Notebooks"))
                    {
                        worksheet.Cell(1, 2).Value = "Marke";
                        worksheet.Cell(1, 3).Value = "Modell";
                        worksheet.Cell(1, 4).Value = "Seriennummer";
                        worksheet.Cell(1, 5).Value = "Vorname";
                        worksheet.Cell(1, 6).Value = "Nachname";
                        worksheet.Cell(1, 7).Value = "Räumlichkeit";
                    }

                    if (sheetName.Equals("Bildschirme"))
                    {
                        worksheet.Cell(1, 2).Value = "Marke";
                        worksheet.Cell(1, 3).Value = "Modell";
                        worksheet.Cell(1, 4).Value = "Seriennummer";
                        worksheet.Cell(1, 5).Value = "Räumlichkeit";
                        worksheet.Cell(1, 6).Value = "Anzahl";
                    }

                    if (sheetName.Equals("Bücher"))
                    {
                        worksheet.Cell(1, 2).Value = "Titel";
                        worksheet.Cell(1, 3).Value = "ISBN";
                        worksheet.Cell(1, 4).Value = "Vorname";
                        worksheet.Cell(1, 5).Value = "Nachname";
                        worksheet.Cell(1, 6).Value = "Räumlichkeit";
                        worksheet.Cell(1, 7).Value = "Anzahl";
                    }

                    if (sheetName.Equals("Zubehör"))
                    {
                        worksheet.Cell(1, 2).Value = "Art";
                        worksheet.Cell(1, 3).Value = "Marke";
                        worksheet.Cell(1, 4).Value = "Modell";
                        worksheet.Cell(1, 5).Value = "Vorname";
                        worksheet.Cell(1, 6).Value = "Nachname";
                        worksheet.Cell(1, 7).Value = "Räumlichkeit";
                        worksheet.Cell(1, 8).Value = "Anzahl";
                    }

                    if (sheetName.Equals("Mobiliar"))
                    {
                        worksheet.Cell(1, 2).Value = "Art";
                        worksheet.Cell(1, 3).Value = "Räumlichkeit";
                        worksheet.Cell(1, 4).Value = "Anzahl";
                    }

                    for (int i = 0; i < item.Value.Count; i++)
                    {
                        var item1 = item.Value[i];

                        worksheet.Cell(1, 1).Value     = "ID";
                        worksheet.Cell(i + 2, 1).Value = item1.id;

                        if (item1.GetType() == typeof(notebook))
                        {
                            NotebookRepository Repo = new NotebookRepository(entities);
                            Repo.GetRelation();
                            var notebook = (notebook)item1;

                            worksheet.Cell(i + 2, 2).Value = notebook.make;
                            worksheet.Cell(i + 2, 3).Value = notebook.model;
                            worksheet.Cell(i + 2, 4).Value = notebook.serial_number;
                            if (notebook.person != null)
                            {
                                worksheet.Cell(i + 2, 5).Value = notebook.person.name1;
                                worksheet.Cell(i + 2, 6).Value = notebook.person.name2;
                            }
                            if (notebook.classroom != null)
                            {
                                worksheet.Cell(i + 2, 7).Value = notebook.classroom.room;
                            }

                            worksheet.Columns().AdjustToContents();
                            worksheet.Rows().AdjustToContents();
                        }

                        else if (item1.GetType() == typeof(display))
                        {
                            DisplayRepository Repo = new DisplayRepository(entities);
                            Repo.GetRelation();

                            var display = (display)item1;
                            worksheet.Cell(i + 2, 2).Value = display.make;
                            worksheet.Cell(i + 2, 3).Value = display.model;
                            if (display.serial_number != null)
                            {
                                worksheet.Cell(i + 2, 4).Value = display.serial_number;
                            }

                            if (display.classroom != null)
                            {
                                worksheet.Cell(i + 2, 5).Value = display.classroom.room;
                            }

                            if (display.quantity != null)
                            {
                                worksheet.Cell(i + 2, 6).Value = display.quantity;
                            }

                            worksheet.Columns().AdjustToContents();
                            worksheet.Rows().AdjustToContents();
                        }

                        else if (item1.GetType() == typeof(book))
                        {
                            BookRepository Repo = new BookRepository(entities);
                            Repo.GetRelation();

                            var book = (book)item1;
                            worksheet.Cell(i + 2, 2).Value = book.title;
                            worksheet.Cell(i + 2, 3).Value = book.isbn;

                            if (book.person != null)
                            {
                                worksheet.Cell(i + 2, 4).Value = book.person.name1;
                                worksheet.Cell(i + 2, 5).Value = book.person.name2;
                            }
                            if (book.classroom != null)
                            {
                                worksheet.Cell(i + 2, 6).Value = book.classroom.room;
                            }
                            if (book.quantity != null)
                            {
                                worksheet.Cell(i + 2, 7).Value = book.quantity;
                            }

                            worksheet.Columns().AdjustToContents();
                            worksheet.Rows().AdjustToContents();
                        }

                        else if (item1.GetType() == typeof(equipment))
                        {
                            EquipmentRepository Repo = new EquipmentRepository(entities);
                            Repo.GetRelation();
                            var equipment = (equipment)item1;

                            worksheet.Cell(i + 2, 2).Value = equipment.type;

                            if (equipment.make != null)
                            {
                                worksheet.Cell(i + 2, 3).Value = equipment.make;
                            }


                            if (equipment.model != null)
                            {
                                worksheet.Cell(i + 2, 4).Value = equipment.model;
                            }

                            if (equipment.person != null)
                            {
                                worksheet.Cell(i + 2, 5).Value = equipment.person.name1;
                                worksheet.Cell(i + 2, 6).Value = equipment.person.name2;
                            }
                            if (equipment.classroom != null)
                            {
                                worksheet.Cell(i + 2, 7).Value = equipment.classroom.room;
                            }

                            if (equipment.quantity != null)
                            {
                                worksheet.Cell(i + 2, 8).Value = equipment.quantity;
                            }

                            worksheet.Columns().AdjustToContents();
                            worksheet.Rows().AdjustToContents();
                        }

                        else if (item1.GetType() == typeof(furniture))
                        {
                            FurnitureRepository Repo = new FurnitureRepository(entities);
                            Repo.GetRelation();

                            var furniture = (furniture)item1;

                            worksheet.Cell(i + 2, 2).Value = furniture.type;

                            if (furniture.classroom != null)
                            {
                                worksheet.Cell(i + 2, 3).Value = furniture.classroom.room;
                            }


                            if (furniture.quantity != null)
                            {
                                worksheet.Cell(i + 2, 4).Value = furniture.quantity;
                            }

                            worksheet.Columns().AdjustToContents();
                            worksheet.Rows().AdjustToContents();
                        }
                    }
                }
            }
            return(workbook);
        }
示例#14
0
 public void searchElementsDelegate(search cmp)
 {
     searchElements = cmp;
 }