Exemple #1
0
        public ManageTaskResponse TaskAssign(ManageTaskRequest request)
        {
            ManageTaskResponse response = new ManageTaskResponse();

            //int? empId = AdapterHelper.GetEmployeeId(request.EmployeeName, request.Email);
            //if (!empId.HasValue)
            //    throw new Exception("Employee does not exist!");
            List <Task_table> task = new List <Task_table>();
            List <task>       list = new List <task>();

            using (var context = new Company_dbEntities())
            {
                task = (from a in context.Task_table where a.AssignedBy == request.UserName select a).ToList();

                if (task != null)
                {
                    foreach (var entry in task)
                    {
                        task t = new task();

                        t.EmployeeID      = entry.EmployeeID;
                        t.EmployeeName    = entry.EmployeeName;
                        t.Description     = entry.Description;
                        t.EmployeeConfirm = entry.EmployeeConfirm;
                        t.ManagerConfirm  = entry.ManagerConfirm;

                        list.Add(t);
                    }
                    response.TaskAssign = JsonConvert.SerializeObject(list);
                }
                else
                {
                    response.TaskAssign = null;
                }
            }
            return(response);
        }
        public ManageTaskResponse TaskAssign(ManageTaskRequest request)
        {
            ManageTaskResponse response = new ManageTaskResponse();

            //int? empId = AdapterHelper.GetEmployeeId(request.EmployeeName, request.Email);
            //if (!empId.HasValue)
            //    throw new Exception("Employee does not exist!");
            List<Task_table> task = new List<Task_table>();
            List<task> list = new List<task>();
            using (var context = new Company_dbEntities())
            {
                task = (from a in context.Task_table where a.AssignedBy == request.UserName select a).ToList();

                if(task != null)
                {
                    foreach(var entry in task)
                    {
                        task t = new task();

                        t.EmployeeID = entry.EmployeeID;
                        t.EmployeeName = entry.EmployeeName;
                        t.Description = entry.Description;
                        t.EmployeeConfirm = entry.EmployeeConfirm;
                        t.ManagerConfirm = entry.ManagerConfirm;

                        list.Add(t);
                    }
                    response.TaskAssign = JsonConvert.SerializeObject(list);
                }
                else
                {
                    response.TaskAssign = null;
                }

            }
            return response;
        }