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")); }
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)); }
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)); }
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 })); }
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)); }
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)); }
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 })); }
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)); }
public ActionResult Delete(string path) { string targetPath = Server.MapPath("~/" + path); System.IO.File.Delete(targetPath); return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, "FILE DELETED")); }
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)); }
public ActionResult Delete(Project proj) { var tender = _tenderService.GetTenderById(proj.ID); _tenderService.RemoveTender(tender); return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, proj)); }
public ActionResult Delete(int userId) { var user = _userService.GetUserById(userId); _userService.RemoveUser(user); _userService.SaveUser(); return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, userId)); }
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)); }
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)); }
public ActionResult SaveAll(List <Models.User> list) { foreach (var userModel in list) { UpdateUser(userModel); } ; return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, list)); }
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 })); }
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)); }
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)); }
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)); }
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())); }
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)); }
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")); }
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")); }
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)); }
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)); }
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)); }
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")); }
public ActionResult SaveMyAccount(Models.User value) { //TODO if (value.ID <= 0) { CreateUser(value); } else { UpdateUser(value); } return(JsonResponse.GetJsonResult(JsonResponse.OK_DATA_RESPONSE, value)); }
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)); }
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)); }