/// <summary> /// 更新一条数据 /// </summary> public bool Update(IPSP.Model.TCode_ColorConfig model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update TCode_ColorConfig set "); strSql.Append("s_ModuleName=@s_ModuleName,"); strSql.Append("s_DateFieldName=@s_DateFieldName,"); strSql.Append("n_AbsDay=@n_AbsDay,"); strSql.Append("s_ForeColor=@s_ForeColor,"); strSql.Append("s_BackColor=@s_BackColor,"); strSql.Append("s_TypeForTask=@s_TypeForTask,"); strSql.Append("s_ToolTip=@s_ToolTip"); strSql.Append(" where n_ID=@n_ID"); SqlParameter[] parameters = { new SqlParameter("@s_ModuleName", SqlDbType.NVarChar, 100), new SqlParameter("@s_DateFieldName", SqlDbType.NVarChar, 100), new SqlParameter("@n_AbsDay", SqlDbType.Decimal, 9), new SqlParameter("@s_ForeColor", SqlDbType.NVarChar, 100), new SqlParameter("@s_BackColor", SqlDbType.NVarChar, 100), new SqlParameter("@s_TypeForTask", SqlDbType.NVarChar, 10), new SqlParameter("@s_ToolTip", SqlDbType.NVarChar, 50), new SqlParameter("@n_ID", SqlDbType.Int, 4) }; parameters[0].Value = model.s_ModuleName; parameters[1].Value = model.s_DateFieldName; parameters[2].Value = model.n_AbsDay; parameters[3].Value = model.s_ForeColor; parameters[4].Value = model.s_BackColor; parameters[5].Value = model.s_TypeForTask; parameters[6].Value = model.s_ToolTip; parameters[7].Value = model.n_ID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.TCode_ColorConfig DataRowToModel(DataRow row) { IPSP.Model.TCode_ColorConfig model = new IPSP.Model.TCode_ColorConfig(); 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_DateFieldName"] != null) { model.s_DateFieldName = row["s_DateFieldName"].ToString(); } if (row["n_AbsDay"] != null && row["n_AbsDay"].ToString() != "") { model.n_AbsDay = decimal.Parse(row["n_AbsDay"].ToString()); } if (row["s_ForeColor"] != null) { model.s_ForeColor = row["s_ForeColor"].ToString(); } if (row["s_BackColor"] != null) { model.s_BackColor = row["s_BackColor"].ToString(); } if (row["s_TypeForTask"] != null) { model.s_TypeForTask = row["s_TypeForTask"].ToString(); } if (row["s_ToolTip"] != null) { model.s_ToolTip = row["s_ToolTip"].ToString(); } } return(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(IPSP.Model.TCode_ColorConfig model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into TCode_ColorConfig("); strSql.Append("s_ModuleName,s_DateFieldName,n_AbsDay,s_ForeColor,s_BackColor,s_TypeForTask,s_ToolTip)"); strSql.Append(" values ("); strSql.Append("@s_ModuleName,@s_DateFieldName,@n_AbsDay,@s_ForeColor,@s_BackColor,@s_TypeForTask,@s_ToolTip)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@s_ModuleName", SqlDbType.NVarChar, 100), new SqlParameter("@s_DateFieldName", SqlDbType.NVarChar, 100), new SqlParameter("@n_AbsDay", SqlDbType.Decimal, 9), new SqlParameter("@s_ForeColor", SqlDbType.NVarChar, 100), new SqlParameter("@s_BackColor", SqlDbType.NVarChar, 100), new SqlParameter("@s_TypeForTask", SqlDbType.NVarChar, 10), new SqlParameter("@s_ToolTip", SqlDbType.NVarChar, 50) }; parameters[0].Value = model.s_ModuleName; parameters[1].Value = model.s_DateFieldName; parameters[2].Value = model.n_AbsDay; parameters[3].Value = model.s_ForeColor; parameters[4].Value = model.s_BackColor; parameters[5].Value = model.s_TypeForTask; parameters[6].Value = model.s_ToolTip; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.TCode_ColorConfig GetModel(int n_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 n_ID,s_ModuleName,s_DateFieldName,n_AbsDay,s_ForeColor,s_BackColor,s_TypeForTask,s_ToolTip from TCode_ColorConfig "); strSql.Append(" where n_ID=@n_ID"); SqlParameter[] parameters = { new SqlParameter("@n_ID", SqlDbType.Int, 4) }; parameters[0].Value = n_ID; IPSP.Model.TCode_ColorConfig model = new IPSP.Model.TCode_ColorConfig(); 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_ColorConfig model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(IPSP.Model.TCode_ColorConfig model) { return(dal.Add(model)); }