Ejemplo n.º 1
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int InsertData(GroupInfo model)
 {
     using (DBServer db = new DBServer())
     {
         StringBuilder strSql = new StringBuilder();
         strSql.Append("insert into [elink_group] (");
         strSql.Append("group_name,group_subjectionId,group_subjectionName,group_subjectionIds,group_display)");
         strSql.Append(" values (");
         strSql.Append("@group_name,@group_subjectionId,@group_subjectionName,@group_subjectionIds,@group_display)");
         strSql.Append(";select @@IDENTITY");
         SqlParameter[] parameters =
         {
             db.MakeInParam("@group_name",           SqlDbType.VarChar,  200, model.Group_name),
             db.MakeInParam("@group_subjectionId",   SqlDbType.Int,        4, model.Group_subjectionId),
             db.MakeInParam("@group_subjectionName", SqlDbType.VarChar,  200, model.Group_subjectionName),
             db.MakeInParam("@group_subjectionIds",  SqlDbType.VarChar, 5000, model.Group_subjectionIds),
             db.MakeInParam("@group_display",        SqlDbType.TinyInt,    1, model.Group_display),
         };
         return(db.ExecuteNonQuery(CommandType.Text, strSql.ToString(), parameters));
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 删除一条数据
 /// </summary>
 public int Delete(int group_id)
 {
     using (DBServer db = new DBServer())
     {
         StringBuilder strSql = new StringBuilder();
         strSql.Append("delete [elink_group] ");
         strSql.Append(" where group_id=@group_id");
         SqlParameter[] parameters =
         {
             db.MakeInParam("@group_id", SqlDbType.Int, 4, group_id)
         };
         return(db.ExecuteNonQuery(CommandType.Text, strSql.ToString(), parameters));
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 存储过程读取
 /// </summary>
 public IList <GroupInfo> GetList(int PageNo, int PageSize, string strWhere, out int TotalPageNo)
 {
     using (DBServer db = new DBServer())
     {
         TotalPageNo = 0;
         strWhere    = string.IsNullOrEmpty(strWhere) ? string.Empty : strWhere;
         SqlParameter[] SqlParam =
         {
             db.MakeParam("@tblName",     SqlDbType.VarChar,  100, ParameterDirection.Input, "[elink_group]"),
             db.MakeParam("@fldName",     SqlDbType.VarChar,  100, ParameterDirection.Input, "group_id"),
             db.MakeParam("@fldOut",      SqlDbType.VarChar, 1000, ParameterDirection.Input, "group_id,group_name,group_subjectionId,group_subjectionName,group_subjectionIds,group_display"),
             db.MakeInParam("@PageSize",  SqlDbType.Int,        4, PageSize),
             db.MakeInParam("@PageIndex", SqlDbType.Int,        4, PageNo),
             db.MakeInParam("@OrderType", SqlDbType.Int,        4,                       1),
             db.MakeParam("@strWhere",    SqlDbType.VarChar,  500, ParameterDirection.Input, strWhere)
         };
         List <GroupInfo> list = new List <GroupInfo>();
         using (DataTable table = db.GetDataTable(CommandType.StoredProcedure, "Usp_Paged", SqlParam))
         {
             foreach (DataRow row in table.Rows)
             {
                 GroupInfo model = new GroupInfo();
                 model.Group_id             = (int)row["Group_id"];
                 model.Group_name           = Convert.ToString(row["group_name"]);
                 model.Group_subjectionId   = (int)row["Group_subjectionId"];
                 model.Group_subjectionName = Convert.ToString(row["group_subjectionName"]);
                 model.Group_subjectionIds  = Convert.ToString(row["group_subjectionIds"]);
                 model.Group_display        = (int)row["Group_display"];
                 list.Add(model);
             }
             TotalPageNo = this.TotalPageNo(strWhere);
             table.Clear();
             table.Dispose();
             return(list);
         }
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int UpDate(GroupInfo model)
 {
     using (DBServer db = new DBServer())
     {
         StringBuilder strSql = new StringBuilder();
         strSql.Append("update [elink_group] set ");
         strSql.Append("group_name=@group_name,");
         strSql.Append("group_subjectionId=@group_subjectionId,");
         strSql.Append("group_subjectionName=@group_subjectionName,");
         strSql.Append("group_subjectionIds=@group_subjectionIds,");
         strSql.Append("group_display=@group_display");
         strSql.Append(" where group_id=@group_id ");
         SqlParameter[] parameters =
         {
             db.MakeInParam("@group_id",             SqlDbType.Int,        4, model.Group_id),
             db.MakeInParam("@group_name",           SqlDbType.VarChar,  200, model.Group_name),
             db.MakeInParam("@group_subjectionId",   SqlDbType.Int,        4, model.Group_subjectionId),
             db.MakeInParam("@group_subjectionName", SqlDbType.VarChar,  200, model.Group_subjectionName),
             db.MakeInParam("@group_subjectionIds",  SqlDbType.VarChar, 5000, model.Group_subjectionIds),
             db.MakeInParam("@group_display",        SqlDbType.TinyInt,    1, model.Group_display)
         };
         return(db.ExecuteNonQuery(CommandType.Text, strSql.ToString(), parameters));
     }
 }