コード例 #1
0
ファイル: ProjectsView.xaml.cs プロジェクト: Taras-Pakizh/TMS
        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);
            }
        }
コード例 #2
0
    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);
    }
コード例 #3
0
        // 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());
        }
コード例 #4
0
ファイル: ProjectsView.xaml.cs プロジェクト: Taras-Pakizh/TMS
        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
            {
            }
        }
コード例 #5
0
 public bool Refuse(ApproveView approveView)
 {
     return(IaddressBookInfo.Refuse(approveView));
 }
コード例 #6
0
 public bool Agree(ApproveView approveView)
 {
     return(IaddressBookInfo.Agree(approveView));
 }