public void DeclineReport(TaskView _task) { try { int selectedProject = GetClickedProjectId(); MessageDecline messageWindow = new MessageDecline(); if (messageWindow.ShowDialog() == true) { if (messageWindow.Message != "") { TaskView task = services.Get <TaskView>(_task.Id); var project = services.Get <ProjectView>(_task.projectId); var projectName = project.name; var projectTask = task.description; ReportView _report = services.Get <ReportView>(_task.report_id); _report.status = TMS.Data.ReportStatus.Declined; var engineer = services.Get <UserView>(_report.engineerId); var email = engineer.email; services.Update <ReportView>(_report); SendEmail(messageWindow.Message, email, projectName, projectTask); ApproveView apprView = services.Get <ApproveView>(_task.approveId); apprView.isApproved = false; apprView.rootCase = messageWindow.Message; apprView.reportId = _report.Id; services.Update <ApproveView>(apprView); if (chkOpen.IsChecked == true) { dgTasks.ItemsSource = GetTasksWithReports().Where(x => x.projectId == selectedProject && x.status == TMS.Data.ReportStatus.Open); } if (chkAproved.IsChecked == true) { dgTasks.ItemsSource = GetTasksWithReports().Where(x => x.projectId == selectedProject && x.status == TMS.Data.ReportStatus.Approved); } if (chkDecline.IsChecked == true) { dgTasks.ItemsSource = GetTasksWithReports().Where(x => x.projectId == selectedProject && x.status == TMS.Data.ReportStatus.Declined); } MessageBox.Show($"The Report has been declined! {engineer.FullName} will be informed by email."); } else { MessageBox.Show("Please, enter the reason of decline"); } } else { } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public bool Agree(ApproveView approveView) { bool result = false; try { TransactionOptions transactionOptions = new TransactionOptions(); transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.RepeatableRead; transactionOptions.Timeout = new TimeSpan(0, 1, 0); using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, transactionOptions, EnterpriseServicesInteropOption.Automatic)) { try { bool isHandled = IcommunityInfo.IsApplicationHandled(approveView); if (isHandled == false) { //同意加入处理 bool isMember = IcommunityInfo.IsMember(approveView.MemberID, approveView.CommunityID); if (isMember == false) { result = IcommunityInfo.MemberAgree(approveView); } } ts.Complete(); } catch (Exception ex) { Config.IlogicLogService.Write(new LogicLog() { AppName = Config.AppName, ClassName = ClassName, NamespaceName = NamespaceName, MethodName = MethodBase.GetCurrentMethod().Name, Message = ex.Message, Oper = Config.Oper }); ts.Dispose(); } } } catch (Exception ex) { Config.IlogicLogService.Write(new LogicLog() { AppName = Config.AppName, ClassName = ClassName, NamespaceName = NamespaceName, MethodName = MethodBase.GetCurrentMethod().Name, Message = ex.Message, Oper = Config.Oper }); } return(result); }
// PUT api/Report public IHttpActionResult Put([FromBody] ApproveView model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { service.Update(model); } catch (Exception e) { BadRequest(e.Message); } return(Ok()); }
public void ApprovedReport(TaskView _task) { ConfirmWindow confirmWindow = new ConfirmWindow(); int selectedProject = GetClickedProjectId(); if (confirmWindow.ShowDialog() == true) { try { TaskView task = services.Get <TaskView>(_task.Id); ReportView _report = services.Get <ReportView>(_task.report_id); _report.status = TMS.Data.ReportStatus.Approved; services.Update <ReportView>(_report); ApproveView apprView = services.Get <ApproveView>(_task.approveId); apprView.isApproved = true; apprView.rootCase = "Approved"; apprView.reportId = _report.Id; services.Update <ApproveView>(apprView); if (chkOpen.IsChecked == true) { dgTasks.ItemsSource = GetTasksWithReports().Where(x => x.projectId == selectedProject && x.status == TMS.Data.ReportStatus.Open); } if (chkAproved.IsChecked == true) { dgTasks.ItemsSource = GetTasksWithReports().Where(x => x.projectId == selectedProject && x.status == TMS.Data.ReportStatus.Approved); } if (chkDecline.IsChecked == true) { dgTasks.ItemsSource = GetTasksWithReports().Where(x => x.projectId == selectedProject && x.status == TMS.Data.ReportStatus.Declined); } MessageBox.Show("The report has been successfully approved!"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { } }
public bool Refuse(ApproveView approveView) { return(IaddressBookInfo.Refuse(approveView)); }
public bool Agree(ApproveView approveView) { return(IaddressBookInfo.Agree(approveView)); }