Esempio n. 1
0
        public ActionResult SaveChecked(ChecklistChecked chlist)
        {
            var checkedItem = new CheckedItem();

            var item = _itemService.GetCheckListItemById(chlist.ID);

            if (item == null)
            {
                return(JsonResponse.GetJsonResult(JsonResponse.ERROR_RESPONSE, item));
            }

            var user = _userService.GetUserById(chlist.IDUser);

            if (user == null)
            {
                return(JsonResponse.GetJsonResult(JsonResponse.ERROR_RESPONSE, user));
            }

            checkedItem.CheckListItem = item;
            checkedItem.User          = user;

            _checkedItemService.UpdateCheckedItem(checkedItem);
            _checkedItemService.SaveCheckedItem();

            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, "OK"));
        }
Esempio n. 2
0
        public ActionResult GetById(int id)
        {
            var user      = _userService.GetUserById(id);
            var userModel = Mapper.Map <Model.User, Models.User>(user);

            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, userModel));
        }
Esempio n. 3
0
        public async Task <JsonResult> SendNewUserInProjectMail(UsersProject usersProject, int projectID, string language = "nl")
        {
            var user = _userService.GetUserById(usersProject.IDuser);

            if (user == null)
            {
                return(JsonResponse.GetJsonResult(JsonResponse.ERROR_RESPONSE, user));
            }

            var tender = _tenderService.GetTenderById(projectID);

            if (tender == null)
            {
                return(JsonResponse.GetJsonResult(JsonResponse.ERROR_RESPONSE, tender));
            }

            var userTender = Mapper.Map <UsersProject, UserTender>(usersProject);

            userTender.User   = user;
            userTender.Tender = tender;

            _userTenderService.CreateUserTender(userTender);
            _userTenderService.SaveUserTender();

            var model = Mapper.Map <UserTender, UsersProject>(userTender);

            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, model));
        }
Esempio n. 4
0
        public ActionResult UploadFrontImage(HttpPostedFileBase file)
        {
            string tempFileName = "";
            string path         = "~/UPLOADED_IMAGES/frontImage/";
            string fullFile     = Server.MapPath(path + file.FileName);
            string FullFilePath = "";

            //---- deleting previous images

            System.IO.DirectoryInfo di = new DirectoryInfo(Server.MapPath(path));
            foreach (FileInfo filee in di.GetFiles())
            {
                filee.Delete();
            }

            //---- / deleting previous images

            string fileNameOnly = "IGGtenderportal";
            string extension    = Path.GetExtension(file.FileName);

            FullFilePath = Server.MapPath(path + fileNameOnly + extension);
            string targetPath = FullFilePath;//  folder + "/" + fileName;

            file.SaveAs(targetPath);
            // return "FILE_UPLOADED_SUCESFULLY";
            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, new { name = tempFileName, size = file.ContentLength }));
        }
Esempio n. 5
0
        public ActionResult GetAll()
        {
            var users      = _userService.GetUsers();
            var userModels = Mapper.Map <IEnumerable <Model.User>, IEnumerable <Models.User> >(users);

            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, userModels));
        }
Esempio n. 6
0
        public ActionResult GetForProject(int id)
        {
            var checkListItems = _itemService.GetCheckListItems(id);
            var checklists     = Mapper.Map <IEnumerable <CheckListItem>, IEnumerable <Models.Checklist> >(checkListItems);

            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, checklists));
        }
Esempio n. 7
0
        public ActionResult UploadFile(HttpPostedFileBase file, string username)
        {
            int    count        = 1;
            string tempFileName = "";
            string path         = "~/UPLOADED_IMAGES/users/";
            string fullFile     = Server.MapPath(path + file.FileName);
            string FullFilePath = "";

            if (!System.IO.File.Exists(fullFile))
            {
                FullFilePath = fullFile;
                tempFileName = file.FileName;
            }
            else
            {
                string fileNameOnly = Path.GetFileNameWithoutExtension(file.FileName);
                string extension    = Path.GetExtension(file.FileName);
                FullFilePath = Server.MapPath(path + fileNameOnly + "(" + count + ")" + extension);
                while (System.IO.File.Exists(FullFilePath))
                {
                    tempFileName = fileNameOnly + "(" + count + ")" + extension;
                    FullFilePath = Server.MapPath(Path.Combine(path, tempFileName));
                    count++;
                }
            }

            string fileName = file.FileName;

            fileName = fileName.Replace(" ", "_");
            string targetPath = FullFilePath;//  folder + "/" + fileName;

            file.SaveAs(targetPath);
            // return "FILE_UPLOADED_SUCESFULLY";
            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, new { name = tempFileName, size = file.ContentLength }));
        }
