/// <summary> /// 得到一个对象实体 /// </summary> public MobileSoft.Model.SQMSys.Tb_Sys_MessageAdjunct GetModel(string AdjunctCode) { SqlParameter[] parameters = { new SqlParameter("@AdjunctCode", SqlDbType.NVarChar, 50) }; parameters[0].Value = AdjunctCode; MobileSoft.Model.SQMSys.Tb_Sys_MessageAdjunct model = new MobileSoft.Model.SQMSys.Tb_Sys_MessageAdjunct(); DataSet ds = DbHelperSQL.RunProcedure("Proc_Tb_Sys_MessageAdjunct_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { model.AdjunctCode = ds.Tables[0].Rows[0]["AdjunctCode"].ToString(); if (ds.Tables[0].Rows[0]["MessageCode"].ToString() != "") { model.MessageCode = new Guid(ds.Tables[0].Rows[0]["MessageCode"].ToString()); } model.AdjunctName = ds.Tables[0].Rows[0]["AdjunctName"].ToString(); model.FilPath = ds.Tables[0].Rows[0]["FilPath"].ToString(); model.FileName = ds.Tables[0].Rows[0]["FileName"].ToString(); model.FileExName = ds.Tables[0].Rows[0]["FileExName"].ToString(); if (ds.Tables[0].Rows[0]["FileSize"].ToString() != "") { model.FileSize = decimal.Parse(ds.Tables[0].Rows[0]["FileSize"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(MobileSoft.Model.SQMSys.Tb_Sys_MessageAdjunct model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@AdjunctCode", SqlDbType.NVarChar, 20), new SqlParameter("@MessageCode", SqlDbType.UniqueIdentifier, 16), new SqlParameter("@AdjunctName", SqlDbType.NVarChar, 100), new SqlParameter("@FilPath", SqlDbType.NVarChar, 300), new SqlParameter("@FileName", SqlDbType.NVarChar, 20), new SqlParameter("@FileExName", SqlDbType.NVarChar, 10), new SqlParameter("@FileSize", SqlDbType.Decimal, 9) }; parameters[0].Value = model.AdjunctCode; parameters[1].Value = model.MessageCode; parameters[2].Value = model.AdjunctName; parameters[3].Value = model.FilPath; parameters[4].Value = model.FileName; parameters[5].Value = model.FileExName; parameters[6].Value = model.FileSize; DbHelperSQL.RunProcedure("Proc_Tb_Sys_MessageAdjunct_Update", parameters, out rowsAffected); }