/// <summary> /// 更新一条数据 /// </summary> public void Update(MobileSoft.Model.Unify.Tb_Unify_InfoDynamic model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@InfoID", SqlDbType.BigInt, 8), new SqlParameter("@InfoType", SqlDbType.SmallInt, 2), new SqlParameter("@TypeName", SqlDbType.NVarChar, 20), new SqlParameter("@Heading", SqlDbType.NVarChar, 50), new SqlParameter("@IssueDate", SqlDbType.DateTime), new SqlParameter("@InfoSource", SqlDbType.NVarChar, 20), new SqlParameter("@ImageUrl", SqlDbType.VarChar, 1000), new SqlParameter("@Recommended", SqlDbType.SmallInt, 2), new SqlParameter("@HitCount", SqlDbType.Int, 4), new SqlParameter("@InfoContent", SqlDbType.NText) }; parameters[0].Value = model.InfoID; parameters[1].Value = model.InfoType; parameters[2].Value = model.TypeName; parameters[3].Value = model.Heading; parameters[4].Value = model.IssueDate; parameters[5].Value = model.InfoSource; parameters[6].Value = model.ImageUrl; parameters[7].Value = model.Recommended; parameters[8].Value = model.HitCount; parameters[9].Value = model.InfoContent; DbHelperSQL.RunProcedure("Proc_Tb_Unify_InfoDynamic_Update", parameters, out rowsAffected); }
/// <summary> /// 得到一个对象实体 /// </summary> public MobileSoft.Model.Unify.Tb_Unify_InfoDynamic GetModel(long InfoID) { SqlParameter[] parameters = { new SqlParameter("@InfoID", SqlDbType.BigInt) }; parameters[0].Value = InfoID; MobileSoft.Model.Unify.Tb_Unify_InfoDynamic model = new MobileSoft.Model.Unify.Tb_Unify_InfoDynamic(); DataSet ds = DbHelperSQL.RunProcedure("Proc_Tb_Unify_InfoDynamic_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["InfoID"].ToString() != "") { model.InfoID = long.Parse(ds.Tables[0].Rows[0]["InfoID"].ToString()); } if (ds.Tables[0].Rows[0]["InfoType"].ToString() != "") { model.InfoType = int.Parse(ds.Tables[0].Rows[0]["InfoType"].ToString()); } model.TypeName = ds.Tables[0].Rows[0]["TypeName"].ToString(); model.Heading = ds.Tables[0].Rows[0]["Heading"].ToString(); if (ds.Tables[0].Rows[0]["IssueDate"].ToString() != "") { model.IssueDate = DateTime.Parse(ds.Tables[0].Rows[0]["IssueDate"].ToString()); } model.InfoSource = ds.Tables[0].Rows[0]["InfoSource"].ToString(); model.ImageUrl = ds.Tables[0].Rows[0]["ImageUrl"].ToString(); if (ds.Tables[0].Rows[0]["Recommended"].ToString() != "") { model.Recommended = int.Parse(ds.Tables[0].Rows[0]["Recommended"].ToString()); } if (ds.Tables[0].Rows[0]["HitCount"].ToString() != "") { model.HitCount = int.Parse(ds.Tables[0].Rows[0]["HitCount"].ToString()); } model.InfoContent = ds.Tables[0].Rows[0]["InfoContent"].ToString(); return(model); } else { return(null); } }