Esempio n. 1
0
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public Danyl.SnnuURP.Model.Teach DataRowToModel(DataRow row)
		{
			Danyl.SnnuURP.Model.Teach model=new Danyl.SnnuURP.Model.Teach();
			if (row != null)
			{
				if(row["Cid"]!=null && row["Cid"].ToString()!="")
				{
					model.Cid=int.Parse(row["Cid"].ToString());
				}
				if(row["Cno"]!=null && row["Cno"].ToString()!="")
				{
					model.Cno=int.Parse(row["Cno"].ToString());
				}
				if(row["Tid"]!=null && row["Tid"].ToString()!="")
				{
					model.Tid=int.Parse(row["Tid"].ToString());
				}
				if(row["CourseRemainder"]!=null && row["CourseRemainder"].ToString()!="")
				{
					model.CourseRemainder=int.Parse(row["CourseRemainder"].ToString());
				}
				if(row["Period"]!=null)
				{
					model.Period=row["Period"].ToString();
				}
				if(row["Week"]!=null)
				{
					model.Week=row["Week"].ToString();
				}
				if(row["Section"]!=null && row["Section"].ToString()!="")
				{
					model.Section=int.Parse(row["Section"].ToString());
				}
				if(row["SectionCount"]!=null && row["SectionCount"].ToString()!="")
				{
					model.SectionCount=int.Parse(row["SectionCount"].ToString());
				}
				if(row["DistrictId"]!=null && row["DistrictId"].ToString()!="")
				{
					model.DistrictId=int.Parse(row["DistrictId"].ToString());
				}
				if(row["BuildId"]!=null && row["BuildId"].ToString()!="")
				{
					model.BuildId=int.Parse(row["BuildId"].ToString());
				}
				if(row["ClassRoomId"]!=null && row["ClassRoomId"].ToString()!="")
				{
					model.ClassRoomId=int.Parse(row["ClassRoomId"].ToString());
				}
			}
			return model;
		}
Esempio n. 2
0
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public Danyl.SnnuURP.Model.Teach GetModel(int Cid,int Cno,int Tid,int ClassRoomId)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1 Cid,Cno,Tid,CourseRemainder,Period,Week,Section,SectionCount,DistrictId,BuildId,ClassRoomId from Teach ");
			strSql.Append(" where Cid=@Cid and Cno=@Cno and Tid=@Tid and ClassRoomId=@ClassRoomId ");
			SqlParameter[] parameters = {
					new SqlParameter("@Cid", SqlDbType.Int,4),
					new SqlParameter("@Cno", SqlDbType.Int,4),
					new SqlParameter("@Tid", SqlDbType.Int,4),
					new SqlParameter("@ClassRoomId", SqlDbType.Int,4)			};
			parameters[0].Value = Cid;
			parameters[1].Value = Cno;
			parameters[2].Value = Tid;
			parameters[3].Value = ClassRoomId;

			Danyl.SnnuURP.Model.Teach model=new Danyl.SnnuURP.Model.Teach();
			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
			if(ds.Tables[0].Rows.Count>0)
			{
				return DataRowToModel(ds.Tables[0].Rows[0]);
			}
			else
			{
				return null;
			}
		}