private void BindUserInfo(int id) { List <TicketUsersEntity> list = ticketApp.GetListUsersByTicketId(id); if (list != null && list.Count > 0) { foreach (TicketUsersEntity u in list) { if (u.Type == TicketUsersType.PM) { this.lilPmName.Text += BaseWebsitePage.GetClientUserName(u.UserID) + " ; "; } else if (u.Type == TicketUsersType.Dev) { this.lilDevName.Text += BaseWebsitePage.GetClientUserName(u.UserID) + " ; "; } else if (u.Type == TicketUsersType.QA) { this.lilTestName.Text += BaseWebsitePage.GetClientUserName(u.UserID) + " ; "; } else if (u.Type == TicketUsersType.Other) { this.lilOtherName.Text += BaseWebsitePage.GetClientUserName(u.UserID) + " ; "; } } } }
protected void btnUpload_Click(object sender, EventArgs e) { int id = CompanyID; CompanysEntity model = companyApp.GetCompany(id); if (fileLogo.HasFile) { if (".jpg.png.gif.bmp".IndexOf(Path.GetExtension(fileLogo.FileName).ToLower()) >= 0) { model.Logo = UtilFactory.Helpers.FileHelper.SaveUploadFiles("Company", model.ID, fileLogo.PostedFile); if (companyApp.UpdateCompany(model)) { InitControl(model); BaseWebsitePage.ShowSuccessMessageToClient(false, false); } else { BaseWebsitePage.ShowFailMessageToClient(); } } else { BaseWebsitePage.ShowMessageToClient("The image format is incorrect!", 0, false, false); } } }
private void BindTicketBaseInfo() { if (null != TicketsEntityInfo) { if (TicketsEntityInfo.Status < TicketsState.Developing) { this.lilEN.Text = TicketsEntityInfo.IsEstimates == true ? "<span style='Color:red;'>YES</span>" : "<span style='Color:red;'>NO</span>"; } else { this.lilEN.Text = TicketsEntityInfo.IsEstimates == true ? "YES" : "NO"; } this.lilIsInternal.Text = TicketsEntityInfo.IsInternal == true ? "IsInternal," : ""; this.lilProjectName.Text = ShowProjectName(TicketsEntityInfo.ProjectID); this.lilTicketCode.Text = TicketsEntityInfo.TicketCode; this.lilTicketPriority.Text = Enum.GetName(typeof(PriorityState), (int)TicketsEntityInfo.Priority); this.lilTicketStatus.Text = GetClientStatusNameBySatisfyStatus((int)TicketsEntityInfo.Status, TicketsEntityInfo.TicketID).Replace("<span style='color:red;'>", "").Replace("</span>", ""); this.lilCreateBy.Text = BaseWebsitePage.GetClientUserName(TicketsEntityInfo.CreatedBy); this.lilCreateTime.Text = ShowFormatTime(TicketsEntityInfo.CreatedOn); if (!TicketsEntityInfo.IsEstimates) { this.trEstLast.Visible = false; } else { this.lilFinalHours.Text = TicketsEntityInfo.Status < TicketsState.Estimation_Approved ? "0" : TicketsEntityInfo.FinalTime.ToString(); } } }
protected void btnSave_Click(object sender, EventArgs e) { LogApplication logApplication = new LogApplication(); LogEntity logEntity = new LogEntity(); logEntity.logType = LogType.ModifyPassword; logEntity.operatingTime = DateTime.Now; logEntity.currentUserId = UserInfo.UserID; logEntity.referrer = Context.Request.UrlReferrer.ToString(); logEntity.iPAddress = HttpContext.Current.Request.UserHostAddress; bool result; string msg = CheckInput(out result); if (!result) { BaseWebsitePage.ShowMessageToClient(msg, 2, false, false); return; } UsersEntity user = GetEntity(); if (IsAdd) { int id = userApp.AddUser(user); if (id > 0) { BaseWebsitePage.ShowSuccessMessageToClient(); } else { BaseWebsitePage.ShowFailMessageToClient(userApp.BrokenRuleMessages); } } else { if (userApp.UpdateUser(user)) { BaseWebsitePage.ShowSuccessMessageToClient(false, true); logEntity.IsSuccess = true; logEntity.Description = UserInfo.UserName + " modifiy " + txtUserName.Text + " password to" + txtPassword.Text + " success. new password: "******" modifiy " + txtUserName.Text + " password to" + txtPassword.Text + " fail. msg: " + msg; } logApplication.Write(logEntity); } }
protected void iBtnDeleteLogo_Click(object sender, ImageClickEventArgs e) { int id = CompanyID; CompanysEntity model = companyApp.GetCompany(id); model.Logo = "/Images/nologo.jpg"; InitControl(model); if (companyApp.UpdateCompany(model)) { BaseWebsitePage.ShowSuccessMessageToClient(false, false); } else { BaseWebsitePage.ShowFailMessageToClient(); } }
protected void btnSave_Click(object sender, EventArgs e) { string msg = string.Empty; if (!CheckInput(out msg)) { BaseWebsitePage.ShowMessageToClient(msg, 2, false, false); return; } CompanysEntity model = GetEntity(); if (companyApp.UpdateCompany(model)) { InitControl(model); BaseWebsitePage.ShowSuccessMessageToClient(false, false); } else { BaseWebsitePage.ShowFailMessageToClient(companyApp.BrokenRuleMessages, false); } }
protected void btnSave_Click(object sender, EventArgs e) { LogApplication logApplication = new LogApplication(); LogEntity logEntity = new LogEntity(); logEntity.logType = LogType.ModifyPassword; logEntity.operatingTime = DateTime.Now; logEntity.currentUserId = UserInfo.UserID; logEntity.referrer = Context.Request.UrlReferrer.ToString(); logEntity.iPAddress = HttpContext.Current.Request.UserHostAddress; UsersEntity model = UserInfo; string msg = CheckInput(); if (string.IsNullOrEmpty(msg)) { model.PassWord = txtPassword.Text; if (userApp.UpdateUser(model)) { BaseWebsitePage.ShowSuccessMessageToClient(false, false); logEntity.IsSuccess = true; logEntity.Description = UserInfo.UserName + " modifiy own password to" + txtPassword.Text + " success. "; logApplication.Write(logEntity); } else { BaseWebsitePage.ShowFailMessageToClient(userApp.BrokenRuleMessages); logEntity.IsSuccess = false; logEntity.Description = UserInfo.UserName + " modifiy own password to" + txtPassword.Text + " fail. "; logApplication.Write(logEntity); } } else { BaseWebsitePage.ShowMessageToClient(msg, 2, false, false); logEntity.IsSuccess = false; logEntity.Description = UserInfo.UserName + " modifiy own password to" + txtPassword.Text + " fail. " + msg; logApplication.Write(logEntity); } }
protected void btnSaveFiles_Click(object sender, EventArgs e) { if (fileProject.HasFile) { FilesEntity model = FileFactory.CreateFileEntity(UserInfo.ID, ObjectFactory.GetInstance <ISystemDateTime>()); model.FilePath = UtilFactory.Helpers.FileHelper.SaveUploadFiles("Company", CompanyID, fileProject.PostedFile);; model.CompanyID = CompanyID; model.ContentType = Path.GetExtension(fileProject.FileName); model.FileID = 0; model.FileSize = fileProject.PostedFile.ContentLength; if (string.IsNullOrEmpty(txtFileTitle.Text)) { model.FileTitle = Path.GetFileName(fileProject.FileName); model.FileTitle = model.FileTitle.Substring(0, model.FileTitle.LastIndexOf(".")); } else { model.FileTitle = txtFileTitle.Text; } model.IsDelete = false; model.IsPublic = BaseWebsitePage.UserInfo.Role == RolesEnum.CLIENT; model.SourceType = (int)FileSourceType.Company; model.ThumbPath = Path.GetFileName(fileProject.PostedFile.FileName); model.IsDelete = false; FileApplication fileApp = new FileApplication(); int result = fileApp.AddFile(model); if (result <= 0) { BaseWebsitePage.ShowFailMessageToClient(fileApp.BrokenRuleMessages, false); } else { BaseWebsitePage.ShowSuccessMessageToClient(false, false); InitFiles(); txtFileTitle.Text = ""; } } }
private void InitControl() { InitCompany(); InitRole(); if (IsSunnet) { phClient.Visible = false; ddlCompany.SelectedValue = "1"; ddlCompany.Enabled = false; } else { phSunnet.Visible = false; } if (IsAdd) { if (IsSunnet) { } else { ddlRole.SelectedValue = ((int)RolesEnum.CLIENT).ToString(); ddlUserType.SelectedValue = "CLIENT"; ddlOffice.SelectedValue = "US"; } } else { UsersEntity user = UserToEdit; if (user == null) { BaseWebsitePage.ShowArgumentErrorMessageToClient(); return; } InitControls(user); } }
protected void btnSave_Click(object sender, EventArgs e) { bool result; string msg = CheckInput(out result); if (!result) { BaseWebsitePage.ShowMessageToClient(msg, 2, false, false); return; } UsersEntity user = GetEntity(); if (IsAdd) { int id = userApp.AddUser(user); if (id > 0) { BaseWebsitePage.ShowSuccessMessageToClient(); } else { BaseWebsitePage.ShowFailMessageToClient(userApp.BrokenRuleMessages); } } else { if (userApp.UpdateUser(user)) { BaseWebsitePage.ShowSuccessMessageToClient(true, false); } else { BaseWebsitePage.ShowFailMessageToClient(userApp.BrokenRuleMessages, true, false); } } }
protected void btnSave_Click(object sender, EventArgs e) { bool result = true; WorkRequestEntity entity = GetEntity(); if (IsAdd) { if (fileProject.HasFile) { string fileContentType = fileProject.PostedFile.ContentType; if ((fileContentType == "application/msword" || fileContentType == "application/pdf" || fileContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.document")) { int id = wqApp.AddWorkRequest(entity); if (id > 0) { FilesEntity model = FileFactory.CreateFileEntity(UserInfo.ID, ObjectFactory.GetInstance <ISystemDateTime>()); model.FilePath = UtilFactory.Helpers.FileHelper.SaveUploadFiles("WorkRequest", id, fileProject.PostedFile);; model.WorkRequestId = id; model.ContentType = fileProject.PostedFile.ContentType; model.FileID = 0; model.FileSize = fileProject.PostedFile.ContentLength; model.FileTitle = Path.GetFileName(fileProject.FileName); model.IsDelete = false; model.IsPublic = UserInfo.Role == RolesEnum.CLIENT; model.SourceType = (int)FileSourceType.WorkRequestScope; model.ThumbPath = Path.GetFileName(fileProject.PostedFile.FileName); result = fileApp.AddFile(model) > 0 ? true : false; BaseWebsitePage.ShowSuccessMessageToClient(); } else { BaseWebsitePage.ShowFailMessageToClient(wqApp.BrokenRuleMessages); } } else { BaseWebsitePage.ShowFailMessageToClient("Please select a file to upload ( *.doc, *.docx, *.pdf)"); } } else { BaseWebsitePage.ShowFailMessageToClient("Please upload Work Scope"); } } //edit else { if (fileProject.HasFile) { string fileContentType = fileProject.PostedFile.ContentType; if ((fileContentType == "application/msword" || fileContentType == "application/pdf" || fileContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.document")) { if (wqApp.UpdateWorkRequest(entity)) { FilesEntity model = FileFactory.CreateFileEntity(UserInfo.ID, ObjectFactory.GetInstance <ISystemDateTime>()); model.FilePath = UtilFactory.Helpers.FileHelper.SaveUploadFiles("WorkRequest", entity.WorkRequestID, fileProject.PostedFile);; model.WorkRequestId = entity.WorkRequestID; model.ContentType = fileProject.PostedFile.ContentType; model.FileID = 0; model.FileSize = fileProject.PostedFile.ContentLength; model.FileTitle = Path.GetFileName(fileProject.FileName); model.IsDelete = false; model.IsPublic = UserInfo.Role == RolesEnum.CLIENT; model.SourceType = (int)FileSourceType.WorkRequestScope; model.ThumbPath = Path.GetFileName(fileProject.PostedFile.FileName); result = fileApp.AddFile(model) > 0 ? true : false; BaseWebsitePage.ShowSuccessMessageToClient(true, false); } } else { BaseWebsitePage.ShowFailMessageToClient("Please select a file to upload ( *.doc, *.docx, *.pdf)"); } } else { if (!lblFile.Visible) { BaseWebsitePage.ShowFailMessageToClient("Please upload Work Scope"); } else { if (wqApp.UpdateWorkRequest(entity)) { BaseWebsitePage.ShowSuccessMessageToClient(true, false); } else { BaseWebsitePage.ShowFailMessageToClient(wqApp.BrokenRuleMessages); } } } } }
private void BindTicketBaseInfo() { if (null != TicketsEntityInfo) { if (this.TicketsEntityInfo.IsEstimates) { this.rdoEs.Checked = true; } else { this.rdoNotEs.Checked = true; } if (TicketsEntityInfo.ConvertDelete == CovertDeleteState.NotABug) { this.lilQuestion.Text = "<span style='Color:red;'>Not A Bug</span>"; if (UserInfo.Role == RolesEnum.PM || UserInfo.Role == RolesEnum.Leader) { this.lilIsABug.Text = "<input type='button' class='btnthree' id='btnIsABug' value='Is Bug' onclick=\"updateStatusConfirm('isBug',false);return false;\"/>"; } } bool hasPermission = ticketApp.ValidateIsExistUserUnderProject(TicketsEntityInfo.TicketID, UserInfo.UserID); if (!TicketsEntityInfo.IsInternal && (UserInfo.Role == RolesEnum.PM || UserInfo.Role == RolesEnum.ADMIN) && TicketsEntityInfo.Status < TicketsState.PM_Reviewed && TicketsEntityInfo.Status != TicketsState.Cancelled && hasPermission) { this.rdoEs.Enabled = true; this.rdoNotEs.Enabled = true; } else { this.rdoEs.Enabled = false; this.rdoNotEs.Enabled = false; } this.lilIsInternal.Text = TicketsEntityInfo.IsInternal == true ? "IsInternal," : ""; this.lilProjectName.Text = ShowProjectName(TicketsEntityInfo.ProjectID); this.lilTicketCode.Text = TicketsEntityInfo.TicketCode; this.lilTicketPriority.Text = Enum.GetName(typeof(PriorityState), (int)TicketsEntityInfo.Priority); this.lilTicketStatus.Text = ChangeStatus(TicketsEntityInfo.Status, TicketsEntityInfo.TicketID); this.lilCreateBy.Text = BaseWebsitePage.GetClientUserName(TicketsEntityInfo.CreatedBy); this.lilCreateTime.Text = ShowFormatTime(TicketsEntityInfo.CreatedOn); this.lilModify.Text = BaseWebsitePage.GetClientUserName(TicketsEntityInfo.ModifiedBy); this.lilModifyTime.Text = this.lilModify.Text.Length == 0 ? "" : ShowFormatTime(TicketsEntityInfo.ModifiedOn); this.lilDueDate.Text = ShowFormatTime(TicketsEntityInfo.DeliveryDate); this.lilScdDate.Text = ShowFormatTime(TicketsEntityInfo.StartDate); this.lilInitialTime.Text = TicketsEntityInfo.InitialTime.ToString(); this.lilEsUserName.Text = string.Format("({0})", BaseWebsitePage.GetClientUserName(TicketsEntityInfo.EsUserID)); #region Hidden when value is null or access is not satisfy condition if (BaseWebsitePage.GetClientUserName(TicketsEntityInfo.ModifiedBy).Length == 0) { this.updateBy.Visible = false; } if (TicketsEntityInfo.IsEstimates)//Estimation Needed { trEst.Visible = true; if ((int)TicketsState.Cancelled < (int)TicketsEntityInfo.Status && (int)TicketsEntityInfo.Status < (int)TicketsState.PM_Verify_Estimation && TicketsEntityInfo.FinalTime <= 0 && TicketsEntityInfo.EsUserID <= 0) { if (UserInfo.Role == RolesEnum.ADMIN || UserInfo.Role == RolesEnum.PM || UserInfo.Role == RolesEnum.Leader) { btnAssignUser.Visible = true; } } if (TicketsEntityInfo.Status > TicketsState.Waiting_For_Estimation || (TicketsEntityInfo.FinalTime > 0 && TicketsEntityInfo.Status == TicketsState.PM_Reviewed)) { if (TicketsEntityInfo.FinalTime > 0) { this.lilLookFinalEs.Text = "<a onclick=\"LookEsDetail('iushau02u340final');return false;\" style=\"cursor:pointer;\"/><span style='color:blue;'>View Estimation</span></a>"; } else if (TicketsEntityInfo.InitialTime > 0 && TicketsEntityInfo.FinalTime <= 0) { this.lilLookInitialEs.Text = "<a onclick=\"LookEsDetail('fwef654wr432erf12grdge');return false;\" style=\"cursor:pointer;\"/><span style='color:blue;'>View Initial Estimation</span></a>"; } } } else { trEst.Visible = false; this.trEstLast.Visible = false; } this.lilFinalHours.Text = TicketsEntityInfo.FinalTime.ToString(); //final hours #region show value who be assigned if (TicketsEntityInfo.EsUserID == UserInfo.UserID && TicketsEntityInfo.Status == TicketsState.Waiting_For_Estimation) { this.btnEsTime.Visible = true; } if (TicketsEntityInfo.DeliveryDate <= UtilFactory.Helpers.CommonHelper.GetDefaultMinDate()) { this.lilDueDate.Text = "<span style='Color:red;'>waiting for confirm <span>"; } if (TicketsEntityInfo.StartDate <= UtilFactory.Helpers.CommonHelper.GetDefaultMinDate()) { this.lilScdDate.Text = "<span style='Color:red;'>waiting for confirm <span>"; } if (TicketsEntityInfo.InitialTime <= 0) { this.lilInitialTime.Text = "<span style='Color:red;'>waiting<span>"; } if (TicketsEntityInfo.FinalTime <= 0) { this.lilFinalHours.Text = "<span style='Color:red;'>waiting<span>"; } //allow user List <int> listAllowUser = new List <int>(); listAllowUser.Add((int)RolesEnum.PM); listAllowUser.Add((int)RolesEnum.ADMIN); listAllowUser.Add((int)RolesEnum.Leader); if (listAllowUser.Contains(UserInfo.RoleID)) { if (TicketsEntityInfo.IsEstimates) { if (TicketsEntityInfo.Status == TicketsState.PM_Verify_Estimation) { this.btnEsPmTime.Visible = true; } } if (TicketsEntityInfo.Status >= TicketsState.PM_Reviewed && TicketsEntityInfo.Status < TicketsState.Developing && TicketsEntityInfo.Status != TicketsState.Cancelled) { if (!(TicketsEntityInfo.Status == TicketsState.PM_Reviewed && TicketsEntityInfo.InitialTime > 0)) { this.BtnUpdateSc.Visible = true; } } } #endregion #endregion } }
public string GetFeedBackHTML(int createdByID, DateTime createdOn, bool isPublic , string title, string description, string feedbackID, object waitClientFeedback, object waitPMFeedback) { string repley = string.Empty; if (UserInfo.Role == RolesEnum.CLIENT) { if (waitClientFeedback.ToString() == "1") { repley = "Waiting for Client feedback--"; } else if (waitPMFeedback.ToString() == "1") { repley = "Waiting PM feedback--"; } } else if (UserInfo.Role != RolesEnum.CLIENT) { if (waitPMFeedback.ToString() == "1") { repley = "Waiting PM feedback--"; } else if (waitClientFeedback.ToString() == "1") { repley = "Waiting for Client feedback--"; } } StringBuilder stringBuilder = new StringBuilder(); var filesHTML = ShowImageList(feedbackID); if (createdOn.Date != dateCache.Date) { dateCache = createdOn.Date; stringBuilder.Append("<li class=\"fdmessageDate\">" + dateCache.ToString("MM/dd/yyyy") + "</li>"); } if (createdByID != UserInfo.UserID) { stringBuilder.Append("<li class=\"otherbox\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"4\">") .Append("<tbody><tr><td class=\"fdtdLeft\"><div class=\"fdUser\">" + BaseWebsitePage.GetClientUserName(createdByID) + "</div>") .Append("</td>") .Append("<td class=\"fdcontentBox1\" ><div class=\"fdarrowbox1\"><img src=\"/images/fdarrow1.png\"></div><span class=\"fdNotice\">" + repley + "</span>") .Append(description); if (filesHTML.Length > 0) { stringBuilder.Append("<div class=\"fdfileBox\">" + filesHTML + "</div>"); } stringBuilder.Append("</td>") .Append("</tr></tbody></table></li>"); } else { stringBuilder.Append("<li class=\"myselfbox\">") .Append("<table border=\"0\" cellpadding=\"4\" cellspacing=\"0\">") .Append("<tbody><tr><td class=\"fdcontentBox2\"> ") .Append("<div class=\"rightClose\" onclick=\"deleteOwnFeedBack(" + feedbackID + "," + UserInfo.UserID + ")\" title=\"Delete\">×</div>") .Append("<span class=\"fdNotice\">" + repley + "</span>" + description); if (filesHTML.Length > 0) { stringBuilder.Append("<div class=\"fdfileBox\">" + filesHTML + "</div>"); } stringBuilder.Append("</td>") .Append("<td class=\"fdtdright\">") .Append("<div class=\"fdarrowbox2\"><img src=\"/images/fdarrow2.png\"></div>") .Append("<div class=\"fdUser\">" + BaseWebsitePage.GetClientUserName(createdByID) + "</div>") .Append("</td></tr> </tbody></table></li>"); } return(stringBuilder.ToString()); }