Пример #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;
            }
        }
Пример #2
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;
            }
        }
Пример #3
0
 public static tblCandidateSubmissionSpendFile ConvertTotblCandidateSubmissionSpendFile(this CandidateSubmissionSpendFilesViewModel data)
 {
     return(new tblCandidateSubmissionSpendFile()
     {
         ID = Convert.ToInt64(data.ID),
         SpendID = data.SpendID,
         FileID = data.FileID,
         IsActive = data.isActive,
         IsDeleted = data.isDeleted ?? false,
         CreatedUserID = data.createdUserID,
         UpdatedUserID = data.updatedUserID,
         CreatedTimestamp = data.createdTimestamp ?? DateTime.Now,
         UpdatedTimestamp = data.updatedTimestamp
     });
 }