Exemplo n.º 1
0
 public int SaveTaskDetail(TaskDetail taskDetail)
 {
     return SaveTaskDetail(taskDetail.TaskID, taskDetail.TaskHeaderID, taskDetail.TaskNameText, taskDetail.TaskNameValue, taskDetail.TaskStatusText, taskDetail.TaskStatus, taskDetail.DownloadImages, taskDetail.IncognitoMode, taskDetail.TaskType, taskDetail.TaskMode, taskDetail.TaskSite);
 }
Exemplo n.º 2
0
 private static void LoginCheck(TaskDetail taskDetail)
 {
     if (!taskDetail.IncognitoMode && !AdiSpider.IsLoggedIn())
     {
         AdiSpider.Login();
     }
     //while (true)
     //{
     //    lock (LoginLock)
     //    {
     //        break;
     //    }
     //    System.Threading.Thread.Sleep(new Random().Next(10000));
     //}
 }
Exemplo n.º 3
0
 public int DeleteTaskDetail(TaskDetail taskDetail)
 {
     return DeleteTaskDetail(taskDetail.TaskID);
 }
Exemplo n.º 4
0
 private ListViewItem FindListItemByTask(TaskDetail taskDetail)
 {
     return listViewThreads.FindItemWithText(taskDetail.TaskID.ToString());
 }
Exemplo n.º 5
0
 private TaskDetail GetTaskFromListViewItem(ListViewItem lvItem)
 {
     TaskDetail td = new TaskDetail()
     {
         TaskID = Convert.ToInt64(lvItem.SubItems[0].Text),
         TaskNameValue = lvItem.SubItems[1].Text,
         TaskNameText = lvItem.SubItems[2].Text,
         TaskStatusText = lvItem.SubItems[3].Text,
         TaskType = lvItem.SubItems[4].Text,
         TaskMode = lvItem.SubItems[5].Text,
         IncognitoMode = lvItem.SubItems[6].Text == "YES" ? true : false,
         DownloadImages = lvItem.SubItems[7].Text == "YES" ? true : false,
         TaskSite = lvItem.SubItems[8].Text
     };
     return td;
 }
Exemplo n.º 6
0
 private void SetTaskDetailInListViewItem(TaskDetail taskDetail)
 {
     ListViewItem lvItem = FindListItemByTask(taskDetail);
     if (lvItem == null)
     {
         //lvItem = new ListViewItem();
         SetTaskDetailInListViewItem(taskDetail, ref lvItem);
         listViewThreads.Items.Add(lvItem);
     }
     else
     {
         SetTaskDetailInListViewItem(taskDetail, ref lvItem);
     }
 }
Exemplo n.º 7
0
        private void TaskFromTreeViewNode(TreeNode node, Boolean isChecked, string taskMode, string taskType, string site, bool incognito, bool downloadImages)
        {
            if (node.Nodes.Count > 0)
                return;

            TaskDetail task;
            switch (site)
            {
                case Constants.SiteName.ADIGLOBAL:
                    #region [ADIGLOBAL]
                    switch (taskMode)
                    {
                        case "Crawl":
                            taskMode = Constants.TaskMode.ADI_CRAWL;
                            break;
                        case "Update":
                            taskMode = Constants.TaskMode.ADI_UPDATE;
                            break;
                        case "Clearance Zone":
                            taskMode = Constants.TaskMode.ADI_CLEARANCE_ZONE;
                            break;
                        case "Hot Deals":
                            taskMode = Constants.TaskMode.ADI_HOT_DEALS;
                            break;
                        case "Online Specials":
                            taskMode = Constants.TaskMode.ADI_ONLINE_SPECIALS;
                            break;
                        case "Sale Center":
                            taskMode = Constants.TaskMode.ADI_SALE_CENTER;
                            break;
                        case "In Stock":
                            taskMode = Constants.TaskMode.ADI_IN_STOCK;
                            break;
                    }
                    #endregion
                    break;
                case Constants.SiteName.SECLOCK:
                    #region [ SECLOCK ]
                    #endregion
                    break;
            }

            var items = listViewScheduleTasks.SelectedItems;
            Int64 TaskHeaderID = Convert.ToInt64((items.Count == 1) ? items[0].Text : "-1");

            if (isChecked == true)
            {

                task = new TaskDetail();
                task.TaskID = 0;
                task.TaskHeaderID = TaskHeaderID;
                task.TaskNameText = node.Text;
                task.TaskNameValue = node.Tag.ToString();
                task.TaskStatusText = Constants.OPEN_TEXT;
                task.TaskStatus = TaskDetailStatus.Open;
                task.DownloadImages = downloadImages;
                task.IncognitoMode = incognito;
                //task.DownloadImages = chkDownloadImage.Checked;
                //task.IncognitoMode = chkIncognito.Checked;
                task.TaskType = taskType;
                task.TaskMode = taskMode;
                task.TaskSite = site;
                task.TaskID = new TasksScheduler().SaveTaskDetail(task);
            }
            else
            {
                RemoveEntry(node.Tag.ToString(), taskMode, taskType, site);
            }
        }