Esempio n. 8
0
        public ActionResult GetByID(int ID)
        {
            var tender  = _tenderService.GetTenderById(ID);
            var project = Mapper.Map <Tender, Project>(tender);

            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, project));
        }
Esempio n. 9
0
        public ActionResult Delete(string path)
        {
            string targetPath = Server.MapPath("~/" + path);

            System.IO.File.Delete(targetPath);
            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, "FILE DELETED"));
        }
Esempio n. 10
0
        public ActionResult DeleteProjectFile(ProjectFile projf)
        {
            string filePath = Server.MapPath("~/UPLOADED_FILES/projects/" + projf.file);

            System.IO.File.Delete(filePath);

            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, projf));
        }
Esempio n. 11
0
        public ActionResult Delete(Project proj)
        {
            var tender = _tenderService.GetTenderById(proj.ID);

            _tenderService.RemoveTender(tender);

            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, proj));
        }
Esempio n. 12
0
        public ActionResult Delete(int userId)
        {
            var user = _userService.GetUserById(userId);

            _userService.RemoveUser(user);
            _userService.SaveUser();
            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, userId));
        }
Esempio n. 13
0
        public ActionResult DeleteUserProject(Models.UsersProject userProject)
        {
            var userTender = _userTenderService.GetUserTenderById(userProject.ID);

            _userTenderService.RemoveUserTender(userTender);
            _userTenderService.SaveUserTender();
            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, userProject));
        }
Esempio n. 14
0
        public ActionResult Get(int page, int pagesize)
        {
            var users = _userService.GetUsers()
                        .Skip((page - 1) * pagesize)
                        .Take(pagesize);
            var modelUsers = Mapper.Map <IEnumerable <Model.User>, IEnumerable <Models.User> >(users);

            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, modelUsers));
        }
Esempio n. 15
0
        public ActionResult SaveAll(List <Models.User> list)
        {
            foreach (var userModel in list)
            {
                UpdateUser(userModel);
            }
            ;

            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, list));
        }
Esempio n. 16
0
        public ActionResult GetFrontImage()
        {
            string        path     = "~/UPLOADED_IMAGES/frontImage/";
            string        fullFile = Server.MapPath(path);
            DirectoryInfo d        = new DirectoryInfo(fullFile);

            FileInfo[] Files = d.GetFiles();

            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, new { name = Files[0].Name }));
        }
Esempio n. 17
0
        public async Task <ActionResult> Close(Project proj)
        {
            var tender = _tenderService.GetTenderById(proj.ID);

            tender.Status = TenderStatus.CLOSE;
            _tenderService.UpdateTender(tender);
            _tenderService.SaveTender();

            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, proj));
        }
Esempio n. 18
0
        public ActionResult GetMyAccount()
        {
            //TODO
            var userId = User.Identity.GetUserId();
            //var applicationUser = _userManager.FindByIdAsync(userId).GetAwaiter().GetResult();

            var user      = _userService.GetUserByGuid("5b0dc357-253b-4a92-97e8-d8d49a3e7b60");
            var modelUser = Mapper.Map <Model.User, Models.User>(user);

            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, modelUser));
        }
Esempio n. 19
0
        public ActionResult GetSorted(int page, int pagesize, string column, bool desc)
        {
            //TODO: implement order by column and desc
            var users = _userService.GetUsers().OrderByDescending(x => x.Name)
                        .Skip((page - 1) * pagesize)
                        .Take(pagesize);

            var modelUsers = Mapper.Map <IEnumerable <Model.User>, IEnumerable <Models.User> >(users);

            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, modelUsers));
        }
Esempio n. 20
0
        public ActionResult Search(string keyword)
        {
            var users = _userService.GetUsers()
                        .Where(t => t.Name.Contains(keyword) ||
                               t.Surname.Contains(keyword) ||
                               t.CompanyName.Contains(keyword))
                        .OrderByDescending(t => t.UserId);

            var projects = Mapper.Map <IEnumerable <Model.User>, IEnumerable <Models.User> >(users);

            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, GetDummyUser()));
        }
