public ActionResult Login(Login model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                MyIdentityUser user = new MyIdentityUser();

                try
                {
                    CustomResponse res = APICalls.Get("AuthenticationAPI/Get?username="******"&password="******"&type=1");
                    if (res.Status == CustomResponseStatus.Successful && res.Response != null)
                    {
                        JavaScriptSerializer serializer1 = new JavaScriptSerializer();
                        serializer1.MaxJsonLength = 1000000000;
                        var uinfo = res.Response.ToString();
                        user = serializer1.Deserialize <MyIdentityUser>(uinfo);
                    }
                }
                catch (System.FormatException ex)
                {
                    return(View());
                }
                if (user.Email != null)
                {
                    IAuthenticationManager authenticationManager = HttpContext.GetOwinContext().Authentication;
                    authenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
                    ClaimsIdentity           identity = userManager.CreateIdentity(user, DefaultAuthenticationTypes.ApplicationCookie);
                    AuthenticationProperties props    = new AuthenticationProperties();
                    props.IsPersistent = model.RememberMe;
                    authenticationManager.SignIn(props, identity);
                    if (Url.IsLocalUrl(returnUrl))
                    {
                        return(Redirect(returnUrl));
                    }
                    else
                    {
                        List <string> roless = userManager.GetRoles(user.Id).ToList();

                        if (roless[0] == "Administrator")
                        {
                            return(RedirectToRoute("DashboardRoute"));
                        }
                        else if (roless[0] == "Client")
                        {
                            return(RedirectToRoute("ClientDashboardRoute"));
                        }
                        else
                        {
                            return(RedirectToRoute("UserDashboardRoute"));
                        }
                    }
                }
                else
                {
                    ModelState.AddModelError("", "Invalid username or password.");
                    return(View());
                }
            }
            return(View(model));
        }
        // GET: Projects
        public ActionResult ListAll()
        {
            CustomResponse res = APICalls.Get("projectsapi/Get?projectid=0&userid=" + User.Identity.GetUserId());

            if (res.Response != null)
            {
                JavaScriptSerializer serializer1 = new JavaScriptSerializer();
                serializer1.MaxJsonLength = 1000000000;
                var uinfo = res.Response.ToString();
                List <ProjectDTO> userinfo = serializer1.Deserialize <List <ProjectDTO> >(uinfo);
                return(View(userinfo));
            }
            return(View());
        }
Beispiel #3
0
        // GET: Dashboard
        public ActionResult Dashboard()
        {
            string               Role = RoleHelper.GetUserRole();
            DashboardModel       objdashboardModel = new DashboardModel();
            JavaScriptSerializer serializer1       = new JavaScriptSerializer();

            CustomResponse ObjActivityData = APICalls.Get("DashboardAPI/Get?Type=3&pageno=0");

            if (ObjActivityData.Status == CustomResponseStatus.Successful && ObjActivityData.Response != null)
            {
                var jsondata = ObjActivityData.Response.ToString();
                objdashboardModel.ActivityDTO = serializer1.Deserialize <List <Trans_TicketDTO> >(jsondata);
            }

            CustomResponse response = APICalls.Get("DashboardAPI/Get?Type=1&pageno=0");

            if (response.Status == CustomResponseStatus.Successful)
            {
                serializer1.MaxJsonLength = 1000000000;
                var projects = response.Response.ToString();
                List <DashBoardStatisticsDTO> dbinfo = serializer1.Deserialize <List <DashBoardStatisticsDTO> >(projects);
                foreach (DashBoardStatisticsDTO ds in dbinfo)
                {
                    if (ds.Type == "1")
                    {
                        objdashboardModel.ProjectsCount = ds.Count;
                    }
                    else if (ds.Type == "2")
                    {
                        objdashboardModel.ClientsCount = ds.Count;
                    }
                    else if (ds.Type == "3")
                    {
                        objdashboardModel.AdminsCount = ds.Count;
                    }
                    else if (ds.Type == "4")
                    {
                        objdashboardModel.UsersCount = ds.Count;
                    }
                }
                CustomResponse objtabledata = APICalls.Get("DashboardAPI/Get?Type=2&pageno=0");
                if (objtabledata.Status == CustomResponseStatus.Successful)
                {
                    var tabledata = objtabledata.Response.ToString();
                    objdashboardModel.TableData = serializer1.Deserialize <List <ProjectTicketUsersDTO> >(tabledata);
                }
                return(View(objdashboardModel));
            }
            return(View());
        }
