public int CountRows(M_ThongBao clparam) { logger.Start("CountRows"); int iResult = 0; try { Hashtable param = new Hashtable(); param = base.SetDataToHashtable(false, clparam); iResult = (int)sqlMap.ExecuteQueryForObject("m_thongbao.CountRows", param); } catch (Exception ex) { iResult = 0; logger.Error(ex.Message); } logger.End("CountRows"); return(iResult); }
public List <ThongBaoModels> SelectRows(M_ThongBao clParam) { logger.Start("SelectRows"); List <ThongBaoModels> lstResult = new List <ThongBaoModels>(); try { Hashtable param = new Hashtable(); param = base.SetDataToHashtable(false, clParam); IList ilist = sqlMap.ExecuteQueryForList("m_thongbao.SelectRows", param); CastDataType cast = new CastDataType(); lstResult = cast.AdvanceCastDataToList <ThongBaoModels>(ilist); } catch (Exception ex) { logger.Error("Loi ---> " + ex.Message); } logger.End("SelectRows"); return(lstResult); }
public ThongBaoModels RowDetail(M_ThongBao clparam) { logger.Start("RowDetail"); ThongBaoModels vbResult = new ThongBaoModels(); try { Hashtable param = new Hashtable(); param = base.SetDataToHashtable(false, clparam); IList ilist = sqlMap.ExecuteQueryForList("m_thongbao.RowDetail", param); CastDataType cast = new CastDataType(); vbResult = cast.AdvanceCastDataToList <ThongBaoModels>(ilist)[0]; } catch (Exception ex) { logger.Error(ex.Message); vbResult = new ThongBaoModels(); } logger.End("RowDetail"); return(vbResult); }
public string InsertRow(M_ThongBao clParam) { logger.Start("InsertRow"); string strResult = ""; try { sqlMap.BeginTransaction(); Hashtable param = new Hashtable(); param = base.SetDataToHashtable(false, clParam); param["seqname"] = "seq_m_thongbao"; string strid = sqlMap.ExecuteQueryForObject("Common.GetNextVal", param).ToString(); int iID = -1; int.TryParse(strid, out iID); if (iID == -1) { return(string.Empty); } //tao ma cong viec param["mathongbao"] = string.Format(Functiontring.ReturnStringFormatID("mathongbao"), clParam.manhansu, DateTime.Now.Year, DateTime.Now.Month, iID.ToString("000000")); sqlMap.Insert("m_thongbao.InsertRow", param); sqlMap.CommitTransaction(); strResult = param["mathongbao"].ToString(); } catch (Exception ex) { sqlMap.RollbackTransaction(); strResult = "-1"; logger.Error(ex.Message); } logger.End("InsertRow"); return(strResult); }