Exemplo n.º 8
0
 private void SetTaskDetailInListViewItem(TaskDetail taskDetail, ref ListViewItem lvItem)
 {
     String[] text = {
                         taskDetail.TaskID.ToString(),
                         taskDetail.TaskNameValue,
                         taskDetail.TaskNameText,
                         taskDetail.TaskStatusText,
                         taskDetail.TaskType,
                         taskDetail.TaskMode,
                         taskDetail.IncognitoMode ? "YES" : "NO",
                         taskDetail.DownloadImages ? "YES" : "NO",
                         taskDetail.TaskSite
                     };
     if (lvItem == null)
         lvItem = new ListViewItem(text);
     else
     {
         for (int i = 0; i < text.Length; i++)
             lvItem.SubItems[i].Text = text[i];
     }
 }
Exemplo n.º 9
0
 private String GetImageFolder(TaskDetail taskDetail)
 {
     String FolderName = String.Format("{0}\\Image", Application.StartupPath);
     switch(taskDetail.TaskMode)
     {
         case Constants.TaskMode.SECLOCK_MANUFACTURER_CRAWL:
         case Constants.TaskMode.SECLOCK_CATEGORY_CRAWL:
             FolderName = Settings.GetValue("CrawlImageFolder").ToString().Length > 0 ? Settings.GetValue("CrawlImageFolder") : FolderName;
             break;
         case Constants.TaskMode.SECLOCK_PRODUCT_UPDATE:
             FolderName = Settings.GetValue("UpdateImageFolder").ToString().Length > 0 ? Settings.GetValue("UpdateImageFolder") : FolderName;
             break;
     }
     return FolderName;
 }
Exemplo n.º 10
0
        private void DownloadProductImages(TaskDetail taskDetail, InProduct inProduct)
        {
            String Prefix = Settings.GetValue("SecLockImagePrefix").ToString();
            String ImageFileName;
            String FileName;
            String Url;

            if (!String.IsNullOrEmpty(inProduct.ImageUrl1))
            {
                ImageFileName = String.Format("{0}{1}_1.{2}", Prefix, inProduct.Code, Utility.GetFileExtension(inProduct.ImageUrl1));
                ImageFileName = Utility.GetValidFileName(ImageFileName);
                // Small Image
                FileName = String.Format("{0}\\{1}\\{2}", GetImageFolder(taskDetail), CreateProductDirectory(taskDetail, inProduct), ImageFileName);
                Url = (inProduct.ImageUrl1.StartsWith("http") ? "" : "http://www.seclock.com") + inProduct.ImageUrl1;
                //Utility.ApplicationLog(String.Format("Downloading Image from {0} to {1}", Url, FileName));
                browser.DownloadFile(Url, FileName);
                inProduct.ImageUrl1 = ImageFileName;
            }
            if (!String.IsNullOrEmpty(inProduct.ImageUrl2))
            {
                ImageFileName = String.Format("{0}{1}_2.{2}", Prefix, inProduct.Code, Utility.GetFileExtension(inProduct.ImageUrl2));
                ImageFileName = Utility.GetValidFileName(ImageFileName);
                // Small Image
                FileName = String.Format("{0}\\{1}\\{2}", GetImageFolder(taskDetail), CreateProductDirectory(taskDetail, inProduct), ImageFileName);
                Url = (inProduct.ImageUrl2.StartsWith("http") ? "" : "http://www.seclock.com") + inProduct.ImageUrl2;
                //Utility.ApplicationLog(String.Format("Downloading Image from {0} to {1}", Url, FileName));
                browser.DownloadFile(Url, FileName);
                inProduct.ImageUrl2 = ImageFileName;
            }
        }
Exemplo n.º 11
0
        private String CreateProductDirectory(TaskDetail taskDetail, InProduct inProduct)
        {
            String ValidDirName = Utility.GetValidDirName(inProduct.Code);
            String DirName;

            DirName = String.Format("{0}\\{1}", GetImageFolder(taskDetail), ValidDirName);
            if (!Directory.Exists(DirName))
            {
                //Utility.ApplicationLog(String.Format("Creating Directory {0}", DirName));
                Directory.CreateDirectory(DirName);
            }
            return ValidDirName;
        }
Exemplo n.º 12
0
 private static void LoginCheck(TaskDetail taskDetail)
 {
     if (!taskDetail.IncognitoMode && ! SecLockSpider.IsLoggedIn())
     {
         Login();
     }
 }