Beispiel #1
0
        public async Task <CandidateSubmissionSpendViewModel> InsertCandidateExpenseSpent(CandidateSubmissionSpendViewModel data)
        {
            try
            {
                foreach (var a in data.Files)
                {
                    CandidateSubmissionSpendFilesViewModel submittedfiles = new CandidateSubmissionSpendFilesViewModel();
                    var file = await Task.Run(() => ManageCandidate.InsertFiles(a.ConvertTotblFile()));

                    submittedfiles.FileID           = file.ID;
                    submittedfiles.createdUserID    = a.createdUserID;
                    submittedfiles.createdTimestamp = a.createdTimestamp;
                    submittedfiles.updatedTimestamp = a.updatedTimestamp;
                    submittedfiles.updatedUserID    = a.updatedUserID;
                    data.CandidateSubmissionSpendFiles.Add(submittedfiles);
                }

                tblCandidateSubmissionSpend res = await Task.Run(() => ManageCandidateSubmissionSpend.InsertCandidateSubmissionSpend(data.ConvertTotblCandidateSubmissionSpend()));

                return(res.ConvertToCandidateSubmissionSpendViewModel());
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Beispiel #2
0
        public async Task <List <CandidateSubmissionSpendViewModel> > GetCandidateExpenseSpend(long PlacementId)
        {
            try
            {
                List <tblCandidateSubmissionSpend> res = await Task.Run(() => ManageCandidateSubmissionSpend.GetCandidateExpenseSpends(PlacementId));

                return(res.Select(x => x.ConvertToCandidateSubmissionSpendViewModel()).ToList());
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Beispiel #3
0
        public async Task <CandidateSubmissionSpendViewModel> GetExpenseDetails(long ExpenseId)
        {
            try
            {
                tblCandidateSubmissionSpend res = await Task.Run(() => ManageCandidateSubmissionSpend.GetExpenseDetails(ExpenseId));

                return(res.ConvertToCandidateSubmissionSpendViewModel());
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #4
0
        public async Task <CandidateSubmissionSpendViewModel> UpdateCandidateExpenseSpent(CandidateSubmissionSpendViewModel data)
        {
            try
            {
                foreach (var a in data.Files)
                {
                    CandidateSubmissionSpendFilesViewModel submittedfiles = new CandidateSubmissionSpendFilesViewModel();
                    var file = await Task.Run(() => ManageCandidate.InsertFiles(a.ConvertTotblFile()));

                    submittedfiles.FileID           = file.ID;
                    submittedfiles.createdUserID    = a.createdUserID;
                    submittedfiles.createdTimestamp = a.createdTimestamp;
                    submittedfiles.updatedTimestamp = a.updatedTimestamp;
                    submittedfiles.updatedUserID    = a.updatedUserID;
                    data.CandidateSubmissionSpendFiles.Add(submittedfiles);
                }

                await Task.Run(() => ManageCandidateSubmissionSpendFiles.DeleteCandidateSubmissionSpendFiles(data.ID));

                data.CandidateSubmissionSpendFiles.All(x => { x.SpendID = data.ID; return(true); });

                tblCandidateSubmissionSpend res = await Task.Run(() => ManageCandidateSubmissionSpend.UpdateCandidateSubmissionSpend(data.ConvertTotblCandidateSubmissionSpend()));



                List <tblCandidateSubmissionSpendFile> submittedFiles = await Task.Run(() => ManageCandidateSubmissionSpendFiles.InsertCandidateSubmissionSpendFiles(data.CandidateSubmissionSpendFiles.Select(x => x.ConvertTotblCandidateSubmissionSpendFile()).ToList()));

                data.CandidateSubmissionSpendFiles = submittedFiles.Select(x => x.ConvertToCandidateSubmissionSpendFilesViewModel()).ToList();

                return(data);
            }
            catch (Exception)
            {
                throw;
            }
        }