public JsonResult AddPutback(MSI_PutBackForm _putbackform) { MSIPutBackFormRepository repository; _putbackform.IsActive = true; try { repository = new MSIPutBackFormRepository(); if (_putbackform.ID > 0) { repository.Update(_putbackform); } else { repository.Add(_putbackform); } } catch (Exception ex) { } //return _dpsform; return Json(_putbackform, JsonRequestBehavior.AllowGet); }
public bool PerformFileUploadOperationPutBack(MSI_PutBackForm _putbackForm, IEnumerable<HttpPostedFileBase> FilesCollection) { Cascade.Data.Repositories.MSIPutBackFormRepository repository = new MSIPutBackFormRepository(); string _allMediaDocuments = ""; //set document name if we already have one and already uploaded in the past _allMediaDocuments = (_putbackForm.CheckDocuments == null) ? "" : _putbackForm.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 _putbackForm.CheckDocuments = _allMediaDocuments; repository.Update(_putbackForm); } //response return true; }