public List <QCRangeDTO> GetListWithModel(QCRangeDTO searchModel) { log.MethodStart(); List <QCRangeDTO> objList = new List <QCRangeDTO>(); //var searchModel = JsonSerializer.Deserialize<MenuSearchDTO>(param); using (var trans = _db.Database.BeginTransaction()) { try { objList = _db.QCRangeDTOs.FromSqlRaw <QCRangeDTO>("sp_GET_TCQCRange {0}", searchModel.qcr_mst_code).ToList(); //objList = _mapper.Map<List<QCRangeDTO>>(objDataList); trans.Commit(); } catch (Exception ex) { // TODO: Handle failure trans.Rollback(); } finally { trans.Dispose(); } } log.MethodFinish(); return(objList); }
public string CheckDuplicate(QCRangeDTO model) { log.MethodStart(); string objReturn = ""; using (var trans = _db.Database.BeginTransaction()) { try { var objResult = _db.TCQCRanges.Any(x => x.qcr_code == model.qcr_code); if (objResult == true) { objReturn = "Dup"; } trans.Commit(); } catch (Exception ex) { // TODO: Handle failure log.Error(ex.Message); trans.Rollback(); } finally { trans.Dispose(); } } log.MethodFinish(); return(objReturn); }
public QCRangeDTO GetData(string qcr_code) { log.MethodStart(); QCRangeDTO objModel = new QCRangeDTO(); using (var trans = _db.Database.BeginTransaction()) { try { var objReturn1 = _db.TCQCRanges.FirstOrDefault(x => x.qcr_code == qcr_code); objModel = _mapper.Map <QCRangeDTO>(objReturn1); trans.Commit(); } catch (Exception ex) { // TODO: Handle failure trans.Rollback(); } finally { trans.Dispose(); } } log.MethodFinish(); return(objModel); }
public async Task <QCRangeDTO> GetDataAsync(string mst_code) { QCRangeDTO menu = new QCRangeDTO(); menu = await _apiHelper.GetDataByIdAsync <QCRangeDTO>("qcrange_api/Get_Data", mst_code); return(menu); }
public async Task <List <QCRangeDTO> > GetListByModelActiveAsync(QCRangeDTO searchData) { List <QCRangeDTO> objList = new List <QCRangeDTO>(); objList = await _apiHelper.GetDataListByModelAsync <QCRangeDTO, QCRangeDTO>("qcrange_api/Get_List_Active_ByModel", searchData); return(objList); }
public QCRangeDTO Post_SaveData([FromBody] QCRangeDTO model) { var objReturn = _service.SaveData(model); //var objReturn = _service.GetList(); return(objReturn); }
public async Task <List <QCRangeDTO> > GetListByParamAsync(QCRangeDTO searchData) { List <QCRangeDTO> objList = new List <QCRangeDTO>(); var searchJson = JsonSerializer.Serialize(searchData); objList = await _apiHelper.GetDataListByParamsAsync <QCRangeDTO>("qcrange_api/Get_List", searchJson); return(objList); }
public async Task <QCRangeDTO> SaveDataAsync(QCRangeDTO model) { //MenuDTO menu = new MenuDTO() //{ // mnu_id = "2", // mnu_name = "TEST_name", // mnu_area = "TEST_area", // mnu_controller = "TEST_controller" //}; var menua = await _apiHelper.PostDataAsync <QCRangeDTO>("qcrange_api/Post_SaveData", model); return(menua); }
public QCRangeDTO SaveData(QCRangeDTO model) { log.MethodStart(); var currentDateTime = DateTime.Now; var currentUser = ""; QCRangeDTO objReturn = new QCRangeDTO(); using (var trans = _db.Database.BeginTransaction()) { try { var objModel = new TCQCRange(); if (model.qcr_status == "E") { objModel = _db.TCQCRanges.FirstOrDefault(x => x.qcr_id == model.qcr_id); } if (model.qcr_status == "N") { objModel = _mapper.Map <TCQCRange>(model); objModel.GUIDELINE = model.qcr_mst_GUIDELINE; objModel.ORGANISM = model.qcr_mst_ORGANISM; objModel.ANTIBIOTIC = model.qcr_mst_ANTIBIOTIC; objModel.QC_RANGE = model.qcr_mst_QC_RANGE; objModel.qcr_status = objModel.qcr_active == true ? "A" : "I"; objModel.qcr_createdate = currentDateTime; currentUser = objModel.qcr_createuser; _db.TCQCRanges.Add(objModel); } else if (model.qcr_status == "E") { objModel.qcr_code = model.qcr_code; objModel.GUIDELINE = model.qcr_mst_GUIDELINE; objModel.ORGANISM = model.qcr_mst_ORGANISM; objModel.ANTIBIOTIC = model.qcr_mst_ANTIBIOTIC; objModel.QC_RANGE = model.qcr_mst_QC_RANGE; objModel.qcr_active = model.qcr_active; objModel.qcr_status = objModel.qcr_active == true ? "A" : "I"; objModel.qcr_updateuser = model.qcr_updateuser; objModel.qcr_updatedate = currentDateTime; currentUser = objModel.qcr_updateuser; //_db.TCHospitals.Update(objModel); } #region Save Log Process ... _db.LogProcesss.Add(new LogProcess() { log_usr_id = currentUser, log_mnu_id = "", log_mnu_name = "QCRange", log_tran_id = $"{objModel.qcr_mst_code}:{objModel.qcr_code}", log_action = (model.qcr_status == "N" ? "New" : "Update"), log_desc = (model.qcr_status == "N" ? "New" : "Update") + " QCRange " + objModel.qcr_code, log_createuser = currentUser, log_createdate = currentDateTime }); #endregion _db.SaveChanges(); trans.Commit(); } catch (Exception ex) { // TODO: Handle failure trans.Rollback(); } finally { trans.Dispose(); } } log.MethodFinish(); return(objReturn); }
public IEnumerable <QCRangeDTO> Get_List_Active_ByModel([FromBody] QCRangeDTO searchModel) { var objReturn = _service.GetList_Active_WithModel(searchModel); return(objReturn); }