Exemple #1
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 #2
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);
        }