public HttpResponseMessage SHPR_CREATE_TICKET(TicketEntity oBe) { try { if (string.IsNullOrWhiteSpace((string)HttpContext.Current.Session["username"])) { return(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, "Acceso no autorizado.")); } if (oBe.TIC_PRI_Id == 0) { throw new ArgumentException("Seleccione una prioridad."); } if (string.IsNullOrEmpty(oBe.TIC_Descripcion)) { throw new ArgumentException("Especifique la descripción del ticket."); } if (oBe.TIC_PRO_Id == 0) { throw new ArgumentException("Seleccione un tipo de problema."); } //if (oBe.TIC_SOL_Id == 0) // throw new ArgumentException("Seleccione un tipo de solución."); if (oBe.TIC_SER_Id == 0) { throw new ArgumentException("Seleccione un servicio."); } if (oBe.TIC_EMP_Id == 0) { throw new ArgumentException("Seleccione una empresa."); } if (oBe.TIC_USU_Id == 0) { throw new ArgumentException("Seleccione un usuario."); } var oBr = new TicketRule(); //oBe.COD_USUA_CREA = (string)HttpContext.Current.Session["username"]; //oBe.COD_USUA_MODI = (string)HttpContext.Current.Session["username"]; oBr.SHPR_CREATE_TICKET(oBe); //MailMessage mail = new MailMessage("*****@*****.**", "*****@*****.**"); //SmtpClient client = new SmtpClient(); //client.Port = 25; //client.DeliveryMethod = SmtpDeliveryMethod.Network; //client.EnableSsl = false; //client.UseDefaultCredentials = false; //client.Host = "smtp.gmail.com"; //mail.Subject = "INDRA TICKET."; //mail.Body = "SE ENVIA EL TICKET NUMERO 1"; //client.Send(mail); return(Request.CreateResponse(HttpStatusCode.OK, "Operación concretada con éxito.")); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } }