public IHttpActionResult GetWarrantyType() { if (!Common.GetAuthorization(Request)) { return(Ok(new { Code = 401, Message = "Unauthorization" })); } var user = _userBusinessService.GetByToken(Request.Headers.GetValues("AccessToken").First()); if (user != null) { return(Ok(_warrantyTypeBusinessService.Get())); } else { _webStatus.code = 403; _webStatus.description = "Invalid AccessToken"; return(Ok(_webStatus)); } }
public ActionResult Update(string id) { if (Session["userid"] == null) { return(RedirectToAction("Login", "Account")); } else { if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj().ToLower() != Session["username"].ToString().ToLower()) { return(RedirectToAction("Login", "Account")); } ViewBag.Domain = WebConfigure.GetDomain() + "/Upload/TechnicalRequestAttachments/"; if (id != null) { string ticketCategory = _ticketBs.GetCategoryName(id); var ticket = _ticketBs.GetByTicketNumber(id); var ticketParticipants = _ticketParticipantBusinessService.GetByTicket(ticket.TicketId); if (!((ticket.Status.Equals(2) && Convert.ToInt32(Session["userid"]) == ticket.Responder) || (ticket.Status.Equals(1) && Convert.ToInt32(Session["userid"]) == ticket.Submiter))) { return(Content("<script language='javascript' type='text/javascript'>alert('You are Not Included with This Technical Request'); location.href = '" + WebConfigure.GetDomain() + "/MyTechnicalRequest';</script>")); } if (Convert.ToInt32(Session["DelegateStatus"]) == 1) { return(Content("<script language='javascript' type='text/javascript'>alert('Cant Update Technical Request During Delegation Period'); location.href = '" + WebConfigure.GetDomain() + "/MyTechnicalRequest';</script>")); } if (ticket.Status == 1 && ticket.Submiter != Convert.ToInt32(Session["userid"])) { return(Content("<script language='javascript' type='text/javascript'>alert('The Technical Request is Not Found'); location.href = '" + WebConfigure.GetDomain() + "/TechnicalRequest';</script>")); } var responder = _userBusinessService.GetDetail(ticket.Responder); var attachments = _ticketAttachmentBs.GetFullByTicketId(ticket.TicketId); List <TicketAttachmentsAPI> listAttachment = new List <TicketAttachmentsAPI>(); string attachmentsPath = System.Web.HttpContext.Current.Server.MapPath("~/Upload/TechnicalRequestAttachments/"); if (attachments != null) { foreach (var attachment in attachments) { string[] imgExt = { ".jpg", ".png", ".jpeg", ".gif", ".bmp", ".tif", ".tiff" }; if (imgExt.Contains(Path.GetExtension(attachment.Name))) { listAttachment.Add(new TicketAttachmentsAPI { Id = attachment.TicketAttachmentId, Name = Common.ImageToBase64(attachmentsPath + attachment.Name), Level = attachment.LevelUser, Type = Path.GetExtension(attachment.Name), NameWithOutBase64 = attachment.Name }); } else { listAttachment.Add(new TicketAttachmentsAPI { Id = attachment.TicketAttachmentId, Name = attachment.Name, Level = attachment.LevelUser, Type = Path.GetExtension(attachment.Name), NameWithOutBase64 = attachment.Name }); } } } var tags = _articleTagBs.GetTagsByTicket(ticket.TicketId); WarrantyTypeBusinessService warrantyTypeBusinessService = Factory.Create <WarrantyTypeBusinessService>("WarrantyType", ClassType.clsTypeBusinessService); ViewBag.warrantyType = warrantyTypeBusinessService.Get(); ViewBag.Ticket = ticket; ViewBag.Attachments = listAttachment; ViewBag.Tags = tags; ViewBag.Responder = responder; if (ticketParticipants != null) { ViewBag.Participants = _ticketParticipantBusinessService.GetParticipantWithName(ticketParticipants); } ViewBag.Recent = TechnicalRequest.GetRecentTR(Convert.ToInt32(Session["userid"])); SetListDropdown(int.Parse(Session["userid"].ToString())); return(View("../TechnicalRequest/Update" + ticketCategory)); } return(RedirectToAction("Index", "MyTechnicalRequest")); } }
public IHttpActionResult Get(int id) { return(Ok(_warrantyTypeBusinessService.Get(id))); }