コード例 #1
0
        public int Add(FileHeader fileHeaderObj, bool doSubmit)
        {
            //Set lastmodified fields
            fileHeaderObj.LastModifiedBy = _SessionUsr.ID;
            fileHeaderObj.LastModifiedDate = DateTime.Now;

            dbc.FileHeaders.InsertOnSubmit(fileHeaderObj);
            if (doSubmit) dbc.SubmitChanges();

            return fileHeaderObj.ID; // Return the 'newly inserted id'
        }
コード例 #2
0
        public int AddEdit(FileHeader fileHeaderObj, bool doSubmit)
        {
            fileHeaderObj.UploadedOn = Defaults.getValidDate(fileHeaderObj.UploadedOn); // special case to ensure valid SQLDate
            if (fileHeaderObj.ID <= Defaults.Integer) // Insert
                return Add(fileHeaderObj, doSubmit);

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

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

                if (doSubmit) //Make a FINAL submit instead of periodic updates
                   dbc.SubmitChanges();
            }

            return fileHeaderObj.ID;
        }
コード例 #3
0
 FileHeader Transform(FileHeader f, string fileHeaderBy, string fileTypeTitle, int claimID)
 {
     /*also set .Claim = null to avoid issues during serialization but persist ClaimID as ClaimID1 */
     return f.Set(f1 =>
     {
         f1.UploadedBy = fileHeaderBy; f1.FileTypeTitle = fileTypeTitle; f1.ClaimGUID = f1.ClaimID.ToString();
         /*f1.Claim = null; f1.ClaimID1 = claimID;
          NOT needed because we've set the Association Access to Internal in the dbml*/});
 }
コード例 #4
0
ファイル: CPM.designer.cs プロジェクト: HSG-PSG-1/CPM_Source
		private void detach_FileHeaders(FileHeader entity)
		{
			this.SendPropertyChanging();
			entity.Claim = null;
		}
コード例 #5
0
 public void Delete(FileHeader fileHeaderObj, bool doSubmit)
 {
     dbc.FileHeaders.DeleteOnSubmit(dbc.FileHeaders.Single(f => f.ID == fileHeaderObj.ID));
     if (doSubmit) dbc.SubmitChanges();
 }
コード例 #6
0
ファイル: CPM.designer.cs プロジェクト: HSG-PSG-1/CPM_Source
 partial void DeleteFileHeader(FileHeader instance);
コード例 #7
0
ファイル: CPM.designer.cs プロジェクト: HSG-PSG-1/CPM_Source
		private void attach_FileHeaders(FileHeader entity)
		{
			this.SendPropertyChanging();
			entity.Claim = this;
		}
コード例 #8
0
ファイル: CPM.designer.cs プロジェクト: HSG-PSG-1/CPM_Source
 partial void UpdateFileHeader(FileHeader instance);
コード例 #9
0
ファイル: CPM.designer.cs プロジェクト: HSG-PSG-1/CPM_Source
 partial void InsertFileHeader(FileHeader instance);
コード例 #10
0
ファイル: CPM.designer.cs プロジェクト: HSG-PSG-1/CPM_Source
		private void detach_FileHeaders(FileHeader entity)
		{
			this.SendPropertyChanging();
			entity.MasterFileTypeHeader = null;
		}
コード例 #11
0
        public JsonResult FilesKOVM(int ClaimID, string ClaimGUID, int? FileID)
        {
            //Set File object
            FileHeader newObj = new FileHeader() { ID = -1, _Added = true, ClaimID = ClaimID, ClaimGUID = ClaimGUID,
                UploadedBy = _SessionUsr.Email, LastModifiedBy = _SessionUsr.ID, LastModifiedDate = DateTime.Now, UploadedOn = DateTime.Now,
                UserID = _SessionUsr.ID, Archived = false, FileName="", FileNameNEW="" };

            List<FileHeader> files = new List<FileHeader>();
            DAL.FileKOModel vm = new FileKOModel()
            {
                FileToAdd = newObj, EmptyFileHeader = newObj,
                AllFiles = (new FileHeaderService().Search(ClaimID, null))
            };
            // Lookup data
            vm.FileTypes = new LookupService().GetLookup(LookupService.Source.FileHeader);

            return Json(vm, JsonRequestBehavior.AllowGet);
        }
コード例 #12
0
        public ActionResult FilePostKO(int ClaimID, string ClaimGUID, FileHeader FileHdrObj)
        {
            HttpPostedFileBase hpFile = Request.Files["FileNameNEW"];
            bool success = true;
            string result = "";// "Uploaded " + hpFile.FileName + "(" + hpFile.ContentLength + ")";

            #region New file upload

            if ((FileHdrObj.FileNameNEW ?? FileHdrObj.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
                FileHdrObj.IsAsync = true;
                //FileHdrObj.ClaimGUID = _Session.Claim.ClaimGUID; // to be used further
                #region Old code (make sure the function 'ChkAndSaveClaimFile' does all of it)
                //string docName = string.Empty;
                //FileIO.result uploadResult = SaveClaimFile(Request.Files["FileNameNEW"], ref docName, ClaimID, true);

                //if (uploadResult != FileIO.result.successful)
                //    if (uploadResult == FileIO.result.duplicate)
                //        ModelState.AddModelError("FileName", "Duplicate file found");
                //    else
                //        ModelState.AddModelError("FileName", "Unable to upload file");
                #endregion
                FileHdrObj.FileName = ChkAndSaveClaimFile("FileNameNEW", ClaimID, HeaderFM, FileHdrObj.ClaimGUID);
                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), "fileOprMsg",
                "fileUploadResponse('" + FileHdrObj.CodeStr + "'," + success.ToString().ToLower() + "," + FileHdrObj.ID + ")"), "text/xml");
        }