Beispiel #4
0
        // GET: Dashboard
        public ActionResult Dashboard()
        {
            DashboardModel objdashboardModel = new DashboardModel();
            CustomResponse response          = APICalls.Get("UserDashboardAPI/Get?userid=" + User.Identity.GetUserId() + "&pageno=0");

            if (response.Status == CustomResponseStatus.Successful)
            {
                JavaScriptSerializer serializer1 = new JavaScriptSerializer();
                serializer1.MaxJsonLength = 1000000000;
                var projects            = response.Response.ToString();
                UserDashboardDTO dbinfo = serializer1.Deserialize <UserDashboardDTO>(projects);
                return(View(dbinfo));
            }
            return(View());
        }
Beispiel #5
0
        public JsonResult GetActivitiesByPageNo(int pagenumber)
        {
            CustomResponse response = APICalls.Get("DashboardAPI/Get?type=3&pageno=" + pagenumber);

            if (response.Status == CustomResponseStatus.Successful)
            {
                JavaScriptSerializer serializer1 = new JavaScriptSerializer();
                serializer1.MaxJsonLength = 1000000000;
                var projects = response.Response.ToString();
                return(Json(serializer1.Deserialize <List <Trans_TicketDTO> >(projects), JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(null);
            }
        }
Beispiel #6
0
        public JsonResult GetRecentTickets()
        {
            CustomResponse res     = APICalls.Get("TasksAPI/Get?projectID=0&IDType=1&task_status=0&Task_Type=0&priority=0&userid=" + User.Identity.GetUserId());
            CreateTaskDTO  objTask = new CreateTaskDTO();

            if (res.Response != null)
            {
                JavaScriptSerializer serializer1 = new JavaScriptSerializer();
                serializer1.MaxJsonLength = 1000000000;
                var uinfo = res.Response.ToString();
                return(Json(serializer1.Deserialize <List <TaskDTO> >(uinfo).Take(10), JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(null);
            }
        }
Beispiel #7
0
        public JsonResult GetActivitiesByPageNo(int pagenumber)
        {
            CustomResponse response = APICalls.Get("UserDashboardAPI/Get?userid=" + User.Identity.GetUserId() + "&pageno=" + pagenumber);

            if (response.Status == CustomResponseStatus.Successful)
            {
                JavaScriptSerializer serializer1 = new JavaScriptSerializer();
                serializer1.MaxJsonLength = 1000000000;
                var projects            = response.Response.ToString();
                UserDashboardDTO dbinfo = serializer1.Deserialize <UserDashboardDTO>(projects);
                return(Json(dbinfo.ActivityDTO, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(null);
            }
        }
        public ActionResult EditUser(string id)
        {
            UserDTO        objuserinfo = new UserDTO();
            CustomResponse res         = APICalls.Get("AuthenticationAPI/Get?username="******"&password=0&type=2");

            if (res.Status == CustomResponseStatus.Successful)
            {
                JavaScriptSerializer serializer1 = new JavaScriptSerializer();
                serializer1.MaxJsonLength = 1000000000;
                var uinfo = res.Response.ToString();
                objuserinfo = serializer1.Deserialize <UserDTO>(uinfo);
                return(View(objuserinfo));
            }
            else
            {
                ViewBag.Message = "Failed to Edit User";
                return(RedirectToRoute("UsersHomeRoute", new { Role = "" }));
            }
        }
        private CreateProjectModel FillCreateProjectModel()
        {
            CreateProjectModel    objCreateNewModel = new CreateProjectModel();
            List <SelectListItem> objclients        = new List <SelectListItem>();
            List <SelectListItem> objusers          = new List <SelectListItem>();

            CustomResponse res = APICalls.Get("usersapi/Get?type=4");

            if (res.Response != null)
            {
                JavaScriptSerializer serializer1 = new JavaScriptSerializer();
                serializer1.MaxJsonLength = 1000000000;
                var            uinfo    = res.Response.ToString();
                List <UserDTO> userinfo = serializer1.Deserialize <List <UserDTO> >(uinfo);
                objclients.Add(new SelectListItem {
                    Text = "Select Client", Value = ""
                });
                foreach (UserDTO udto in userinfo)
                {
                    objclients.Add(new SelectListItem {
                        Text = udto.FirstName, Value = udto.Id
                    });
                }
                objCreateNewModel.ClientsDDl = objclients;

                CustomResponse res1 = APICalls.Get("usersapi/Get?type=0");
                uinfo    = res1.Response.ToString();
                userinfo = serializer1.Deserialize <List <UserDTO> >(uinfo);
                //objusers.Add(new SelectListItem { Text = "Select Project Manager", Value = "" });
                foreach (UserDTO udto in userinfo)
                {
                    objusers.Add(new SelectListItem {
                        Text = udto.FirstName, Value = udto.Id
                    });
                }
                objCreateNewModel.UsersList = objusers;
                return(objCreateNewModel);
            }
            else
            {
                return(null);
            }
        }
        public ActionResult ListAll(string Role)
        {
            CustomResponse        res      = APICalls.Get("usersapi/Get?type=" + Role);
            List <SelectListItem> objroles = new List <SelectListItem> {
                new SelectListItem {
                    Text = "Clients", Value = "2"
                }, new SelectListItem {
                    Text = "Developers", Value = "1"
                }, new SelectListItem {
                    Text = "All", Value = "0"
                }, new SelectListItem {
                    Text = "Admins", Value = "3"
                }
            };

            if (Role == "" || Role == null)
            {
                objroles.Find(x => x.Text == "All").Selected = true;
            }
            else
            {
                objroles.Find(x => x.Value == Role.ToString()).Selected = true;
            }
            ViewBag.Roles = objroles;

            if (res.Response != null)
            {
                JavaScriptSerializer serializer1 = new JavaScriptSerializer();
                serializer1.MaxJsonLength = 1000000000;
                var            uinfo    = res.Response.ToString();
                List <UserDTO> userinfo = serializer1.Deserialize <List <UserDTO> >(uinfo);



                return(View(userinfo));
            }

            return(View());
        }
        public JsonResult ChangeProfile()
        {
            MyIdentityUser user        = userManager.FindByName(HttpContext.User.Identity.Name);
            UserDTO        objuserinfo = new UserDTO();
            CustomResponse res         = APICalls.Get("AuthenticationAPI/Get?username="******"&password=0&type=2");

            if (res.Status == CustomResponseStatus.Successful)
            {
                JavaScriptSerializer serializer1 = new JavaScriptSerializer();
                serializer1.MaxJsonLength = 1000000000;
                var uinfo = res.Response.ToString();
                objuserinfo = serializer1.Deserialize <UserDTO>(uinfo);
                return(Json(new CustomResponse {
                    Status = CustomResponseStatus.Successful, Response = objuserinfo, Message = "Profile Updated Successfully"
                }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new CustomResponse {
                    Status = CustomResponseStatus.UnSuccessful, Response = objuserinfo, Message = "Profile Updated Successfully"
                }, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #12
0
 public async Task <IEnumerable <InventoryViewModel> > GetAll() =>
 await APICalls <InventoryViewModel> .Get(InventoryUrl);
        public ActionResult Edit(int ticketid)
        {
            if (TempData["Message"] != null)
            {
                ViewBag.Message = TempData["Message"].ToString();
            }
            CreateTaskDTO         objcreateTask = new CreateTaskDTO();
            List <SelectListItem> ObjDllData    = new List <SelectListItem>();
            List <SelectListItem> ObjDllData1   = new List <SelectListItem>();
            List <SelectListItem> ObjDllData2   = new List <SelectListItem>();
            List <SelectListItem> ObjDllData3   = new List <SelectListItem>();
            List <SelectListItem> ObjDllData4   = new List <SelectListItem>();
            List <SelectListItem> ObjDllData5   = new List <SelectListItem>();

            //get ticket details

            CustomResponse objticketreponse = APICalls.Get("TasksAPI/Get?projectID=" + ticketid + "&task_status=0&Task_Type=0&priority=0&IDType=2&userid=" + User.Identity.GetUserId());
            CreateTaskDTO  objtaskdetails   = new CreateTaskDTO();
            TaskDTO        _taskDTO         = new TaskDTO();

            if (objticketreponse.Response != null)
            {
                JavaScriptSerializer serializer1 = new JavaScriptSerializer();
                serializer1.MaxJsonLength = 1000000000;
                var uinfo = objticketreponse.Response.ToString();
                _taskDTO                       = serializer1.Deserialize <TaskDTO>(uinfo);
                objcreateTask.Title            = _taskDTO.Title;
                objcreateTask.Description      = _taskDTO.Description;
                objcreateTask.TaskDisplayName  = _taskDTO.TaskDisplayName;
                objcreateTask.ProjectID        = _taskDTO.ProjectID;
                objcreateTask.TypeID           = _taskDTO.TypeID;
                objcreateTask.Task_Status      = _taskDTO.Task_Status;
                objcreateTask.RefereedTo       = _taskDTO.RefereedTo;
                objcreateTask.AssignedTo       = _taskDTO.AssignedTo;
                objcreateTask.DueDate          = _taskDTO.DueDate;
                objcreateTask.AssigndedDate    = _taskDTO.AssigndedDate;
                objcreateTask.ID               = _taskDTO.ID;
                objcreateTask.Comments         = _taskDTO.Comments;
                objcreateTask.Attachment1_Name = _taskDTO.Attachment1_Name;
                objcreateTask.Attachment1_Path = _taskDTO.Attachment1_Path;
                objcreateTask.Attachment2_Name = _taskDTO.Attachment2_Name;
                objcreateTask.Attachment2_Path = _taskDTO.Attachment2_Path;
                objcreateTask.Attachment3_Name = _taskDTO.Attachment3_Name;
                objcreateTask.Attachment3_Path = _taskDTO.Attachment3_Path;
            }

            CustomResponse restype1 = APICalls.Get("GenericAPI/Get?type=1");

            if (restype1.Response != null)
            {
                JavaScriptSerializer serializer1 = new JavaScriptSerializer();
                serializer1.MaxJsonLength = 1000000000;
                var uinfo = restype1.Response.ToString();
                List <TypeAndPriorityDTO> objprioroty = serializer1.Deserialize <List <TypeAndPriorityDTO> >(uinfo);

                foreach (TypeAndPriorityDTO objtp in objprioroty)
                {
                    ObjDllData.Add(new SelectListItem {
                        Text = objtp.Name, Value = objtp.ID.ToString()
                    });
                }
                ObjDllData.Find(x => x.Value == _taskDTO.PriorityID.ToString()).Selected = true;
                objcreateTask.PriorityDDL = ObjDllData;


                CustomResponse restype2 = APICalls.Get("GenericAPI/Get?type=2");
                if (restype2.Response != null)
                {
                    var tasktype = restype2.Response.ToString();
                    List <TypeAndPriorityDTO> objtasktype = serializer1.Deserialize <List <TypeAndPriorityDTO> >(tasktype);
                    foreach (TypeAndPriorityDTO objtp in objtasktype)
                    {
                        ObjDllData1.Add(new SelectListItem {
                            Text = objtp.Name, Value = objtp.ID.ToString()
                        });
                    }
                    ObjDllData1.Find(x => x.Value == _taskDTO.TypeID.ToString()).Selected = true;
                    objcreateTask.TypeDDL = ObjDllData1;
                }
                CustomResponse restype3 = APICalls.Get("projectsapi/Get?projectid=0&userid=" + User.Identity.GetUserId());
                if (restype3.Response != null)
                {
                    var projects = restype3.Response.ToString();
                    List <ProjectDTO> projectsinfo = serializer1.Deserialize <List <ProjectDTO> >(projects);
                    foreach (ProjectDTO objtp in projectsinfo)
                    {
                        ObjDllData2.Add(new SelectListItem {
                            Text = objtp.Name, Value = objtp.ID.ToString()
                        });
                    }
                    ObjDllData2.Find(x => x.Value == _taskDTO.ProjectID.ToString()).Selected = true;
                    objcreateTask.ProjectsDDL = ObjDllData2;
                }

                CustomResponse restype4 = APICalls.Get("UsersAPI/Get?type=1");
                if (restype4.Response != null)
                {
                    var            assignees = restype4.Response.ToString();
                    List <UserDTO> usersdto  = serializer1.Deserialize <List <UserDTO> >(assignees);
                    foreach (UserDTO objuser in usersdto)
                    {
                        ObjDllData3.Add(new SelectListItem {
                            Text = objuser.FirstName, Value = objuser.Id.ToString()
                        });
                    }
                    ObjDllData3.Find(x => x.Value == _taskDTO.AssignedTo.ToString()).Selected = true;
                    objcreateTask.AssignTODDL = ObjDllData3;
                }

                CustomResponse restype5 = APICalls.Get("UsersAPI/Get?type=0");
                if (restype5.Response != null)
                {
                    var            referer   = restype5.Response.ToString();
                    List <UserDTO> usersdto1 = serializer1.Deserialize <List <UserDTO> >(referer);
                    foreach (UserDTO objuser in usersdto1)
                    {
                        ObjDllData4.Add(new SelectListItem {
                            Text = objuser.FirstName, Value = objuser.Id.ToString()
                        });
                    }
                    //ObjDllData4.Find(x => x.Value == _taskDTO.RefereedTo.ToString()).Selected = true;
                    objcreateTask.RefereerToDDL = ObjDllData4;
                }
                CustomResponse restype6 = APICalls.Get("GenericAPI/Get?type=3");
                if (restype6.Response != null)
                {
                    var tasktype1 = restype6.Response.ToString();
                    List <TypeAndPriorityDTO> objtasktype1 = serializer1.Deserialize <List <TypeAndPriorityDTO> >(tasktype1);
                    foreach (TypeAndPriorityDTO objtp in objtasktype1)
                    {
                        ObjDllData5.Add(new SelectListItem {
                            Text = objtp.Name, Value = objtp.ID.ToString()
                        });
                    }
                    //ObjDllData5.Find(x => x.Value == _taskDTO.Task_Status.ToString()).Selected = true;
                    objcreateTask.TaskStatusDDl = ObjDllData5;
                }
            }
            return(View(objcreateTask));
        }
        public ActionResult Edit(int projectid)
        {
            if (TempData["Message"] != null)
            {
                ViewBag.Message = TempData["Message"].ToString();
            }
            CreateProjectModel    objEditProjectModel = new CreateProjectModel();
            List <SelectListItem> objclients          = new List <SelectListItem>();
            List <SelectListItem> objPms   = new List <SelectListItem>();
            List <SelectListItem> objusers = new List <SelectListItem>();


            //get project details
            CustomResponse   objticketreponse  = APICalls.Get("projectsapi/Get?userid=" + User.Identity.GetUserId() + "&projectid=" + projectid);
            CreateProjectDTO objprojectdetails = new CreateProjectDTO();
            ProjectDTO       _projectDTO       = new ProjectDTO();

            if (objticketreponse.Response != null)
            {
                JavaScriptSerializer serializer1 = new JavaScriptSerializer();
                serializer1.MaxJsonLength = 1000000000;
                var uinfo = objticketreponse.Response.ToString();
                _projectDTO = serializer1.Deserialize <ProjectDTO>(uinfo);
                objEditProjectModel.Name            = _projectDTO.Name;
                objEditProjectModel.Description     = _projectDTO.Description;
                objEditProjectModel.ID              = _projectDTO.ID;
                objEditProjectModel.PManagerID      = _projectDTO.PManagerID;
                objEditProjectModel.ClientID        = _projectDTO.ClientID;
                objEditProjectModel.Duration        = _projectDTO.Duration;
                objEditProjectModel.ProposedEndDate = _projectDTO.ProposedEndDate;
                objEditProjectModel.SignUpDate      = _projectDTO.SignUpDate;
                objEditProjectModel.StartDate       = _projectDTO.StartDate;
                objEditProjectModel.Status          = _projectDTO.Status;
                objEditProjectModel.ShortName       = _projectDTO.ShortName;
            }


            CustomResponse res = APICalls.Get("usersapi/Get?type=4");

            if (res.Response != null)
            {
                JavaScriptSerializer serializer1 = new JavaScriptSerializer();
                serializer1.MaxJsonLength = 1000000000;
                var            uinfo    = res.Response.ToString();
                List <UserDTO> userinfo = serializer1.Deserialize <List <UserDTO> >(uinfo);

                foreach (UserDTO udto in userinfo)
                {
                    objclients.Add(new SelectListItem {
                        Text = udto.Email, Value = udto.Id
                    });
                    objPms.Add(new SelectListItem {
                        Text = udto.Email, Value = udto.Id
                    });
                }
                objclients.Find(x => x.Value == _projectDTO.ClientID).Selected = true;
                objEditProjectModel.ClientsDDl = objclients;

                objPms.Find(x => x.Value == _projectDTO.PManagerID).Selected = true;
                objEditProjectModel.ProjectManagerDDl = objPms;
                CustomResponse res1 = APICalls.Get("usersapi/Get?type=0");
                uinfo    = res1.Response.ToString();
                userinfo = serializer1.Deserialize <List <UserDTO> >(uinfo);
                foreach (UserDTO udto in userinfo)
                {
                    objusers.Add(new SelectListItem {
                        Text = udto.Email, Value = udto.Id
                    });
                }
                foreach (string user in _projectDTO.ProjectUsers)
                {
                    //objusers.Add(new SelectListItem { Text = udto.Email, Value = udto.Id });
                    foreach (SelectListItem y in objusers)
                    {
                        if (y.Value == user)
                        {
                            objusers.Find(x => x.Value == user).Selected = true;
                        }
                    }
                    objEditProjectModel.UserIds = objEditProjectModel.UserIds + '#' + user;
                }

                objEditProjectModel.UserIds.Trim('#');
                objEditProjectModel.UsersList = objusers;
                return(View(objEditProjectModel));
            }
            return(View());
        }
        public CreateTaskDTO FillTaskDropDowns(int ProjectID, int task_status, int task_Type, int priority)
        {
            CustomResponse res     = APICalls.Get("TasksAPI/Get?ProjectID=" + ProjectID + "&IDType=1&userid=" + User.Identity.GetUserId() + "&task_status=" + task_status + "&Task_Type=" + task_Type + "&priority=" + priority);
            CreateTaskDTO  objTask = new CreateTaskDTO();

            if (res.Response != null)
            {
                JavaScriptSerializer serializer1 = new JavaScriptSerializer();
                serializer1.MaxJsonLength = 1000000000;
                var uinfo = res.Response.ToString();
                objTask.TasksDTO = serializer1.Deserialize <List <TaskDTO> >(uinfo);
                CustomResponse response = APICalls.Get("projectsapi/Get?projectid=0&userid=" + User.Identity.GetUserId());
                if (response.Response != null)
                {
                    var projects = response.Response.ToString();
                    List <ProjectDTO>     projectsinfo = serializer1.Deserialize <List <ProjectDTO> >(projects);
                    List <SelectListItem> objprojects  = new List <SelectListItem>();
                    foreach (ProjectDTO pdto in projectsinfo)
                    {
                        objprojects.Add(new SelectListItem {
                            Text = pdto.Name, Value = pdto.ID.ToString()
                        });
                    }
                    if (ProjectID == 0)
                    {
                        objprojects.Insert(0, new SelectListItem {
                            Text = "All", Value = "0", Selected = true
                        });
                    }
                    else
                    {
                        objprojects.Insert(0, new SelectListItem {
                            Text = "All", Value = "0", Selected = true
                        });
                        objprojects.Find(x => x.Value == ProjectID.ToString()).Selected = true;
                    }

                    List <SelectListItem> objtasktypedata    = new List <SelectListItem>();
                    List <SelectListItem> objtaskstatusdata  = new List <SelectListItem>();
                    List <SelectListItem> objtaskstatusdata2 = new List <SelectListItem>();


                    CustomResponse restype6 = APICalls.Get("GenericAPI/Get?type=1");
                    if (restype6.Response != null)
                    {
                        var tasktype1 = restype6.Response.ToString();
                        List <TypeAndPriorityDTO> objtasktype1 = serializer1.Deserialize <List <TypeAndPriorityDTO> >(tasktype1);

                        foreach (TypeAndPriorityDTO objtp in objtasktype1)
                        {
                            objtaskstatusdata2.Add(new SelectListItem {
                                Text = objtp.Name, Value = objtp.ID.ToString()
                            });
                        }
                        if (priority == 0)
                        {
                            objtaskstatusdata2.Insert(0, new SelectListItem {
                                Text = "All", Value = "0", Selected = true
                            });
                        }
                        else
                        {
                            objtaskstatusdata2.Insert(0, new SelectListItem {
                                Text = "All", Value = "0", Selected = true
                            });
                            objtaskstatusdata2.Find(x => x.Value == priority.ToString()).Selected = true;
                        }
                        objTask.PriorityDDL = objtaskstatusdata2;
                    }

                    CustomResponse restype2 = APICalls.Get("GenericAPI/Get?type=2");
                    if (restype2.Response != null)
                    {
                        var tasktype = restype2.Response.ToString();
                        List <TypeAndPriorityDTO> objtasktype = serializer1.Deserialize <List <TypeAndPriorityDTO> >(tasktype);

                        foreach (TypeAndPriorityDTO objtp in objtasktype)
                        {
                            objtasktypedata.Add(new SelectListItem {
                                Text = objtp.Name, Value = objtp.ID.ToString()
                            });
                        }
                        if (task_Type == 0)
                        {
                            objtasktypedata.Insert(0, new SelectListItem {
                                Text = "All", Value = "0", Selected = true
                            });
                        }
                        else
                        {
                            objtasktypedata.Insert(0, new SelectListItem {
                                Text = "All", Value = "0", Selected = true
                            });
                            objtasktypedata.Find(x => x.Value == task_Type.ToString()).Selected = true;
                        }
                        objTask.TypeDDL = objtasktypedata;
                    }
                    CustomResponse restype7 = APICalls.Get("GenericAPI/Get?type=3");
                    if (restype7.Response != null)
                    {
                        var tasktype1 = restype7.Response.ToString();
                        List <TypeAndPriorityDTO> objtasktype1 = serializer1.Deserialize <List <TypeAndPriorityDTO> >(tasktype1);

                        foreach (TypeAndPriorityDTO objtp in objtasktype1)
                        {
                            objtaskstatusdata.Add(new SelectListItem {
                                Text = objtp.Name, Value = objtp.ID.ToString()
                            });
                        }
                        if (task_status == 0)
                        {
                            objtaskstatusdata.Insert(0, new SelectListItem {
                                Text = "All", Value = "0", Selected = true
                            });
                        }
                        else
                        {
                            objtaskstatusdata.Insert(0, new SelectListItem {
                                Text = "All", Value = "0", Selected = true
                            });
                            objtaskstatusdata.Find(x => x.Value == task_status.ToString()).Selected = true;
                        }
                        objTask.TaskStatusDDl = objtaskstatusdata;
                    }



                    objTask.ProjectsDDL = objprojects;

                    return(objTask);
                }
                return(null);
            }

            return(null);
        }
Beispiel #16
0
 public async Task <InventoryViewModel> Get(int id) =>
 await APICalls <InventoryViewModel> .Get(InventoryUrl, id);
 public async Task <IEnumerable <MachineViewModel> > GetAll() => await APICalls <MachineViewModel> .Get(MachinesUrl);
        public ReportsModel BindReportData()
        {
            ReportsModel objreport = new ReportsModel();

            objreport.ReportData = new List <ReportData>();
            List <SelectListItem> objtasktypedata   = new List <SelectListItem>();
            List <SelectListItem> objtaskstatusdata = new List <SelectListItem>();
            CustomResponse        response          = APICalls.Get("usersapi/Get?type=1");
            JavaScriptSerializer  serializer1       = new JavaScriptSerializer();

            if (response.Response != null)
            {
                var                   projects     = response.Response.ToString();
                List <UserDTO>        projectsinfo = serializer1.Deserialize <List <UserDTO> >(projects);
                List <SelectListItem> objprojects  = new List <SelectListItem>();
                foreach (UserDTO pdto in projectsinfo)
                {
                    objprojects.Add(new SelectListItem {
                        Text = pdto.FirstName, Value = pdto.Id.ToString()
                    });
                }
                objprojects.Add(new SelectListItem {
                    Text = "All", Value = "0"
                });
                objreport.ProjectsDDl = objprojects;
            }
            CustomResponse restype2 = APICalls.Get("GenericAPI/Get?type=2");

            if (restype2.Response != null)
            {
                var tasktype = restype2.Response.ToString();
                List <TypeAndPriorityDTO> objtasktype = serializer1.Deserialize <List <TypeAndPriorityDTO> >(tasktype);
                foreach (TypeAndPriorityDTO objtp in objtasktype)
                {
                    objtasktypedata.Add(new SelectListItem {
                        Text = objtp.Name, Value = objtp.ID.ToString()
                    });
                }
                objtasktypedata.Add(new SelectListItem {
                    Text = "All", Value = "0"
                });
                objreport.TaskTypeDDl = objtasktypedata;
            }
            CustomResponse restype6 = APICalls.Get("GenericAPI/Get?type=3");

            if (restype6.Response != null)
            {
                var tasktype1 = restype6.Response.ToString();
                List <TypeAndPriorityDTO> objtasktype1 = serializer1.Deserialize <List <TypeAndPriorityDTO> >(tasktype1);
                foreach (TypeAndPriorityDTO objtp in objtasktype1)
                {
                    objtaskstatusdata.Add(new SelectListItem {
                        Text = objtp.Name, Value = objtp.ID.ToString()
                    });
                }
                objtaskstatusdata.Add(new SelectListItem {
                    Text = "All", Value = "0"
                });
                objreport.TaskStatusDDl = objtaskstatusdata;
            }
            return(objreport);
        }
        private CreateTaskDTO FillCreateTaskDropdowns()

        {
            CreateTaskDTO         objcreateTask = new CreateTaskDTO();
            List <SelectListItem> ObjDllData    = new List <SelectListItem>();
            List <SelectListItem> ObjDllData1   = new List <SelectListItem>();
            List <SelectListItem> ObjDllData2   = new List <SelectListItem>();
            List <SelectListItem> ObjDllData3   = new List <SelectListItem>();
            List <SelectListItem> ObjDllData4   = new List <SelectListItem>();
            List <SelectListItem> ObjDllData5   = new List <SelectListItem>();
            CustomResponse        restype1      = APICalls.Get("GenericAPI/Get?type=1");

            if (restype1.Response != null)
            {
                JavaScriptSerializer serializer1 = new JavaScriptSerializer();
                serializer1.MaxJsonLength = 1000000000;
                var uinfo = restype1.Response.ToString();
                List <TypeAndPriorityDTO> objprioroty = serializer1.Deserialize <List <TypeAndPriorityDTO> >(uinfo);
                ObjDllData.Add(new SelectListItem {
                    Text = "Select Priority", Value = ""
                });
                foreach (TypeAndPriorityDTO objtp in objprioroty)
                {
                    ObjDllData.Add(new SelectListItem {
                        Text = objtp.Name, Value = objtp.ID.ToString()
                    });
                }
                objcreateTask.PriorityDDL = ObjDllData;


                CustomResponse restype2 = APICalls.Get("GenericAPI/Get?type=2");
                if (restype2.Response != null)
                {
                    var tasktype = restype2.Response.ToString();
                    List <TypeAndPriorityDTO> objtasktype = serializer1.Deserialize <List <TypeAndPriorityDTO> >(tasktype);
                    ObjDllData1.Add(new SelectListItem {
                        Text = "Select User", Value = ""
                    });
                    foreach (TypeAndPriorityDTO objtp in objtasktype)
                    {
                        ObjDllData1.Add(new SelectListItem {
                            Text = objtp.Name, Value = objtp.ID.ToString()
                        });
                    }
                    objcreateTask.TypeDDL = ObjDllData1;
                }
                CustomResponse restype3 = APICalls.Get("projectsapi/Get?projectid=0&userid=" + User.Identity.GetUserId());
                if (restype3.Response != null)
                {
                    var projects = restype3.Response.ToString();
                    List <ProjectDTO> projectsinfo = serializer1.Deserialize <List <ProjectDTO> >(projects);
                    ObjDllData2.Add(new SelectListItem {
                        Text = "Select User", Value = ""
                    });
                    foreach (ProjectDTO objtp in projectsinfo)
                    {
                        ObjDllData2.Add(new SelectListItem {
                            Text = objtp.Name, Value = objtp.ID.ToString()
                        });
                    }
                    objcreateTask.ProjectsDDL = ObjDllData2;
                }

                CustomResponse restype4 = APICalls.Get("UsersAPI/Get?type=1");
                if (restype4.Response != null)
                {
                    var            assignees = restype4.Response.ToString();
                    List <UserDTO> usersdto  = serializer1.Deserialize <List <UserDTO> >(assignees);
                    ObjDllData3.Add(new SelectListItem {
                        Text = "Select User", Value = ""
                    });
                    foreach (UserDTO objuser in usersdto)
                    {
                        ObjDllData3.Add(new SelectListItem {
                            Text = objuser.FirstName, Value = objuser.Id.ToString()
                        });
                    }
                    objcreateTask.AssignTODDL = ObjDllData3;
                }

                CustomResponse restype5 = APICalls.Get("UsersAPI/Get?type=0");
                if (restype5.Response != null)
                {
                    var            referer   = restype5.Response.ToString();
                    List <UserDTO> usersdto1 = serializer1.Deserialize <List <UserDTO> >(referer);
                    ObjDllData4.Add(new SelectListItem {
                        Text = "Select User", Value = ""
                    });
                    foreach (UserDTO objuser in usersdto1)
                    {
                        ObjDllData4.Add(new SelectListItem {
                            Text = objuser.FirstName, Value = objuser.Id.ToString()
                        });
                    }
                    objcreateTask.RefereerToDDL = ObjDllData4;
                }
                CustomResponse restype6 = APICalls.Get("GenericAPI/Get?type=3");
                if (restype6.Response != null)
                {
                    var tasktype1 = restype6.Response.ToString();
                    List <TypeAndPriorityDTO> objtasktype1 = serializer1.Deserialize <List <TypeAndPriorityDTO> >(tasktype1);
                    ObjDllData5.Add(new SelectListItem {
                        Text = "Select TaskStatus", Value = ""
                    });
                    foreach (TypeAndPriorityDTO objtp in objtasktype1)
                    {
                        ObjDllData5.Add(new SelectListItem {
                            Text = objtp.Name, Value = objtp.ID.ToString()
                        });
                    }
                    objcreateTask.TaskStatusDDl = ObjDllData5;
                }
            }

            return(objcreateTask);
        }