public IActionResult EditSesion(String option, int idSesion, int?idPartner, int?idWork, String name, String description, DateTime?date, int?comision, int?idImage) { if (option == "ADD") { this.repoSesion.AddPartnerWorkIntoSesion(idSesion, idPartner.Value, idWork.Value); } else if (option == "MODIFY") { String sessionName = this.repoSesion.GetSESIONID(idSesion).Name; String path = prov.MapPath(Folders.Session); ToolImage.RenameFolder(path, sessionName, name); this.repoSesion.ModifySesion(idSesion, name, description, date.Value, comision.Value); } else if (option == "SETIMAGE") { this.repoSesion.SetImageSession(idSesion, idImage.Value); } SESSION_COMPLEX sesion = this.repoSesion.GetSessionComplexById(idSesion); ViewBag.Date = sesion.DateSesion.ToString("yyyy-MM-dd"); ViewBag.Comision = this.repoComision.GetCOMISIONS().ToList(); ViewBag.Partner = this.repoPartner.GetPartners().ToList(); ViewBag.Work = this.repoWork.GetWORKs().ToList(); ViewBag.Workers = this.repoSesion.GetPartnerWorkBySesion(idSesion); ViewBag.Photos = this.repoPhoto.GetPhotos(idSesion).ToList(); return(View(sesion)); }
public ActionResult EditSesion(String option, int idSesion, int?idPartner, int?idWork, String name, String description, DateTime?date, int?comision) { if (option == "ADD") { this.repoSesion.AddPartnerWorkIntoSesion(idSesion, idPartner.Value, idWork.Value); } else if (option == "MODIFY") { String sessionName = this.repoSesion.GetSESIONID(idSesion).NAME; String path = Server.MapPath("~/images/Sesion"); ToolImage.RenameFolder(path, sessionName, name); this.repoSesion.ModifySesion(idSesion, name, description, date.Value, comision.Value); } SESION sesion = this.repoSesion.GetSESIONID(idSesion); ViewBag.Date = sesion.DATESESION.Value.ToString("yyyy-MM-dd"); ViewBag.Comision = this.repoComision.GetCOMISIONS().ToList(); ViewBag.Partner = this.repoPartner.GetPartners().ToList(); ViewBag.Work = this.repoWork.GetWORKs().ToList(); ViewBag.Workers = this.repoSesion.GetPartnerWorkBySesion(idSesion); return(View(sesion)); }
public ActionResult CreateSesion(String name, String description, DateTime date, int comision) { String path = Server.MapPath("~/images/Sesion"); ToolImage.CreateFolder(path, name); this.repoSesion.InsertSesion(name, description, date, comision); return(RedirectToAction("Sesion")); }
public ActionResult getImage(int ID) { Alumno temAlumno = AlumnoViewModel.ObtenerContenido(ID); var temImage = ToolImage.Base64StringToBitmap(temAlumno.sImagen); var temMapbytes = ToolImage.BitmapToBytes(temImage); return(File(temMapbytes, "image/jpeg")); }
public IActionResult CreateSesion(String name, String description, DateTime date, int comision) { String path = prov.MapPath(Folders.Session, name); ToolImage.CreateFolder(path); this.repoSesion.InsertSesion(name, description, date, comision); return(RedirectToAction("Sesion")); }
public ActionResult DeleteSesion(int id, String name) { String path = Server.MapPath("~/images/Sesion"); ToolImage.DeleteFolder(path, name); this.repoSesion.DeleteSesion(id); return(RedirectToAction("Sesion")); }
public ActionResult DeleteSesion(int id, String name) { String path = prov.MapPath(Folders.Session, name); ToolImage.DeleteFolder(path); this.repoSesion.DeleteSesion(id); return(RedirectToAction("Sesion")); }
public async Task <ActionResult> Upload() { int idSesion = int.Parse(Request.Form["idSesion"].ToString()); String sessionName = this.repoSesion.GetSESIONID(idSesion).NAME; foreach (string file in Request.Files) { HttpPostedFileBase fileContent = Request.Files[file]; String rootpath = Server.MapPath("~/images"); String path = Path.Combine(rootpath + "\\Sesion\\" + sessionName); ToolImage.UploadImage(fileContent, path, null); this.repoPhoto.InsertPhoto(fileContent.FileName, idSesion); } return(Json(true)); }
public async Task <IActionResult> Upload() { int idSesion = int.Parse(Request.Form["idSesion"].ToString()); String sessionName = this.repoSesion.GetSESIONID(idSesion).Name; String path = prov.MapPath(Folders.Session, sessionName); foreach (IFormFile file in Request.Form.Files) { await ToolImage.UploadImage(file, path, null); this.repoPhoto.InsertPhoto(file.FileName, idSesion); } return(Json(true)); }
public async Task <IActionResult> DeleteImages(int idSesion) { String idPhotos = Request.Form["idPhotos"]; String[] idArray = idPhotos.Split(','); String sessionName = this.repoSesion.GetSESIONID(idSesion).Name; String path = prov.MapPath(Folders.Session, sessionName); foreach (String id in idArray) { String namePhoto = this.repoPhoto.GetPhotoById(int.Parse(id)).Picture; this.repoPhoto.RemovePhotos(int.Parse(id)); ToolImage.RemoveImage(namePhoto, path); } return(Json(true)); }
public async Task <ActionResult> DeleteImages(int idSesion) { String[] idPhotos = Request.Form["idPhotos"].Split(','); String sessionName = this.repoSesion.GetSESIONID(idSesion).NAME; String rootpath = Server.MapPath("~/images"); String path = Path.Combine(rootpath + "\\Sesion\\" + sessionName); foreach (String id in idPhotos) { String namePhoto = this.repoPhoto.GetPhotoById(int.Parse(id)).PICTURE; this.repoPhoto.RemovePhotos(int.Parse(id)); ToolImage.RemoveImage(namePhoto, path); } return(Json(true)); }
public IActionResult Comision(String name, String description, IFormFile photo, float price, int?id, String option) { String path = prov.MapPath(Folders.Comision); if (option == "ADD") { if (photo != null && photo.Length > 0) { ToolImage.UploadImage(photo, path, name); repo.InsertComision(name, description, "~/images/comision\\", photo, price); } } else if (option == "UPDATE") { COMISION comision = this.repo.GetComisionByID(id.Value); if (comision != null) { String image = null; if (photo != null) { String photoRemove = comision.Photo.Split('\\')[1]; ToolImage.RemoveImage(photoRemove, path); ToolImage.UploadImage(photo, path, name); String type = photo.ContentType.Split('/')[1]; image = name + "." + type; } repo.ModifyComision(id.Value, name, description, "~/images/comision\\", image, price); } } else if (option == "DELETE") { COMISION comision = this.repo.GetComisionByID(id.Value); if (comision != null) { repo.DeleteComision(id.Value, path); } } return(RedirectToAction("Comision")); }
public ActionResult Comision(String name, String description, HttpPostedFileBase photo, float price, int?id, String option) { String ruta = Server.MapPath("~/images/Comision"); if (option == "ADD") { if (photo != null && photo.ContentLength > 0) { ToolImage.UploadImage(photo, ruta, name); repo.InsertComision(name, description, "~/images/Comision", photo, price); } } else if (option == "UPDATE") { COMISION comision = this.repo.GetComisionByID(id.Value); if (comision != null) { String image = null; if (photo != null) { String photoRemove = comision.PHOTO.Split('\\')[1]; ToolImage.RemoveImage(photoRemove, ruta); ToolImage.UploadImage(photo, ruta, name); String type = photo.ContentType.Split('/')[1]; image = name + "." + type; } repo.ModifyComision(id.Value, name, description, "~/images/Comision\\", image, price); } } else if (option == "DELETE") { COMISION comision = this.repo.GetComisionByID(id.Value); if (comision != null) { repo.DeleteComision(id.Value, ruta); } } return(RedirectToAction("Comision")); }
public async Task <ActionResult> MovePhotos(int session) { String[] idPhotos = Request.Form["idPhotos"].Split(','); String oldSession = Request.Form["oldSession"]; String rootpath = Server.MapPath("~/images"); String sessionName = this.repoSesion.GetSESIONID(session).NAME; String oldSessionName = this.repoSesion.GetSESIONID(int.Parse(oldSession)).NAME; String oldFolder = Path.Combine(rootpath + "\\Sesion\\" + oldSessionName); String destinationFolder = Path.Combine(rootpath + "\\Sesion\\" + sessionName); foreach (String id in idPhotos) { int idPhoto = int.Parse(id); String imageName = this.repoPhoto.GetPhotoById(idPhoto).PICTURE; ToolImage.MoveImage(imageName, oldFolder, destinationFolder); this.repoPhoto.MovePhotosSesion(idPhoto, session); } return(Json(true)); }
public async Task <IActionResult> MovePhotos(int session) { String idPhotos = Request.Form["idPhotos"]; String[] idArray = idPhotos.Split(','); String oldSession = Request.Form["oldSession"]; String sessionName = this.repoSesion.GetSESIONID(session).Name; String oldSessionName = this.repoSesion.GetSESIONID(int.Parse(oldSession)).Name; String oldFolder = prov.MapPath(Folders.Session, oldSessionName); String destinationFolder = prov.MapPath(Folders.Session, sessionName); foreach (String id in idArray) { int idPhoto = int.Parse(id); String imageName = this.repoPhoto.GetPhotoById(idPhoto).Picture; ToolImage.MoveImage(imageName, oldFolder, destinationFolder); this.repoPhoto.MovePhotosSesion(idPhoto, session); } return(Json(true)); }
public void Apply_EditorWithDifferentTools_SetsCorrectPopupContentTitleText() { // Arrange var toolbar = _editor.Toolbars.Toolbars[0]; var toolSpellChecker = new ToolSpellChecker(); toolbar.Tools.Add(toolSpellChecker); var toolFind = new ToolFind(); toolbar.Tools.Add(toolFind); var toolReplace = new ToolReplace(); toolbar.Tools.Add(toolReplace); var toolImage = new ToolImage(); toolbar.Tools.Add(toolImage); var toolLink = new ToolLink(); toolbar.Tools.Add(toolLink); var toolFlash = new ToolFlash(); toolbar.Tools.Add(toolFlash); // Arrange & Act LocalizationHelper.Apply(_localizationSettings, _editor); // Assert _editor.ShouldSatisfyAllConditions( () => _editor.ShouldNotBeNull(), () => toolSpellChecker.PopupContents.TitleText.ShouldBe(LocalizedTextId.TOOL_SPELL_CHECKER_TITLE), () => toolFind.PopupContents.TitleText.ShouldBe(LocalizedTextId.TOOL_FIND_TITLE), () => toolReplace.PopupContents.TitleText.ShouldBe(LocalizedTextId.TOOL_REPLACE_TITLE), () => toolImage.PopupContents.TitleText.ShouldBe(LocalizedTextId.TOOL_IMAGE_TITLE), () => toolLink.PopupContents.TitleText.ShouldBe(LocalizedTextId.TOOL_LINK_TITLE), () => toolFlash.PopupContents.TitleText.ShouldBe(LocalizedTextId.TOOL_FLASH_TITLE)); }
public IActionResult SendCertificate([FromBody] SendCertificateRequest sendCertificateRequest) { Logger.Debug("Request: {0}", Framework.Common.SerializeJson.ToObject(sendCertificateRequest)); DateTime dateRequest = DateTime.Now; var response = new IResponse <SendCertificateResponse>(); string correlationId = string.Empty; try { #region Authorization Usuario y Contraseña if (string.IsNullOrEmpty(Request.Headers["Authorization"])) { var validate = Models.Response.Error(null, "NotAuthenticated"); response.Data = null; response.Message = validate.Message; response.State = validate.State; return(Unauthorized(response)); } AuthenticationHeaderValue authHeader = AuthenticationHeaderValue.Parse(Request.Headers["Authorization"]); var credentials = Encoding.UTF8.GetString(Convert.FromBase64String(authHeader.Parameter)).Split(':'); correlationId = Request.Headers["Correlation-Id"].ToString(); Core.Entity.User user = new Core.Entity.User() { Public = sendCertificateRequest.PublicToken, UserName = credentials[0], Password = credentials[1] }; var userAuthenticate = _user.Authenticate(user); if (userAuthenticate.Data == null) { var validate = Models.Response.Error("NotAuthenticated"); response.Data = null; response.Message = validate.Message; response.State = validate.State; return(Unauthorized(response)); } Core.Entity.UserPolicy userPolicy = new Core.Entity.UserPolicy() { AppUserId = sendCertificateRequest.AppUserId, IdUser = ((Core.Entity.User)userAuthenticate.Data).Id }; Core.Entity.Policy policy = new Core.Entity.Policy() { Name = Request.Path.Value }; var userPolicyAuthorize = _userPolicy.Authorize(userPolicy, policy); if (userPolicyAuthorize.Data == null) { var validate = Models.Response.Error("NotUnauthorized"); response.Data = null; response.Message = validate.Message; response.State = validate.State; return(Unauthorized(response)); } #endregion var customeModuleEndDate = _clientModule.GetModuleEndDate(sendCertificateRequest.Email); if (customeModuleEndDate.Data == null) { response.Data = null; response.Message = customeModuleEndDate.Message; response.State = customeModuleEndDate.State; return(BadRequest(response)); } var customeModuleEndDateData = (CustomModuleEndDate)customeModuleEndDate.Data; var pdf = ToolImage.GetBase64Image(sendCertificateRequest.CertificateParameters, customeModuleEndDateData.Day, customeModuleEndDateData.Month); SendCertificateResponse responseImage = new SendCertificateResponse() { pdfCertificate = pdf }; response.Data = responseImage; response.Message = Models.Response.CommentMenssage("CertificateCreatedSuccesfuly"); response.State = "000"; return(Ok(response)); } catch (Exception ex) { Logger.Error("Message: {0}; Exception: {1}", ex.Message, Framework.Common.SerializeJson.ToObject(ex)); response.Data = null; response.Message = "Error General"; response.State = "099"; return(BadRequest(response)); } finally { DateTime dateResponse = DateTime.Now; Core.Entity.ConsumptionHistory consumptionHistory = new Core.Entity.ConsumptionHistory { ApiName = Request.Path.Value, Host = Dns.GetHostName() + ":" + Request.Host.Port, CorrelationId = correlationId, AppUserId = sendCertificateRequest.AppUserId, Request = Framework.Common.SerializeJson.ToObject(sendCertificateRequest), DateRequest = dateRequest, Response = Framework.Common.SerializeJson.ToObject(response), DateResponse = dateResponse, CodeResponse = response.State }; _consumptionHistory.Insert(consumptionHistory); Logger.Debug("Request: {0} Response: {1}", sendCertificateRequest, response); } }
public void SetUp() { _toolImage = new ToolImage(); _privateObject = new PrivateObject(_toolImage); }