Exemple #1
0
        static void Main(string[] args)
        {
            BCT.Execute(c => { });
            while (true)
            {
                #region DEBUG
                //var caches = BulletinCollector.GetBulletinsByQuery(@"http://avito.ru", "iPhone");
                //caches = BulletinCollector.GetBulletinsBySheets(caches);
                #endregion
                Console.Write("BC> ");
                var text = Console.ReadLine();
                BCT.Execute(c =>
                {
                    var enterArgs = text.Split(new[] { " -" }, StringSplitOptions.None);
                    var command   = enterArgs[0];
                    switch (command)
                    {
                    case "TaskGeneration":
                        GenerationHelpers.GenerationFull();
                        break;

                    case "TaskGenerationClear":
                        GenerationHelpers.GenerationClearData();
                        break;

                    case "NextTask":
                        var r2 = BackTaskHelper.Next();
                        r2     = r2;
                        break;

                    case "RunStatisticsTasks":
                        StatisticsHelper.RunUserStatisticsTask(new Guid("43461B22-1BC4-4584-8DB8-FA930CB331C5"));
                        break;

                    case "ComputeStatisticsTasks":
                        StatisticsHelper.ComputeUserStatistics(new Guid("43461B22-1BC4-4584-8DB8-FA930CB331C5"));
                        break;

                    case "GetCalls":
                        StatisticsHelper.GetCallsStatistics(new Guid("43461B22-1BC4-4584-8DB8-FA930CB331C5"));
                        break;

                    case "help":
                        Console.WriteLine(Help);
                        break;

                    default:
                        Console.WriteLine("Command not found");
                        break;
                    }
                });
            }
        }
Exemple #2
0
        private TaskInstancePublicationCache ToCache4(Task arg2)
        {
            var arg1   = new TaskInstancePublicationCache();
            var access = BCT.Context.BulletinDb.Accesses.Find(arg2.AccessId);

            if (access != null)
            {
                arg1.Login    = access.Login;
                arg1.Password = access.Password;
            }
            else
            {
                arg2.ErrorDescription = "Create task model TaskInstancePublicationCache crash. Access not found";
                BackTaskHelper.Error(new[] { arg2 });
                return(null);
            }
            var groupSign = GroupHelper.GetGroupSignature2(arg2.BulletinId.Value);

            if (groupSign != null)
            {
                arg1.Category1 = groupSign.Category1 == null ? "" : groupSign.Category1;
                arg1.Category2 = groupSign.Category2 == null ? "" : groupSign.Category2;
                arg1.Category3 = groupSign.Category3 == null ? "" : groupSign.Category3;
                arg1.Category4 = groupSign.Category4 == null ? "" : groupSign.Category4;
                arg1.Category5 = groupSign.Category5 == null ? "" : groupSign.Category5;
            }
            else
            {
                arg2.ErrorDescription = "Create task model TaskInstancePublicationCache crash. Groups not found";
                BackTaskHelper.Error(new[] { arg2 });
                return(null);
            }
            var bulletin = BCT.Context.BulletinDb.Bulletins.Find(arg2.BulletinId);

            if (bulletin != null)
            {
                arg1.Title       = bulletin.Title;
                arg1.Description = bulletin.Description;
                arg1.Price       = bulletin.Price;
                arg1.Images      = bulletin.Images.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None).ToArray();
            }
            else
            {
                arg2.ErrorDescription = "Create task model TaskInstancePublicationCache crash. Bulletin not found";
                BackTaskHelper.Error(new[] { arg2 });
                return(null);
            }
            arg1.InstanceId = arg2.InstanceId.Value;
            return(arg1);
        }
Exemple #3
0
        public override IEnumerable <EntityObject> CustomCollectionLoad(string code, string sessionUID = "", string hashUID = "", IEnumerable <EntityObject> obj = null, IEnumerable <Guid> id = null)
        {
            var result = Enumerable.Empty <EntityObject>();

            BCT.Execute(d =>
            {
                //Пока не заморачивался - передаётся базовый объект и требуется привести к типу
                var entities = Enumerable.Empty <Task>();
                if (obj.Any())
                {
                    entities = obj.Select(q => (Task)q).ToArray();
                }
                switch (code)
                {
                case "All":
                    result = BackTaskHelper.All();
                    break;

                case "Next":
                    result = new Task[] { BackTaskHelper.Next() };
                    break;

                case "Complete":
                    BackTaskHelper.Complite(entities);
                    break;

                case "Erorr":
                    BackTaskHelper.Error(entities);
                    break;

                case "GetTask":
                    result = entities;
                    break;

                default:
                    break;
                }
            });
            return(result);
        }