public bool UpdateTourInfo(D_TourInfo tourInfo) { string sql = @" update tours set tourName=@tourName, tourName_cn=@tourName_cn, description=@description, description_cn=@description_cn, tourDay=@tourDay, tourType=@tourType, tourOrder=@tourOrder, status=@status where tourId=@tourId "; SqlParameter[] para = { new SqlParameter("@tourId", tourInfo.tourId), new SqlParameter("@tourName", tourInfo.tourName), new SqlParameter("@tourName_cn", tourInfo.tourName_cn), new SqlParameter("@description", tourInfo.description), new SqlParameter("@description_cn", tourInfo.description_cn), new SqlParameter("@tourDay", tourInfo.tourDay), new SqlParameter("@tourType", tourInfo.tourType), new SqlParameter("@tourOrder", tourInfo.tourOrder), new SqlParameter("@status", tourInfo.status) }; m_dao.ExecuteNoQuery(sql, para); return true; }
public D_TourInfo GetTourInfo(int tourId) { string SQL = "SELECT * FROM tours WHERE tourId=@tourId"; SqlParameter[] para = { new SqlParameter("@tourId", tourId) }; IDataReader dr = m_dao.ExecuteReader(SQL, para); D_TourInfo di = new D_TourInfo(); if (dr.Read()) { di.tourId = (int)dr["tourId"]; di.tourOrder = (int)dr["tourOrder"]; di.tourName = (string)dr["tourName"]; di.tourName_cn = (string)dr["tourName_cn"]; di.tourDay = (byte)dr["tourDay"]; di.tourNight = di.tourDay > 1 ? di.tourDay - 1 : 0; di.description = (string)dr["description"]; di.description_cn = (string)dr["description_cn"]; di.tourType = (byte)dr["tourType"]; di.priceAdult = (decimal)dr["priceAdult"]; di.priceChild = (decimal)dr["priceChild"]; di.status = (byte)dr["status"]; } return di; }