Пример #1
0
        public ActionResult FileDetailPostKO(int ClaimID, int ClaimDetailD, string ClaimGUID, FileDetail FileDetailObj)
        {
            HttpPostedFileBase hpFile = Request.Files["FileDetailNameNEW"];
            bool success = true;
            string result = "";// "Uploaded " + hpFile.FileName + "(" + hpFile.ContentLength + ")";

            #region New file upload

            if ((FileDetailObj.FileNameNEW ?? FileDetailObj.FileName) != null)
            {//HT Delete old\existing file? For Async need to wait until final commit
                //HT:IMP: Set Async so that now the file maps to Async file-path
                FileDetailObj.IsAsync = true;
                //FileDetailObj.ClaimGUID = _Session.Claim.ClaimGUID; // to be used further
                FileDetailObj.FileName = ChkAndSaveClaimFile("FileDetailNameNEW", ClaimID, DetailFM, FileDetailObj.ClaimGUID, ClaimDetailD);
                success = (ModelState["FileName"].Errors.Count() < 1);
            }

            #endregion

            result = !success ? ("Unable to upload file - " + ModelState["FileName"].Errors[0].ErrorMessage) : "";

            //Taconite XML
            return this.Content(Defaults.getTaconiteResult(success,
                Defaults.getOprResult(success, result), "fileDetailOprMsg",
                "fileDUploadResponse('" + FileDetailObj.CodeStr + "'," + success.ToString().ToLower() + "," + FileDetailObj.ID + ")"), "text/xml");
        }
Пример #2
0
        public int Add(FileDetail fileDetailObj, bool doSubmit)
        {
            //Set lastmodified fields
            fileDetailObj.LastModifiedBy = _SessionUsr.ID;
            fileDetailObj.LastModifiedDate = DateTime.Now;

            dbc.FileDetails.InsertOnSubmit(fileDetailObj);
            if(doSubmit) dbc.SubmitChanges();

            return fileDetailObj.ID; // Return the 'newly inserted id'
        }
Пример #3
0
        public int AddEdit(FileDetail fileDetailObj, bool doSubmit)
        {
            fileDetailObj.UploadedOn = Defaults.getValidDate(fileDetailObj.UploadedOn); // special case to ensure valid SQLDate
            if (fileDetailObj.ID <= Defaults.Integer) // Insert
                return Add(fileDetailObj, doSubmit);

            else
            {
                #region Update
                //Set lastmodified fields
                fileDetailObj.LastModifiedBy = _SessionUsr.ID;
                fileDetailObj.LastModifiedDate = DateTime.Now;

                dbc.FileDetails.Attach(fileDetailObj);//attach the object as modified
                dbc.Refresh(System.Data.Linq.RefreshMode.KeepCurrentValues, fileDetailObj);//Optimistic-concurrency (simplest solution)
                #endregion

                if(doSubmit) dbc.SubmitChanges();
            }

            return fileDetailObj.ID;
        }
Пример #4
0
 FileDetail Transform(FileDetail f, string fileDetailBy, string fileTypeTitle)
 {
     return f.Set(f1 => { f1.UploadedBy = fileDetailBy; f1.FileTypeTitle = fileTypeTitle; f1.ClaimGUID = f1.ClaimID.ToString(); });
 }
Пример #5
0
 public void Delete(FileDetail fileDetailObj, bool doSubmit)
 {
     dbc.FileDetails.DeleteOnSubmit(dbc.FileDetails.Single(f => f.ID == fileDetailObj.ID));
     if(doSubmit) dbc.SubmitChanges();
 }
Пример #6
0
 partial void DeleteFileDetail(FileDetail instance);
Пример #7
0
 partial void UpdateFileDetail(FileDetail instance);
Пример #8
0
 partial void InsertFileDetail(FileDetail instance);
Пример #9
0
		private void detach_FileDetails(FileDetail entity)
		{
			this.SendPropertyChanging();
			entity.MasterFileTypeDetail = null;
		}
Пример #10
0
		private void detach_FileDetails(FileDetail entity)
		{
			this.SendPropertyChanging();
			entity.ClaimDetail = null;
		}
Пример #11
0
        public JsonResult FilesDetailKOVM(int ClaimID, int ClaimDetailID, string ClaimGUID)
        {
            //Set File object
            FileDetail newObj = new FileDetail()
            {
                ID = -1,
                _Added = true,
                ClaimID = ClaimID,
                ClaimDetailID = ClaimDetailID,
                ClaimGUID = ClaimGUID,
                UploadedBy = _SessionUsr.Email,
                LastModifiedBy = _SessionUsr.ID,
                LastModifiedDate = DateTime.Now,
                UploadedOn = DateTime.Now,
                UserID = _SessionUsr.ID,
                Archived = false,
                FileName = "",
                FileNameNEW = ""
            };

            DAL.FileDetailKOModel vm = new FileDetailKOModel()
            {
                FileDetailToAdd = newObj, EmptyFileDetail = newObj,
                AllFiles = new FileDetailService().Search(ClaimID, ClaimDetailID)
            };
            // Lookup data
            vm.FileDetailTypes = new LookupService().GetLookup(LookupService.Source.FileDetail);

            return Json(vm, JsonRequestBehavior.AllowGet);
        }