Exemple #1
0
        //spCloseClientActivity
        //@FAId int,
        //@success bit,
        //@comments varchar(max),
        //@activityEndDate datetime,
        //@userId varchar(50),
        //@newReportSuccess bit = 0,
        //@newReportComments varchar(max) = NULL
        public static void CloseClientActivity(CloseClientActivity closeClientActivity)
        {
            using (SSCTechImp.CreateInstance())
            {
                using (var db = new SSCTechClientDbCntx())
                {
                    SqlParameter p1 = new SqlParameter("@FAId", closeClientActivity.FAId);
                    SqlParameter p2 = new SqlParameter("@success", closeClientActivity.Success);
                    SqlParameter p3 = new SqlParameter("@comments", closeClientActivity.Comment);
                    SqlParameter p4 = new SqlParameter("@activityEndDate", closeClientActivity.ActivityEndDate);
                    SqlParameter p5 = new SqlParameter("@userId", closeClientActivity.UserName);
                    SqlParameter p6 = new SqlParameter("@newReportSuccess", closeClientActivity.NewReportSuccess);
                    SqlParameter p7 = new SqlParameter("@newReportComments", closeClientActivity.NewReportComment);

                    db.Database.ExecuteSqlCommand("EXEC spCloseClientActivity @FAId, @success, @comments, @activityEndDate, @userId, @newReportSuccess, @newReportComments"
                            , p1, p2, p3, p4, p5, p6, p7);
                }
            }
        }
        public void OnBtnSuccessClick()
        {
            if (ValidateUpload())
            {
                IsUploadInProgress = true;

                using (BackgroundWorker worker = new BackgroundWorker())
                {
                    var uploadFileSize = FileUtility.GetUploadSize(new List<KeyValuePair<string, List<FileDetail>>> {new KeyValuePair<string, List<FileDetail>>(this.OutputViewModel.DirPath, this.OutputViewModel.File),
                        new KeyValuePair<string, List<FileDetail>>(this.ReportsViewModel.DirPath, this.ReportsViewModel.File)
                        //,
                        //new KeyValuePair<string, List<FileDetail>>(this.XMLInvitationViewModel.DirPath, this.XMLInvitationViewModel.File)
                        , new KeyValuePair<string, List<FileDetail>>(this.XMLInvitationViewModel_GDC.DirPath, this.XMLInvitationViewModel_GDC.File)
                        , new KeyValuePair<string, List<FileDetail>>(this.XMLInvitationViewModel_Owners.DirPath, this.XMLInvitationViewModel_Owners.File)
                    });

                    ProgressBarMsg = string.Format("Please wait while files is being uploaded to K-Drive. Do not close the window or the files movement will be interrupted. Size to upload {0}",
                        uploadFileSize.ToFileSize()
                        );

                    SSCTechInfo.UploadFileSize = uploadFileSize;

                    var dt = ProgressTimmer();

                    worker.DoWork += (s, e) =>
                    {
                        IsProgressBarVisible = true;

                        this.XMLInvitationViewModel.File.ForEach(x =>
                        {
                            var match = this.InvitationViewModel.SSCUsers.Where(y => y.GetUserAlias.Equals(x.GetUserAlias, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();

                            if (match == null)
                                x.InvitationUserType = InvitationUserType.None;
                            else
                                x.InvitationUserType = (InvitationUserType)Enum.Parse(typeof(InvitationUserType), match.SSCInvitationUserType.ToString());
                        }
                            );

                        this.XMLInvitationViewModel_GDC.File.ForEach(x =>
                        {
                            var match = this.InvitationViewModel.SSCUsers.Where(y => y.GetUserAlias.Equals(x.GetUserAlias, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();

                            if (match == null)
                                x.InvitationUserType = InvitationUserType.None;
                            else
                                x.InvitationUserType = (InvitationUserType)Enum.Parse(typeof(InvitationUserType), match.SSCInvitationUserType.ToString());
                        }
                            );

                        this.XMLInvitationViewModel_Owners.File.ForEach(x =>
                        {
                            var match = this.InvitationViewModel.SSCUsers.Where(y => y.GetUserAlias.Equals(x.GetUserAlias, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();

                            if (match == null)
                                x.InvitationUserType = InvitationUserType.None;
                            else
                                x.InvitationUserType = (InvitationUserType)Enum.Parse(typeof(InvitationUserType), match.SSCInvitationUserType.ToString());
                        }
                            );

                        SSCTechInfo.OutputCount = this.OutputViewModel.File.Count;
                        SSCTechInfo.ReportsCount = this.ReportsViewModel.File.Count;
                        SSCTechInfo.ReportsFileName = string.Join(",", this.ReportsViewModel.File.Select(x => x.Name));

                        SSCTechInfo.InvitationsCount = this.XMLInvitationViewModel.File.Count;
                        SSCTechInfo.InvitationsFileName = string.Join(",", this.XMLInvitationViewModel.File.Select(x => x.Name));

                        SSCTechInfo.InvitationsCount_GDC = this.XMLInvitationViewModel_GDC.File.Count;
                        SSCTechInfo.InvitationsFileName_GDC = string.Join(",", this.XMLInvitationViewModel_GDC.File.Select(x => x.Name));

                        SSCTechInfo.InvitationsCount_Owners = this.XMLInvitationViewModel_Owners.File.Count;
                        SSCTechInfo.InvitationsFileName_Owners = string.Join(",", this.XMLInvitationViewModel_Owners.File.Select(x => x.Name));

                        var uploadZipName = FileUtility.MoveFile(
                        new KeyValuePair<string, List<FileDetail>>(this.OutputViewModel.DirPath, this.OutputViewModel.File),
                        new KeyValuePair<string, List<FileDetail>>(this.ReportsViewModel.DirPath, this.ReportsViewModel.File),

                        new KeyValuePair<string, List<FileDetail>>(this.XMLInvitationViewModel.DirPath, this.XMLInvitationViewModel.File),
                        new KeyValuePair<string, List<FileDetail>>(this.XMLInvitationViewModel_GDC.DirPath, this.XMLInvitationViewModel_GDC.File),
                        new KeyValuePair<string, List<FileDetail>>(this.XMLInvitationViewModel_Owners.DirPath, this.XMLInvitationViewModel_Owners.File),
                        RequestInfo.SSCTechActivity.IsGDC,

                        RequestInfo.SSCTechActivity.RootUploadKDrivePath,
                        RequestInfo.SSCTechActivity.SurveyRowID,
                        RequestInfo.SSCTechActivity.FAId,
                        RequestInfo.SSCTechActivity.IsRFRequest,
                        RequestInfo.SSCTechActivity.OutputFileName,
                        RequestInfo.SSCTechActivity.IsProjectCodeAvailable,
                        RequestInfo.SSCTechActivity.IsEngPreservation,
                        RequestInfo.SSCTechActivity.EngagementNumber
                        );

                        SSCTechInfo.UploadFileName = uploadZipName;

                        var closeClientActivity = new CloseClientActivity
                        {
                            FAId = RequestInfo.SSCTechActivity.FAId,
                            Success = true,
                            Comment = "",
                            ActivityEndDate = DateTime.Now.ToUniversalTime(),
                            NewReportComment = "",
                            NewReportSuccess = RequestInfo.IsReportGenerated
                        };

                        if (!IsDemo)
                        {
                            if (!AppNEnvConfig.IsDebug)
                                RepOperation.CloseClientActivity(closeClientActivity);

                            if (RequestInfo.SSCTechActivity.IsRFRequest)
                                RepOperation.UpdateRollForwardTransactions(this.RequestInfo);
                        }
                    };

                    worker.RunWorkerCompleted += (s, e) =>
                    {
                        dt.Stop();
                        IsUploadInProgress = false;

                        if (e.Error != null)
                        {
                            IsProgressBarVisible = false;
                            IsBusy = false;
                            SSCLog.HandleError(e.Error);
                        }
                        else
                        {
                            SSCTechInfo.TimeInSecToUploadToKDrive = currentStartTimmer;
                            SSCTechInfo.Result = "Success";
                            RefreshFileView();

                            IsProgressBarVisible = false;
                            IsBusy = false;
                            MsgUtility.ShowMessageBox("Files uploaded successfully.", MessageType.Info);
                        }
                    };

                    IsBusy = true;

                    worker.RunWorkerAsync();
                }
            }
        }
        private void SaveFailure()
        {
            if (string.IsNullOrWhiteSpace(RequestInfo.FailureComment))
            {
                MsgUtility.ShowMessageBox("Please enter the reason for failure.", MessageType.Warning);
                return;
            }

            using (BackgroundWorker worker = new BackgroundWorker())
            {
                worker.DoWork += (s, e) =>
                {
                    var closeClientActivity = new CloseClientActivity
                    {
                        FAId = RequestInfo.SSCTechActivity.FAId,
                        Success = false,
                        Comment = RequestInfo.FailureComment,
                        ActivityEndDate = DateTime.Now.ToUniversalTime(),
                        NewReportComment = "",
                        NewReportSuccess = false
                    };

                    if (!IsDemo)
                        RepOperation.CloseClientActivity(closeClientActivity);
                };

                worker.RunWorkerCompleted += (s, e) =>
                {
                    if (e.Error != null)
                    {
                        IsBusy = false;
                        SSCLog.HandleError(e.Error);
                    }
                    else
                    {
                        ToSkip = false;
                        RequestInfo.IsFailure = false;
                        SSCTechInfo.Result = "Fail";
                        SSCTechInfo.Comment = RequestInfo.FailureComment;

                        RefreshFileView();

                        IsBusy = false;
                        MsgUtility.ShowMessageBox("Request failed.", MessageType.Info);
                    }
                };

                IsBusy = true;

                worker.RunWorkerAsync();
            }
        }
Exemple #4
0
 public static void CloseClientActivity(CloseClientActivity closeClientActivity)
 {
     TechOperation.CloseClientActivity(closeClientActivity);
 }