public ActionResult SavePdv(PdvEntity pdv) { bool isSaved = false; DataAccessAdapterBase adapter = Helper.GetDataAccessAdapter(User.Identity.Name); using (adapter) { adapter.StartTransaction(System.Data.IsolationLevel.Serializable, "SavePdv"); PdvEntity pdv4Save; if (pdv.PdvId == 0) { pdv4Save = pdv; pdv4Save.FirmaId = UserEntity.GetFirmaId(adapter, User.Identity.Name); } else { pdv4Save = PdvEntity.FetchPdv(adapter, null, pdv.PdvId); pdv4Save.UpdateDataFromOtherObject(pdv, null, null); } isSaved = adapter.SaveEntity(pdv4Save); adapter.Commit(); } dynamic response = new { IsSaved = isSaved }; return(CreateJsonResponse(response)); }
public ActionResult GetPdv(long pdvId) { using (DataAccessAdapterBase adapter = Helper.GetDataAccessAdapter()) { PdvEntity pdv = PdvEntity.FetchPdv(adapter, null, pdvId); return(CreateJsonResponse(pdv)); } }
public ActionResult GetPdvCollection() { using (DataAccessAdapterBase adapter = Helper.GetDataAccessAdapter()) { long firmaId = UserEntity.GetFirmaId(adapter, User.Identity.Name); RelationPredicateBucket bucket = new RelationPredicateBucket(PdvFields.FirmaId == firmaId); IEnumerable <PdvEntity> pdvCollection = PdvEntity.FetchPdvCollection(adapter, bucket, null); return(CreateJsonResponse(pdvCollection)); } }
protected override void SetDataSource(DataAccessAdapterBase adapter, RelationPredicateBucket bucket, int pageNumber, int pageSize, string sortField, bool isSortAscending) { this.DataSource = PdvEntity.FetchPdvCollectionForPaging(adapter, bucket, null, pageNumber, pageSize, sortField, isSortAscending); this.NoOfRecords = PdvEntity.GetNumberOfEntities(adapter, bucket); }