public int Add(ClaimDetail detailObj, bool doSubmit)
        {
            //Set lastmodified fields
            detailObj.LastModifiedBy = _SessionUsr.ID;
            detailObj.LastModifiedDate = DateTime.Now;

            dbc.ClaimDetails.InsertOnSubmit(detailObj);
            if(doSubmit) dbc.SubmitChanges();

            return detailObj.ID; // Return the 'newly inserted id'
        }
        public ActionResult ItemsKOVM(int ClaimID)
        {
            //Set Item object
            ClaimDetail newObj = new ClaimDetail() { ID = 0, _Added = true, ClaimID = ClaimID, LastModifiedBy = _SessionUsr.ID, LastModifiedDate = DateTime.Now, Archived = false, aDFilesJSON = "" };

            DAL.ItemKOModel vm = new ItemKOModel()
            {
                 ItemToAdd = newObj, EmptyItem = newObj,
                 AllItems = new ClaimDetailService().Search(ClaimID, null)
            };

            // Lookup data
            vm.Defects = new LookupService().GetLookup(LookupService.Source.Defect);

            vm.showGrid = true;
            return Json(vm, JsonRequestBehavior.AllowGet);
        }
        public int AddEdit(ClaimDetail detailObj, bool doSubmit)
        {
            if (detailObj.ID <= Defaults.Integer) // Insert
                return Add(detailObj,doSubmit);

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

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

                if (doSubmit) dbc.SubmitChanges();
            }

            return detailObj.ID;
        }
 public void Delete(ClaimDetail detailObj, bool doSubmit)
 {
     dbc.ClaimDetails.DeleteOnSubmit(dbc.ClaimDetails.Single(c => c.ID == detailObj.ID));
     if(doSubmit) dbc.SubmitChanges();
 }
 ClaimDetail Transform(ClaimDetail c, string ItemCode, string Defect)
 {
     return c.Set(c1 => { c1.ItemCode = ItemCode; c1.Defect = Defect; });
 }
示例#6
0
		private void detach_ClaimDetails(ClaimDetail entity)
		{
			this.SendPropertyChanging();
			entity.Claim = null;
		}
示例#7
0
		private void attach_ClaimDetails(ClaimDetail entity)
		{
			this.SendPropertyChanging();
			entity.MasterDefect = this;
		}
示例#8
0
 partial void DeleteClaimDetail(ClaimDetail instance);
示例#9
0
 partial void UpdateClaimDetail(ClaimDetail instance);
示例#10
0
 partial void InsertClaimDetail(ClaimDetail instance);