Ejemplo n.º 1
0
        private void GetTaskSql(string Uid, JObject responseData)
        {
            List <Task>     tasks     = NHibernateHelper.taskManager.GetAll().ToList();
            List <UserTask> userTasks = NHibernateHelper.userTaskManager.GetListByUid(Uid);

            if (tasks.Count != userTasks.Count)
            {
                userTasks.Clear();
                for (int i = 0; i < tasks.Count; i++)
                {
                    Task     task     = tasks[i];
                    UserTask userTask = new UserTask()
                    {
                        isover   = 0,
                        progress = 0,
                        Uid      = Uid,
                        task_id  = task.task_id,
                    };
                    userTasks.Add(userTask);
                    NHibernateHelper.userTaskManager.Add(userTask);
                }
            }

            List <UserTaskJsonObject> userTaskJsonObjects = new List <UserTaskJsonObject>();
            UserTaskJsonObject        userTaskJsonObject;

            for (int i = 0; i < userTasks.Count; i++)
            {
                UserTask userTask = userTasks[i];
                Task     task     = tasks[i];

                if (userTask.task_id == 208 || userTask.task_id == 216 || userTask.task_id == 218)
                {
                    continue;
                }
                userTaskJsonObject         = new UserTaskJsonObject();
                userTaskJsonObject.content = task.content;
                userTaskJsonObject.title   = task.title;
                userTaskJsonObject.reward  = task.reward;
                userTaskJsonObject.target  = task.target;
                userTaskJsonObject.exp     = task.exp;

                userTaskJsonObject.isover   = userTask.isover;
                userTaskJsonObject.progress = userTask.progress;
                userTaskJsonObject.task_id  = userTask.task_id;
                userTaskJsonObjects.Add(userTaskJsonObject);
            }
            OperatorSuccess(userTaskJsonObjects, responseData);
        }
Ejemplo n.º 2
0
        public static void UpdateUserTask(string uid)
        {
            List <Task>     tasks     = NHibernateHelper.taskManager.GetAll().ToList();
            List <UserTask> userTasks = NHibernateHelper.userTaskManager.GetListByUid(uid);

            if (tasks.Count != userTasks.Count)
            {
                userTasks.Clear();
                for (int i = 0; i < tasks.Count; i++)
                {
                    Task     task     = tasks[i];
                    UserTask userTask = new UserTask()
                    {
                        isover   = 0,
                        progress = 0,
                        Uid      = uid,
                        task_id  = task.task_id,
                    };
                    userTasks.Add(userTask);
                    NHibernateHelper.userTaskManager.Add(userTask);
                }
            }
        }