public WardTypeMappingDataDTO GetWardTypeMappingData(string wdm_id) { log.MethodStart(); WardTypeMappingDataDTO objModel = new WardTypeMappingDataDTO(); using (var trans = _db.Database.BeginTransaction()) { try { var objReturn1 = _db.TRWardTypeMappings.FirstOrDefault(x => x.wdm_id.ToString() == wdm_id); objModel = _mapper.Map <WardTypeMappingDataDTO>(objReturn1); trans.Commit(); } catch (Exception ex) { // TODO: Handle failure trans.Rollback(); } finally { trans.Dispose(); } } log.MethodFinish(); return(objModel); }
public async Task <WardTypeMappingDataDTO> GetWardTypeMappingDataAsync(string wdm_Id) { WardTypeMappingDataDTO WardTypeMapping = new WardTypeMappingDataDTO(); WardTypeMapping = await _apiHelper.GetDataByIdAsync <WardTypeMappingDataDTO>("mapping_api/Get_WardTypeMappingData", wdm_Id); return(WardTypeMapping); }
public async Task <WardTypeMappingDataDTO> GetWardTypeMappingDataByModelAsync(WardTypeMappingDataDTO model) { WardTypeMappingDataDTO objList = new WardTypeMappingDataDTO(); objList = await _apiHelper.GetDataByModelAsync <WardTypeMappingDataDTO, WardTypeMappingDataDTO>("mapping_api/Get_WardTypeMappingDataByModel", model); return(objList); }
public async Task <WardTypeMappingDataDTO> SaveWardTypeMappingDataAsync(WardTypeMappingDataDTO model) { if (model.wdm_id.Equals(Guid.Empty)) { model.wdm_id = Guid.NewGuid(); model.wdm_status = 'N'; model.wdm_flagdelete = false; } else { model.wdm_status = 'E'; } model.wdm_updatedate = DateTime.Now; var wardtypemapping = await _apiHelper.PostDataAsync <WardTypeMappingDataDTO>("mapping_api/Post_SaveWardTypeMappingData", model); return(wardtypemapping); }
public WardTypeMappingDataDTO GetWardTypeMappingDataWithModel(WardTypeMappingDataDTO model) { log.MethodStart(); WardTypeMappingDataDTO objModel = new WardTypeMappingDataDTO(); using (var trans = _db.Database.BeginTransaction()) { try { var objReturn1 = _db.TRWardTypeMappings.FirstOrDefault(x => x.wdm_mappingid == model.wdm_mappingid //&& x.wdm_wardtype == model.wdm_wardtype && x.wdm_localwardname == model.wdm_localwardname && x.wdm_flagdelete == false); if (objReturn1 != null) { objModel = _mapper.Map <WardTypeMappingDataDTO>(objReturn1); } trans.Commit(); } catch (Exception ex) { // TODO: Handle failure trans.Rollback(); } finally { trans.Dispose(); } } log.MethodFinish(); return(objModel); }
public WardTypeMappingDataDTO Get_WardTypeMappingDataByModel([FromBody] WardTypeMappingDataDTO model) { var objReturn = _service.GetWardTypeMappingDataWithModel(model); return(objReturn); }
public WardTypeMappingDataDTO Post_SaveWardTypeMappingData([FromBody] WardTypeMappingDataDTO model) { var objReturn = _service.SaveWardTypeMappingData(model); return(objReturn); }
public WardTypeMappingDataDTO SaveWardTypeMappingData(WardTypeMappingDataDTO model) { log.MethodStart(); var currentDateTime = DateTime.Now; WardTypeMappingDataDTO objReturn = new WardTypeMappingDataDTO(); bool chkUpdate = false; using (var trans = _db.Database.BeginTransaction()) { try { var objModel = new TRWardTypeMapping(); objModel = _db.TRWardTypeMappings.FirstOrDefault(x => x.wdm_id == model.wdm_id); if (objModel == null) { objModel = _mapper.Map <TRWardTypeMapping>(model); objModel.wdm_createdate = currentDateTime; objModel.wdm_updatedate = currentDateTime; chkUpdate = true; _db.TRWardTypeMappings.Add(objModel); } else { if ( objModel.wdm_flagdelete != model.wdm_flagdelete || objModel.wdm_wardtype != model.wdm_wardtype || objModel.wdm_warddesc != model.wdm_warddesc || objModel.wdm_localwardname != model.wdm_localwardname) { objModel.wdm_status = model.wdm_status; objModel.wdm_flagdelete = model.wdm_flagdelete; objModel.wdm_wardtype = model.wdm_wardtype; objModel.wdm_warddesc = model.wdm_warddesc; objModel.wdm_localwardname = model.wdm_localwardname; objModel.wdm_updateuser = model.wdm_updateuser; objModel.wdm_updatedate = currentDateTime; chkUpdate = true; } } if (chkUpdate == true) { #region Update Mapping Version.. var objMapping = _db.TRMappings.FirstOrDefault(x => x.mp_id == model.wdm_mappingid); if (objMapping != null) { objMapping = PrepareMappingUpdateVersion(objMapping, model.wdm_updateuser, currentDateTime); } #endregion #region Save Log Process ... _db.LogProcesss.Add(new LogProcess() { log_usr_id = (objModel.wdm_updateuser ?? objModel.wdm_createuser), log_mnu_id = "", log_mnu_name = "WardTypeMapping", log_tran_id = objModel.wdm_id.ToString(), log_action = (objModel.wdm_status == 'N' ? "New" : "Update"), log_desc = "Update WardTypeMapping ", log_createuser = "******", log_createdate = currentDateTime }); #endregion } _db.SaveChanges(); trans.Commit(); objReturn = _mapper.Map <WardTypeMappingDataDTO>(objModel); } catch (Exception ex) { // TODO: Handle failure trans.Rollback(); } finally { trans.Dispose(); } } log.MethodFinish(); return(objReturn); }