/// <summary> /// 更新一条数据 /// </summary> public bool Update(IPSP.Model.TCode_GridLayout model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update TCode_GridLayout set "); strSql.Append("s_ModuleName=@s_ModuleName,"); strSql.Append("s_LayoutName=@s_LayoutName,"); strSql.Append("s_LayoutXml=@s_LayoutXml,"); strSql.Append("s_IsSystemLayout=@s_IsSystemLayout,"); strSql.Append("dt_CreateDate=@dt_CreateDate,"); strSql.Append("dt_EditDate=@dt_EditDate"); strSql.Append(" where n_ID=@n_ID"); SqlParameter[] parameters = { new SqlParameter("@s_ModuleName", SqlDbType.NVarChar, 20), new SqlParameter("@s_LayoutName", SqlDbType.NVarChar, 200), new SqlParameter("@s_LayoutXml", SqlDbType.NVarChar, -1), new SqlParameter("@s_IsSystemLayout", SqlDbType.NVarChar, 1), new SqlParameter("@dt_CreateDate", SqlDbType.DateTime), new SqlParameter("@dt_EditDate", SqlDbType.DateTime), new SqlParameter("@n_ID", SqlDbType.Int, 4) }; parameters[0].Value = model.s_ModuleName; parameters[1].Value = model.s_LayoutName; parameters[2].Value = model.s_LayoutXml; parameters[3].Value = model.s_IsSystemLayout; parameters[4].Value = model.dt_CreateDate; parameters[5].Value = model.dt_EditDate; parameters[6].Value = model.n_ID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(IPSP.Model.TCode_GridLayout model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into TCode_GridLayout("); strSql.Append("s_ModuleName,s_LayoutName,s_LayoutXml,s_IsSystemLayout,dt_CreateDate,dt_EditDate)"); strSql.Append(" values ("); strSql.Append("@s_ModuleName,@s_LayoutName,@s_LayoutXml,@s_IsSystemLayout,@dt_CreateDate,@dt_EditDate)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@s_ModuleName", SqlDbType.NVarChar, 20), new SqlParameter("@s_LayoutName", SqlDbType.NVarChar, 200), new SqlParameter("@s_LayoutXml", SqlDbType.NVarChar, -1), new SqlParameter("@s_IsSystemLayout", SqlDbType.NVarChar, 1), new SqlParameter("@dt_CreateDate", SqlDbType.DateTime), new SqlParameter("@dt_EditDate", SqlDbType.DateTime) }; parameters[0].Value = model.s_ModuleName; parameters[1].Value = model.s_LayoutName; parameters[2].Value = model.s_LayoutXml; parameters[3].Value = model.s_IsSystemLayout; parameters[4].Value = model.dt_CreateDate; parameters[5].Value = model.dt_EditDate; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.TCode_GridLayout DataRowToModel(DataRow row) { IPSP.Model.TCode_GridLayout model = new IPSP.Model.TCode_GridLayout(); if (row != null) { if (row["n_ID"] != null && row["n_ID"].ToString() != "") { model.n_ID = int.Parse(row["n_ID"].ToString()); } if (row["s_ModuleName"] != null) { model.s_ModuleName = row["s_ModuleName"].ToString(); } if (row["s_LayoutName"] != null) { model.s_LayoutName = row["s_LayoutName"].ToString(); } if (row["s_LayoutXml"] != null) { model.s_LayoutXml = row["s_LayoutXml"].ToString(); } if (row["s_IsSystemLayout"] != null) { model.s_IsSystemLayout = row["s_IsSystemLayout"].ToString(); } if (row["dt_CreateDate"] != null && row["dt_CreateDate"].ToString() != "") { model.dt_CreateDate = DateTime.Parse(row["dt_CreateDate"].ToString()); } if (row["dt_EditDate"] != null && row["dt_EditDate"].ToString() != "") { model.dt_EditDate = DateTime.Parse(row["dt_EditDate"].ToString()); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.TCode_GridLayout GetModel(int n_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 n_ID,s_ModuleName,s_LayoutName,s_LayoutXml,s_IsSystemLayout,dt_CreateDate,dt_EditDate from TCode_GridLayout "); strSql.Append(" where n_ID=@n_ID"); SqlParameter[] parameters = { new SqlParameter("@n_ID", SqlDbType.Int, 4) }; parameters[0].Value = n_ID; IPSP.Model.TCode_GridLayout model = new IPSP.Model.TCode_GridLayout(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(IPSP.Model.TCode_GridLayout model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(IPSP.Model.TCode_GridLayout model) { return(dal.Add(model)); }