protected void Page_Load(object sender, EventArgs e) { if (QS("tid", 0) <= 0) { this.ShowArgumentErrorMessageToClient(); return; } response = ticketApp.GetProjectIdAndUserID(QS("tid", 0)); projectUsersList = projectApp.GetProjectSunnetUserList(response.ProjectId); foreach (ProjectUsersEntity tmpU in projectUsersList) { UsersEntity user = userApp.GetUser(tmpU.UserID); if (user != null) { if (user.Status.Trim() != "INACTIVE") { userList.Add(user); } } } if (userList.Count <= 0) { this.ShowMessageToClient("No user under this project.", 0, false, false); } tiketUserEntityList = ticketApp.GetListUsersByTicketId(QS("tid", 0)); }
protected void Page_Load(object sender, EventArgs e) { int tid = QS("tid", 0); int feedbackId = QS("feedbackId", 0); if (tid == 0 && feedbackId == 0) { this.ShowArgumentErrorMessageToClient(); return; } #region role FeedBacksEntity entity = new FeedBacksEntity(); if (feedbackId > 0) { entity = fbAPP.GetFeedBacksEntity(feedbackId); if (!CheckSecurity(entity.TicketID)) { this.ShowArgumentErrorMessageToClient(); return; } entity.Title = string.Format("<strong>Re:{0}</strong>", entity.Title.Replace("<strong>", "").Replace("</strong>", "")); AddFeedBack1.IsReply = true; Page.Title = "Reply Feedback"; } else { if (!CheckSecurity(tid)) { this.ShowArgumentErrorMessageToClient(); return; } if (UserInfo.Role == RolesEnum.PM || UserInfo.Role == RolesEnum.ADMIN || UserInfo.Role == RolesEnum.CLIENT) { entity.IsPublic = true; } else { entity.IsPublic = false; } entity.TicketID = tid; Page.Title = "Add FeedBacks"; } ProjectIDResponse = ticketsApp.GetProjectIdAndUserID(entity.TicketID); if (null != ProjectIDResponse) { this.AddFeedBack1.ProjectID = ProjectIDResponse.ProjectId; } this.AddFeedBack1.FeedBacksEntityInfo = entity; #endregion }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; try { if (IdentityContext.UserID <= 0) { return; } #region get value int tid = Convert.ToInt32(context.Request["tid"]); String title = context.Request["title"]; String descr = context.Request["descr"]; #endregion #region declare TasksEntity ta = new TasksEntity(); int result = 0; #endregion GetProjectIdAndUserIDResponse response = ticketApp.GetProjectIdAndUserID(tid); int pid = response.ProjectId; ta.TicketID = tid; ta.ProjectID = pid; ta.Title = title.NoHTML(); ta.Description = descr.NoHTML(); ta.IsCompleted = false; ta.CompletedDate = UtilFactory.Helpers.CommonHelper.GetDefaultMinDate(); result = ticketApp.AddTaskEntity(ta); if (result > 0) { context.Response.Write("Add Successful!"); } else { context.Response.Write("Add Fail!"); } } catch (Exception ex) { context.Response.Write("para error!"); WebLogAgent.Write(string.Format("Error Ashx:DoAddTaskHandler.ashx Messages:\r\n{0}", ex)); return; } }
public void TicketsDataBind() { string keyWord = this.txtKeyWord.Text.Trim(); int tid = QS("tid", 0); GetProjectIdAndUserIDResponse response = ticketApp.GetProjectIdAndUserID(tid); if (!CheckSecurity(response.CreateUserId) || keyWord.Length == 0) { return; } #region set value GetTicketsListByConditionRequest request = new GetTicketsListByConditionRequest(); dto = new TicketsSearchConditionDTO(); dto.OrderExpression = hidOrderBy.Value; dto.OrderDirection = hidOrderDirection.Value; dto.KeyWord = keyWord; dto.Status = CanShowStatus(); dto.Project = response.ProjectId.ToString(); dto.IsInternal = true;//true here, for unlimited dto.IsFeedBack = false; dto.FeedBackTicketsList = ""; request.TicketSc = dto; #endregion string ListNeedRemove = trApp.GetAllRelationStringById(tid, true) + " " + tid; list = ticketApp.GetTicketListBySearchCondition(request, out recordCount, page, anpUsers.PageSize); if (null != list && list.Count > 0) { trNoTickets.Visible = false; } foreach (string item in ListNeedRemove.Split(' ')) { if (item.Length > 0) { int id = Convert.ToInt32(item); list.RemoveAll(x => x.TicketID == id); } } this.rptRelationTicketsList.DataSource = list; this.rptRelationTicketsList.DataBind(); anpUsers.RecordCount = recordCount; }
private void InitEsUserBind() { SearchUsersRequest request = new SearchUsersRequest( SearchUsersType.Project, false, " FirstName ", " ASC "); int tid = QS("tid", 0); GetProjectIdAndUserIDResponse responseProject = ticketApp.GetProjectIdAndUserID(tid);//get pid request.ProjectID = responseProject.ProjectId; response = userApp.SearchUsers(request); ddlEs.DataTextField = "FirstName"; ddlEs.DataValueField = "UserID"; SetDefaultValueForDropdownList <UsersEntity>(ddlEs, response.ResultList.FindAll(x => (x.Role != RolesEnum.CLIENT && x.Role != RolesEnum.Sales && x.Role != RolesEnum.Supervisor))); }
private bool CheckSecurity(GetProjectIdAndUserIDResponse info) { if (UserInfo.Role == RolesEnum.CLIENT) { if (UserInfo.UserID != info.CreateUserId && UserInfo.CompanyID != info.CompanyId) { return(false); } } else if (UserInfo.Role != RolesEnum.ADMIN && UserInfo.Role != RolesEnum.PM && UserInfo.Role != RolesEnum.Sales) { return(false); } return(true); }
protected string GetUsersHtml(RolesEnum role) { StringBuilder htmls = new StringBuilder(); GetProjectIdAndUserIDResponse response = ticketApp.GetProjectIdAndUserID(QS("tid", 0)); List <ProjectUsersEntity> projectUsers = projectApp.GetProjectSunnetUserList(response.ProjectId); ProjectsEntity projectsEntity = projectApp.Get(response.ProjectId); if (projectUsers != null && projectUsers.Count > 0) { bool isHasUser = false; foreach (ProjectUsersEntity projectUser in projectUsers) { UsersEntity user = userApp.GetUser(projectUser.UserID); if (user != null && user.Status.Trim() != "INACTIVE") { if (user.Role != RolesEnum.CLIENT && user.Role == role) { if (ticketEntity.CreatedBy != user.UserID) { htmls.AppendFormat("<li userid='{0}' data-role=" + (int)MapRoleToTicketUserType(role) + ">{1}</li>", user.ID, user.FirstName); } else { htmls.AppendFormat("<li userid='{0}' data-isCreate='true' data-role=" + (int)MapRoleToTicketUserType(role) + ">{1}</li>", user.ID, user.FirstName); } isHasUser = true; } } } if (!isHasUser) { htmls.AppendFormat("<li style='{0}'></li>", "visibility:hidden;"); } } return(htmls.ToString()); }
private void CreateAssignUserList() { GetProjectIdAndUserIDResponse response = ticketApp.GetProjectIdAndUserID(ticketID); List <ProjectUsersEntity> projectUsers = projApp.GetProjectSunnetUserList(response.ProjectId) .Distinct(new CompareProjectUser()) .ToList <ProjectUsersEntity>(); if (UserInfo.Role == RolesEnum.Leader) { dvUS.Style.Add("visibility", "hidden"); dvUS.Style.Add("overflow", "auto"); dvUS.Style.Add("width", "1px"); dvUS.Style.Add("height", "1px"); } List <TicketUsersEntity> ticketUsers = ticketApp.GetListUsersByTicketId(ticketID); TicketsEntity ticketEntity = ticketApp.GetTickets(ticketID); ProjectsEntity projectsEntity = projApp.Get(response.ProjectId); if (projectUsers != null && projectUsers.Count() > 0) { foreach (ProjectUsersEntity projectUser in projectUsers) { UsersEntity user = userApp.GetUser(projectUser.UserID); if (user != null && user.Status.Trim() != "INACTIVE") { if (user.Role != RolesEnum.CLIENT) { // 去掉“隐藏ticket的创建者和project的pm” lyq 20140808 //bool isTicketCreateUser = (ticketEntity.CreatedBy == user.UserID || user.UserID == projectsEntity.PMID); bool isTicketCreateUser = false; bool isChecked = ticketUsers.Find(r => r.UserID == user.UserID) != null; switch (user.Role) { case RolesEnum.Supervisor: case RolesEnum.Sales: case RolesEnum.PM: { this.ulUS.Controls.Add(GetUserLi(user, isTicketCreateUser, isChecked, true)); break; } case RolesEnum.Leader: case RolesEnum.DEV: case RolesEnum.Contactor: { this.ulDev.Controls.Add(GetUserLi(user, isTicketCreateUser, isChecked)); break; } case RolesEnum.QA: { this.ulQA.Controls.Add(GetUserLi(user, isTicketCreateUser, isChecked)); break; } } } } } } }
public Dictionary <string, string> GetSelectedUserList() { Dictionary <string, string> results = new Dictionary <string, string>(); GetProjectIdAndUserIDResponse response = ticketApp.GetProjectIdAndUserID(ticketID); List <ProjectUsersEntity> projectUsers = projApp.GetProjectSunnetUserList(response.ProjectId); foreach (ProjectUsersEntity projectUser in projectUsers) { switch (projectUser.Role) { case RolesEnum.Supervisor: case RolesEnum.Sales: case RolesEnum.PM: { Control li = (Control)(this.ulUS.Controls[0]); Control control = li.FindControl("chk-" + projectUser.UserID); if (control != null) { CheckBox checkBox = (CheckBox)control; if (checkBox.Checked) { if (!results.ContainsKey(checkBox.Attributes["data-id"])) { results.Add(checkBox.Attributes["data-id"], ""); } results[checkBox.Attributes["data-id"]] = checkBox.Attributes["data-role"]; } } break; } case RolesEnum.Leader: case RolesEnum.DEV: case RolesEnum.Contactor: { Control li = (Control)(this.ulDev.Controls[0]); Control control = li.FindControl("chk-" + projectUser.UserID); if (control != null) { CheckBox checkBox = (CheckBox)control; if (checkBox.Checked) { if (!results.ContainsKey(checkBox.Attributes["data-id"])) { results.Add(checkBox.Attributes["data-id"], ""); } results[checkBox.Attributes["data-id"]] = checkBox.Attributes["data-role"]; } } break; } case RolesEnum.QA: { Control li = (Control)(this.ulQA.Controls[0]); Control control = li.FindControl("chk-" + projectUser.UserID); if (control != null) { CheckBox checkBox = (CheckBox)control; if (checkBox.Checked) { if (!results.ContainsKey(checkBox.Attributes["data-id"])) { results.Add(checkBox.Attributes["data-id"], ""); } results[checkBox.Attributes["data-id"]] = checkBox.Attributes["data-role"]; } } break; } } } return(results); }
protected void Page_Load(object sender, EventArgs e) { int tid = QS("tid", 0); int feedbackId = QS("feedbackId", 0); if (tid == 0 && feedbackId == 0) { this.ShowArgumentErrorMessageToClient(); return; } GetProjectIdAndUserIDResponse projectidanduseridResponse = new GetProjectIdAndUserIDResponse(); if (!IsPostBack) { #region role if (feedbackId > 0) //回复 { FeedBacksEntity entity = fbAPP.GetFeedBacksEntity(feedbackId); projectidanduseridResponse = ticketsApp.GetProjectIdAndUserID(entity.TicketID); if (!CheckSecurity(projectidanduseridResponse)) { this.ShowArgumentErrorMessageToClient(); return; } txtTitle.Value = string.Format("Re:{0}", entity.Title); Page.Title = "Reply Note"; bannerTitle.Text = "Reply Note"; trOthers.Visible = false; trOriDesc.Visible = true; trOriFile.Visible = true; trOriDate.Visible = true; lblDate.InnerText = entity.CreatedOn.ToString("MM/dd/yyyy"); txtOriginalContent.Attributes["readonly"] = "readonly"; this.txtOriginalContent.Value = entity.Description; this.lblFiles.InnerHtml = ShowImageList(entity.FeedBackID); hdTicketID.Value = entity.TicketID.ToString(); } else //添加 { hdTicketID.Value = QS("tid"); if (UserInfo.Role == RolesEnum.CLIENT) { if (!string.IsNullOrEmpty(QS("deny"))) { Page.Title = "Add Reason"; bannerTitle.Text = "Add Reason"; txtTitle.Value = "Deny Reason"; } trOthers.Visible = false; } else { trOthers.Visible = true; this.ckIsPublic.Visible = true; this.ckIsPublic.Checked = true; this.chkIsWaitClientFeedback.Visible = true; } projectidanduseridResponse = ticketsApp.GetProjectIdAndUserID(tid); } hdProjectID.Value = projectidanduseridResponse.ProjectId.ToString(); } #endregion }