/// <summary> /// 增加一条数据 /// </summary> public int Add(DigiPower.Onlinecol.Standard.Model.T_FileList_CellRpt_MDL model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into T_FileList_CellRpt("); strSql.Append("FileListID,recID,Title,CellFilePath,OrderIndex)"); strSql.Append(" values ("); strSql.Append("@FileListID,@recID,@Title,@CellFilePath,@OrderIndex)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@FileListID", SqlDbType.Int, 8), new SqlParameter("@recID", SqlDbType.Int, 8), new SqlParameter("@Title", SqlDbType.NVarChar, 200), new SqlParameter("@CellFilePath", SqlDbType.NVarChar, 250), new SqlParameter("@OrderIndex", SqlDbType.Int, 8) }; parameters[0].Value = model.FileListID; parameters[1].Value = model.recID; parameters[2].Value = model.Title; parameters[3].Value = model.CellFilePath; parameters[4].Value = model.OrderIndex; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(1); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(DigiPower.Onlinecol.Standard.Model.T_FileList_CellRpt_MDL model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update T_FileList_CellRpt set "); strSql.Append("FileListID=@FileListID,"); strSql.Append("recID=@recID,"); strSql.Append("Title=@Title,"); strSql.Append("CellFilePath=@CellFilePath,"); strSql.Append("OrderIndex=@OrderIndex"); strSql.Append(" where FileList_CellRptID=@FileList_CellRptID "); SqlParameter[] parameters = { new SqlParameter("@FileList_CellRptID", SqlDbType.Int, 8), new SqlParameter("@FileListID", SqlDbType.Int, 8), new SqlParameter("@recID", SqlDbType.Int, 8), new SqlParameter("@Title", SqlDbType.NVarChar, 200), new SqlParameter("@CellFilePath", SqlDbType.NVarChar, 250), new SqlParameter("@OrderIndex", SqlDbType.Int, 8) }; parameters[0].Value = model.FileList_CellRptID; parameters[1].Value = model.FileListID; parameters[2].Value = model.recID; parameters[3].Value = model.Title; parameters[4].Value = model.CellFilePath; parameters[5].Value = model.OrderIndex; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// 得到一个对象实体 /// </summary> public DigiPower.Onlinecol.Standard.Model.T_FileList_CellRpt_MDL GetModel(int FileList_CellRptID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 FileList_CellRptID,FileListID,recID,Title,CellFilePath,OrderIndex from T_FileList_CellRpt "); strSql.Append(" where FileList_CellRptID=@FileList_CellRptID "); SqlParameter[] parameters = { new SqlParameter("@FileList_CellRptID", SqlDbType.Int, 8) }; parameters[0].Value = FileList_CellRptID; DigiPower.Onlinecol.Standard.Model.T_FileList_CellRpt_MDL model = new DigiPower.Onlinecol.Standard.Model.T_FileList_CellRpt_MDL(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["FileList_CellRptID"].ToString() != "") { model.FileList_CellRptID = int.Parse(ds.Tables[0].Rows[0]["FileList_CellRptID"].ToString()); } if (ds.Tables[0].Rows[0]["FileListID"].ToString() != "") { model.FileListID = int.Parse(ds.Tables[0].Rows[0]["FileListID"].ToString()); } if (ds.Tables[0].Rows[0]["recID"].ToString() != "") { model.recID = int.Parse(ds.Tables[0].Rows[0]["recID"].ToString()); } model.Title = ds.Tables[0].Rows[0]["Title"].ToString(); model.CellFilePath = ds.Tables[0].Rows[0]["CellFilePath"].ToString(); if (ds.Tables[0].Rows[0]["OrderIndex"].ToString() != "") { model.OrderIndex = int.Parse(ds.Tables[0].Rows[0]["OrderIndex"].ToString()); } return(model); } else { return(null); } }