📄 information.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data ;
using System.Data.Sql;
using System.Data.SqlClient;
namespace BLL
{
public class Information
{
public static void Insert(string InsertCon, Model.Information myInfo)
{
//SqlParameter[] ps=new SqlParameter[]
//{
// new SqlParameter(),
// new SqlParameter(),
// new SqlParameter(),
// new SqlParameter(),
// new SqlParameter()
//};
//ps[0].Value =;
//ps[1].Value =;
//ps[2].Value =;
//ps[3].Value =;
//ps[4].Value =;
//DbHelper.ExecuteNonQuery(,CommandType.StoredProcedure ,"",ps);
SqlParameter[] ps=new SqlParameter[]
{
new SqlParameter("@InfoTitle",SqlDbType.VarChar ,100),
new SqlParameter("@InfoContent",SqlDbType.Text),
new SqlParameter("@InfoAuthor",SqlDbType.VarChar ,100),
new SqlParameter("@IssueTime",SqlDbType.DateTime),
new SqlParameter("@InfoKind",SqlDbType .Int),
new SqlParameter("@InfoPublicer",SqlDbType .VarChar ,50),
new SqlParameter ("@InfoAllow",SqlDbType .Char ,1)
};
ps[0].Value =myInfo .InfoTitle ;
ps[1].Value =myInfo .InfoContent ;
ps[2].Value =myInfo .InfoAuthor;
ps[3].Value =myInfo .IssueTime ;
ps[4].Value =myInfo .InfoKind;
ps[5].Value = myInfo.InfoPublicer;
ps[6].Value = myInfo.InfoAllow;
DbHelper.ExecuteNonQuery(InsertCon, CommandType.StoredProcedure, "InfoInsert", ps);
}
public static void Update(string UpdateCon,Model .Information myInfo)
{
SqlParameter[] ps = new SqlParameter[]
{
new SqlParameter("@InfoID",SqlDbType.Int),
new SqlParameter("@InfoTitle",SqlDbType.VarChar ,100),
new SqlParameter("@InfoContent",SqlDbType.Text),
new SqlParameter("@InfoAuthor",SqlDbType.VarChar ,100),
new SqlParameter("@IssueTime",SqlDbType.DateTime) ,
new SqlParameter("@InfoPublicer",SqlDbType .VarChar ,50),
new SqlParameter ("@InfoAllow",SqlDbType .Char ,1)
};
ps[0].Value = myInfo.InfoID;
ps[1].Value = myInfo.InfoTitle;
ps[2].Value = myInfo.InfoContent;
ps[3].Value = myInfo.InfoAuthor;
ps[4].Value = myInfo.IssueTime;
ps[5].Value = myInfo.InfoPublicer;
ps[6].Value = myInfo.InfoAllow;
DbHelper.ExecuteNonQuery(UpdateCon, CommandType.StoredProcedure, "InfoUpdate", ps);
}
public static void Delete(string DeleteCon, string ID)
{
SqlParameter[] ps = new SqlParameter[]
{
new SqlParameter("@InfoID",SqlDbType.Int),
};
ps[0].Value = Convert.ToInt32(ID);
DbHelper.ExecuteNonQuery(DeleteCon, CommandType.StoredProcedure, "InfoDelete", ps);
}
public static DataSet SelectByKind(string SelectCon, string Kind)
{
SqlParameter[] ps = new SqlParameter[]
{
new SqlParameter("@InfoKind",SqlDbType.Int),
};
ps[0].Value = Convert.ToInt32(Kind);
return DbHelper.ExecuteDataset(SelectCon, CommandType.StoredProcedure, "InfoSelectByKind", ps);
}
public static DataSet SelectAllowByKind(string SelectCon, string Kind)
{
SqlParameter[] ps = new SqlParameter[]
{
new SqlParameter("@InfoKind",SqlDbType.Int),
};
ps[0].Value = Convert.ToInt32(Kind);
return DbHelper.ExecuteDataset(SelectCon, CommandType.StoredProcedure, "InfoSelectAllowByKind", ps);
}
public static DataSet SelectSingle(string SelectCon,string ID)
{
SqlParameter[] ps = new SqlParameter[]
{
new SqlParameter("@InfoID",SqlDbType.Int),
};
ps[0].Value = Convert.ToInt32(ID);
return DbHelper.ExecuteDataset(SelectCon, CommandType.StoredProcedure, "InfoSelectSingle",ps);
}
public static DataSet InfoSelectKindByPublicer(string SelectCon,string Kind, string Publicer)//一般管理员管理自己的信息
{
SqlParameter[] ps = new SqlParameter[]
{
new SqlParameter("@InfoPublicer",SqlDbType.VarChar ),
new SqlParameter("@InfoKind",SqlDbType.Int)
};
ps[0].Value = Publicer;
ps[1].Value = Convert.ToInt32(Kind);
return DbHelper.ExecuteDataset(SelectCon, CommandType.StoredProcedure, "InfoSelectKindByPublicer", ps);
}
public static DataSet SelectAll(string SelectCon) //
{
SqlConnection sqlcon = new SqlConnection(SelectCon);
sqlcon.Open();
SqlDataAdapter da = new SqlDataAdapter();
DataSet ds = new DataSet();
SqlCommand com = new SqlCommand();
com.Connection = sqlcon;
com.CommandText = "select * from Information where InfoAllow=0";
da.SelectCommand = com;
da.Fill(ds, "Information");
return ds;
}
public static void AuditingAllow(string UpdateCon,string ID) //允许发布
{
SqlParameter[] ps = new SqlParameter[]
{
new SqlParameter("@InfoID",SqlDbType.Int ),
};
ps[0].Value = Convert .ToInt32( ID);
DbHelper.ExecuteNonQuery(UpdateCon, CommandType.StoredProcedure, "InfoUpdateAllow", ps);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -