public string InsertRow(VaiTroModels clParam) { logger.Start("InsertRow"); string strResult = ""; try { sqlMap.BeginTransaction(); Hashtable param = new Hashtable(); param = base.SetDataToHashtable(false, clParam); param["seqname"] = "seq_vb_capdouutien"; string strid = sqlMap.ExecuteQueryForObject("Common.GetNextVal", param).ToString(); param["macapdouutien"] = strid; sqlMap.Insert("m_vaitro.InsertRow", param); sqlMap.CommitTransaction(); strResult = param["macapdouutien"].ToString(); } catch (Exception ex) { sqlMap.RollbackTransaction(); strResult = "-1"; logger.Error(ex.Message); } logger.End("InsertRow"); return(strResult); }
public List <VaiTroModels> SelectRows(VaiTroModels clParam) { logger.Start("SelectRows"); List <VaiTroModels> lstResult = new List <VaiTroModels>(); try { Hashtable param = new Hashtable(); param = base.SetDataToHashtable(false, clParam); IList ilist = sqlMap.ExecuteQueryForList("m_vaitro.SelectRows", param); CastDataType cast = new CastDataType(); lstResult = cast.AdvanceCastDataToList <VaiTroModels>(ilist); } catch (Exception ex) { logger.Error("Loi ---> " + ex.Message); } logger.End("SelectRows"); return(lstResult); }
public int CountRows(VaiTroModels clparam) { logger.Start("CountRows"); int iResult = 0; try { Hashtable param = new Hashtable(); param = base.SetDataToHashtable(false, clparam); iResult = (int)sqlMap.ExecuteQueryForObject("m_vaitro.CountRows", param); } catch (Exception ex) { sqlMap.RollbackTransaction(); iResult = 0; logger.Error(ex.Message); } logger.End("CountRows"); return(iResult); }
public VaiTroModels RowDetail(VaiTroModels clparam) { logger.Start("RowDetail"); VaiTroModels vbResult = new VaiTroModels(); try { Hashtable param = new Hashtable(); param = base.SetDataToHashtable(false, clparam); IList ilist = sqlMap.ExecuteQueryForList("m_vaitro.RowDetail", param); CastDataType cast = new CastDataType(); vbResult = cast.AdvanceCastDataToList <VaiTroModels>(ilist)[0]; } catch (Exception ex) { logger.Error(ex.Message); vbResult = new VaiTroModels(); } logger.End("RowDetail"); return(vbResult); }
public bool UpdateRow(VaiTroModels clParam) { logger.Start("UpdateRow"); bool bResult = false; try { sqlMap.BeginTransaction(); Hashtable param = new Hashtable(); param = base.SetDataToHashtable(false, clParam); sqlMap.Update("m_vaitro.UpdateRow", param); sqlMap.CommitTransaction(); bResult = true; } catch (Exception ex) { sqlMap.RollbackTransaction(); bResult = false; logger.Error(ex.Message); } logger.End("UpdateRow"); return(bResult); }