Esempio n. 21
0
        public ActionResult Delete(Models.Milestone value)
        {
            var milestone = _milestoneService.GetById(value.ID, value.IDproject);

            if (milestone == null)
            {
                return(JsonResponse.GetJsonResult(JsonResponse.ERROR_RESPONSE, milestone));
            }

            _milestoneService.Delete(milestone);
            _milestoneService.Save();
            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, value));
        }
Esempio n. 22
0
        public ActionResult RemoveChecked(ChecklistChecked chlist)
        {
            var item = _checkedItemService.GetCheckedItemById(chlist.ID);

            if (item == null)
            {
                return(JsonResponse.GetJsonResult(JsonResponse.ERROR_RESPONSE, item));
            }

            _checkedItemService.RemoveCheckedItem(item);
            _checkedItemService.SaveCheckedItem();
            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, "OK"));
        }
Esempio n. 23
0
        public ActionResult Remove(int id)
        {
            var item = _itemService.GetCheckListItemById(id);

            if (item == null)
            {
                return(JsonResponse.GetJsonResult(JsonResponse.ERROR_RESPONSE, item));
            }

            _itemService.RemoveCheckListItem(item);
            _itemService.SaveCheckListItem();
            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, "OK"));
        }
Esempio n. 24
0
        public ActionResult DeleteTextBoxFile(TextBlockFile tbf)
        {
            var tenderFile = _tenderFileService.GetById(tbf.ID, tbf.IDTextBlock);

            if (tenderFile == null)
            {
                return(JsonResponse.GetJsonResult(JsonResponse.ERROR_RESPONSE, tbf));
            }

            _tenderFileService.Delete(tenderFile);
            _tenderFileService.Save();
            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, tbf));
        }
Esempio n. 25
0
        public ActionResult Delete(TextBlock tb)
        {
            var tenderFileBlock = _tenderFileBlockService.GetById(tb.ID, tb.IDproject);

            if (tenderFileBlock == null)
            {
                return(JsonResponse.GetJsonResult(JsonResponse.ERROR_RESPONSE, tb));
            }

            _tenderFileBlockService.Delete(tenderFileBlock);
            _tenderFileBlockService.Save();
            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, tb));
        }
Esempio n. 26
0
        public async Task <JsonResult> OpenVault(int projectID)
        {
            //-- creating empty list of anonymous class
            var list = new[] { new { User = string.Empty, File = string.Empty, FilePath = string.Empty } }.ToList();

            list.RemoveAll(x => x.User.Equals(string.Empty));


            list = list.OrderBy(o => o.User).ToList();


            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, list));
        }
Esempio n. 27
0
        public ActionResult ChangeOrder(int id, int order)
        {
            var item = _itemService.GetCheckListItemById(id);

            if (item == null)
            {
                return(JsonResponse.GetJsonResult(JsonResponse.ERROR_RESPONSE, item));
            }

            item.ItemOrder = order;
            _itemService.RemoveCheckListItem(item);
            _itemService.SaveCheckListItem();
            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, "OK"));
        }
Esempio n. 28
0
        public ActionResult SaveMyAccount(Models.User value)
        {
            //TODO
            if (value.ID <= 0)
            {
                CreateUser(value);
            }
            else
            {
                UpdateUser(value);
            }

            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, value));
        }
Esempio n. 29
0
        public ActionResult SaveUserProject(Models.UsersProject value)
        {
            var user   = _userService.GetUserById(value.IDuser);
            var tender = _tenderService.GetTenderById(value.IDproject);

            var userTender = Mapper.Map <UsersProject, UserTender>(value);

            userTender.User   = user;
            userTender.Tender = tender;

            _userTenderService.CreateUserTender(userTender);
            _userTenderService.SaveUserTender();

            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, value));
        }
Esempio n. 30
0
        public ActionResult Save(Project proj)
        {
            Tender tender;

            if (proj.ID <= 0)
            {
                tender = CreateTender(proj);
            }
            else
            {
                tender = UpdateTender(proj);
            }

            var model = Mapper.Map <Tender, Project>(tender);

            return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, model));
        }