public void ProcessRequest(HttpContext context) { HttpRequest request = context.Request; HttpResponse response = context.Response; int feedbackID = QS(request.QueryString["FeedbackID"], 0); int userID = QS(request.QueryString["UID"], 0); if (userID != UserID) { response.Write("2"); //not autorized. } if (feedbackID == 0) { response.Write("3"); } FeedBackApplication feedBackApplication = new FeedBackApplication(); bool result = feedBackApplication.DeleteFeedback(feedbackID); if (result) { response.Write("1"); } else { response.Write("0"); } }
public string DeleteFeedback(int userID, int feedbackID, int ticketID) { if (userID != UserID) { return(ResponseMessage.GetResponse(false, "Unauthorized operation.", 0)); } if (feedbackID == 0) { return(ResponseMessage.GetResponse(false, "Arguments error.", 0)); } FeedBackApplication feedBackApplication = new FeedBackApplication(); //先判定feedback是不是public然后判断是不是wait client==1或waitpm ==1如果是并且ticket状态不为normal则改为normal FeedBacksEntity feedBacksEntity = feedBackApplication.GetFeedBacksEntity(feedbackID); if (feedBacksEntity.WaitClientFeedback == FeedbackReplyStatus.Requested) { ticketApp.ClearWaitingByType(ticketID, TicketUsersType.Create, TicketUsersType.Client, TicketUsersType.PM); ticketApp.DeleteUserFromTicket(ticketID, TicketUsersType.Client); } if (feedBacksEntity.WaitPMFeedback == FeedbackReplyStatus.Requested) { var ticketEntity = ticketApp.GetTickets(ticketID); var projectEntity = projectApp.Get(ticketEntity.ProjectID); if (ticketApp.UpdateTicketStatus(ticketID, UserTicketStatus.Normal, TicketUsersType.PM, TicketUsersType.Create, TicketUsersType.Client)) { ticketEntity.ResponsibleUser = PmReplyClient(projectEntity, ticketEntity); ticketApp.UpdateTickets(ticketEntity, false); } } //再删除feedbackmessage,并且feedback状态不为normal则改为normal bool result = feedBackApplication.DeleteFeedback(feedbackID); if (result) { return(ResponseMessage.GetResponse(true)); } else { var tmpMessage = feedBackApplication.BrokenRuleMessages != null && feedBackApplication.BrokenRuleMessages.Count > 0 ? feedBackApplication.BrokenRuleMessages[0].Message : ""; return(ResponseMessage.GetResponse(false, tmpMessage)); } }