public JsonResult Add(MSI_DPSForm _dpsform) { MSIDPSFormDataRepository repository; try { repository = new MSIDPSFormDataRepository(); if (_dpsform.ID > 0) { repository.Update(_dpsform); } else { //Set IsActive as True for every new Record _dpsform.IsActive = true; repository.Add(_dpsform); } } catch (Exception ex) { } //return _dpsform; return Json(_dpsform, JsonRequestBehavior.AllowGet); }
public JsonResult Search(MSI_DPSForm _dpsform) { vwAccount dpsFormData = null; vwAccountRepository viewRepository = null; try { viewRepository = new vwAccountRepository(); if (_dpsform.PIMSAcct != null) { dpsFormData = viewRepository.Get(x => x.ACCOUNT == _dpsform.PIMSAcct); } else { dpsFormData = viewRepository.Get(x => x.OriginalAccount == _dpsform.OriginalAcct); } //Filled data obtained from the Database _dpsform.AcctName = dpsFormData.NAME; _dpsform.CurrentResp = dpsFormData.RESPONSIBILITY; _dpsform.Portfolio = dpsFormData.Portfolio; _dpsform.PIMSAcct = dpsFormData.ACCOUNT; _dpsform.OriginalAcct = dpsFormData.OriginalAccount; _dpsform.GUID = System.Guid.NewGuid().ToString(); } catch (Exception ex) { //We have some issue } //return the Json Object return Json(_dpsform, JsonRequestBehavior.AllowGet); }
public bool PerformFileUploadOperation(MSI_DPSForm _dpsForm, IEnumerable<HttpPostedFileBase> FilesCollection) { Cascade.Data.Repositories.MSIDPSFormDataRepository repository = new MSIDPSFormDataRepository(); string _allMediaDocuments = ""; //set document name if we already have one and already uploaded in the past _allMediaDocuments = (_dpsForm.CheckDocuments == null) ? "" : _dpsForm.CheckDocuments; //get GUID string _additionalIdentifier = Guid.NewGuid().ToString(); //Get all fileNames together so store in the Database foreach (var file in FilesCollection) { if (file != null) { if (_allMediaDocuments.Length > 0) { _allMediaDocuments = _allMediaDocuments + "|" + _additionalIdentifier + "_" + file.FileName; } else { _allMediaDocuments = _additionalIdentifier + "_" + file.FileName; } } } //Now Upload and set the properties foreach (var file in FilesCollection) { if (file != null) { if (file.ContentLength > 0) { //Upload the file fileProcessor.SaveUploadedFileWithIdentifier(file, _additionalIdentifier); } } } if (_allMediaDocuments != "") { //Perform Save Operation _dpsForm.CheckDocuments = _allMediaDocuments; repository.Update(_dpsForm); } //response return true; }