コード例 #1
0
        public JsonResult json_saveUserSequence()
        {
            var pars    = Request.Params;
            int task_id = Convert.ToInt32(pars["task_id"]);

            string[] person_ids = pars["taskUsersSequence"].Split(',');


            using (Themes.Models.prjEntities ctx = new Themes.Models.prjEntities())
            {
                foreach (var item in person_ids)
                {
                    Themes.Models.task_person tp = new Themes.Models.task_person()
                    {
                        task_id             = task_id,
                        person_id           = Convert.ToInt32(item),
                        user_task_status_id = 1 /*Not Started*/
                    };
                    ctx.task_person.AddObject(tp);
                    ctx.SaveChanges();
                }
            }

            return(Json(new { result = "done" }, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public JsonResult json_saveNewTask()
        {
            var    pars             = Request.Params;
            string task_title       = pars["Task_title"];
            string task_description = pars["Task_description"];
            string task_deadline    = pars["task_deadline"];
            string filenames        = pars["filenames"];


            using (Themes.Models.prjEntities ctx = new Themes.Models.prjEntities())
            {
                Themes.Models.task newTask = new Themes.Models.task()
                {
                    title          = task_title,
                    description    = task_description,
                    task_status_id = 2,/*Progressing*/
                    stamp          = DateTime.Now,
                    is_active      = true
                };
                ctx.task.AddObject(newTask);
                ctx.SaveChanges();
            }

            //(2) add document objects for Task


            return(Json(new { result = "done" }, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        //Adds new descriptive content for specific task person
        public JsonResult json_saveNewTaskStat()
        {
            var pars = Request.Params;

            int    task_id     = Convert.ToInt32(pars["task_id"]);
            string description = pars["description"];

            var curUser   = Session["user"];
            int person_id = Convert.ToInt32(((Themes.Models.user)curUser).person_id);

            int task_person_id = this.getCurTaskPerson(task_id, person_id).First().task_person_id;

            using (Themes.Models.prjEntities ctx = new Themes.Models.prjEntities())
            {
                var newTaskProgress = new Themes.Models.tp_progress()
                {
                    t_p_id      = task_person_id,
                    description = description,
                    datetime    = DateTime.Now
                };

                ctx.tp_progress.AddObject(newTaskProgress);
                ctx.SaveChanges();
            }

            return(Json(new { result = "done" }, JsonRequestBehavior.AllowGet));
        }
コード例 #4
0
        //update timer
        public JsonResult json_updateTaskProgress()
        {
            var pars    = Request.Params;
            int task_id = Convert.ToInt32(pars["task_id"]);

            var curUser   = Session["user"];
            int person_id = Convert.ToInt32(((Themes.Models.user)curUser).person_id);

            int task_person_id = this.getCurTaskPerson(task_id, person_id).First().task_person_id;

            using (Themes.Models.prjEntities ctx = new Themes.Models.prjEntities())
            {
                var cur_task_person =
                    (
                        from tp in ctx.task_person
                        where tp.task_person_id == task_person_id
                        select tp
                    ).First();


                /* First check if there is any open timer then update end_timestamp else create new with open end_timestamp */
                var q =
                    (
                        from tpt in ctx.tp_timer
                        where
                        tpt.task_person.task_person_id == task_person_id &&
                        tpt.task_person.user_task_status_id != 3 &&/*Not Finalized*/
                        tpt.end_stamp == null    /*open timer*/
                        select tpt
                    );
                if (q.Count() != 0)
                {
                    q.First().end_stamp = DateTime.Now;
                    q.First().is_commited = true;
                    q.First().task_person.user_task_status_id = 2 /*Progressing*/;
                    ctx.SaveChanges();
                }
                else
                {
                    var newTimer = new Themes.Models.tp_timer()
                    {
                        t_p_id      = task_person_id,
                        start_stamp = DateTime.Now,
                        end_stamp   = null,
                        is_commited = false
                    };

                    ctx.tp_timer.AddObject(newTimer);
                    ctx.SaveChanges();
                }
            }

            //return back current timer status after operation
            return(Json(new { result = this.getTaskPersontimerStat(task_id, person_id) }, JsonRequestBehavior.AllowGet));
        }
コード例 #5
0
        //get Existing office List
        public IEnumerable<object> getExistingOffices()
        {
            Themes.Models.prjEntities ctx = new Themes.Models.prjEntities();

            var Q =
            (
                from r in ctx.organization
                select r
            );
            return Q;
        }
コード例 #6
0
        //get list of specific task progress history
        public IEnumerable<dynamic> getCurUserTimeTrackerHistory(int task_id, int person_id)
        {
            Themes.Models.prjEntities ctx = new Themes.Models.prjEntities();

            var Q =
            (
                from tp in ctx.tp_progress

                where tp.task_person.task_id == task_id
                orderby tp.t_p_p_id descending

                select tp

            );
            return Q;
        }
コード例 #7
0
        //check wheter or not the current use has turn in this specific task
        public IEnumerable<Themes.Models.task_person> getCurTaskPerson(int task_id, int person_id)
        {
            Themes.Models.prjEntities ctx = new Themes.Models.prjEntities();

            var Q =
            (
                from tp in ctx.task_person

                where   tp.task_id == task_id
                        && tp.person_id==person_id
                        && tp.user_task_status_id!=3 /*NOT (finalized)*/
                orderby tp.task_person_id ascending
                select tp
            );
            return Q;
        }
コード例 #8
0
        //if tjhere is any open timer close it . and finalu task_person obect goes to finalize stat
        public JsonResult json_finalizeTaskPerson()
        {
            var pars = Request.Params;

            int task_id   = Convert.ToInt32(pars["task_id"]);
            var curUser   = Session["user"];
            int person_id = Convert.ToInt32(((Themes.Models.user)curUser).person_id);

            using (Themes.Models.prjEntities ctx = new Themes.Models.prjEntities())
            {
                var cur_task_person =
                    (
                        from tp in ctx.task_person

                        where tp.task_id == task_id && tp.user_task_status_id != 3 /*NOT (finalized)*/
                        orderby tp.task_person_id ascending
                        select tp
                    ).First();



                if (this.getTaskPersontimerStat(task_id, person_id) == "pause")   //timer open
                {
                    //close timer
                    var open_time_task_person = (
                        from tpt in ctx.tp_timer
                        where
                        tpt.task_person.task_person_id == cur_task_person.task_person_id &&
                        tpt.task_person.user_task_status_id == 2 &&    /*Progressing*/
                        tpt.end_stamp == null        /*open timer*/
                        select tpt
                        ).First();
                    open_time_task_person.end_stamp = DateTime.Now;
                }
                //finally finalize task person
                cur_task_person.user_task_status_id = 3;
                ctx.SaveChanges();
            }

            return(Json(new { result = "done" }, JsonRequestBehavior.AllowGet));
        }
コード例 #9
0
        //get User by OfficeId
        public IEnumerable<object> getExistingOfficeUsers(int org_id)
        {
            Themes.Models.prjEntities ctx = new Themes.Models.prjEntities();

            var Q =
            (
                from p in ctx.person
                join po in ctx.person_org on p.person_id equals po.person_id into joint
                from leftjoint in joint
                where leftjoint.org_id == org_id
                select new
                {
                    person_id = p.person_id,
                    fname = p.fname,
                    lname = p.lname,
                    thumbnail = "/resources/components/workflow1/task/assignment/images/user.png"
                }
            );
            return Q;
        }