• 有用吗1


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Data.SqlClient;
    using System.Data;
    using DataModel;
    using Newtonsoft.Json;

    namespace EFDAL
    {
    public class XueYuanClass
    {
    WlWcontext ConText = new WlWcontext();

    /// <summary>
    /// 数据显示连表联查
    /// </summary>
    /// <returns></returns>
    public List<WuLianWangInfo> WlWInfos(string name = "")
    {
    var list = ConText.WlWtext.Include("JueseId").ToList();

    if (!string.IsNullOrEmpty(name))
    {
    list = list.Where(s => s.Name.Contains(name)).ToList();
    }

    return list;
    }

    /// <summary>
    /// 删除
    /// </summary>
    /// <param name="Did"></param>
    /// <returns></returns>
    public int DeleInfo(int Did)
    {
    var deid = ConText.WlWtext.Find(Did);
    ConText.WlWtext.Remove(deid);
    return ConText.SaveChanges();
    }

    /// <summary>
    /// 修改数据
    /// </summary>
    /// <param name="wuLianWang"></param>
    /// <returns></returns>
    public int UpdateInfo(WuLianWangInfo wuLianWang)
    {
    ConText.WlWtext.Attach(wuLianWang);
    ConText.Entry(wuLianWang).State = System.Data.Entity.EntityState.Modified;
    return ConText.SaveChanges();
    }

    /// <summary>
    /// 根据Id获取数据
    /// </summary>
    /// <param name="Id"></param>
    /// <returns></returns>
    public WuLianWangInfo FanTian(int Id)
    {
    return ConText.WlWtext.Find(Id);
    }

    /// <summary>
    /// 添加数据
    /// </summary>
    /// <param name="WuLian"></param>
    /// <returns></returns>
    public int AddInfo(WuLianWangInfo WuLian)
    {
    ConText.WlWtext.Add(WuLian);
    return ConText.SaveChanges();
    }

    /// <summary>
    /// 调用分页存储过程
    /// </summary>
    /// <param name="Pageindex"></param>
    /// <param name="Pagesize"></param>
    /// <returns></returns>
    public List<WuLianWangInfo> WPageProc(int Pageindex = 1,int Pagesize = 2)
    {
    var list = new List<WuLianWangInfo>();

    int Pcount = 0;

    SqlParameter Index = new SqlParameter("@PageIndex", Pageindex);
    Index.Direction = ParameterDirection.Input;

    SqlParameter Size = new SqlParameter("@PageSize", Pagesize);
    Size.Direction = ParameterDirection.Input;

    SqlParameter Count = new SqlParameter("@PageCount", Pcount);
    Count.Direction = ParameterDirection.Output;

    ConText.WlWtext.SqlQuery("exec Proc_Page", new SqlParameter[] { Index, Size, Count });

    return list;
    }
    }
    }

  • 相关阅读:
    从 http 升级到 https 过程中遇到的一些问题
    Java 对象,数组 与 JSON 字符串 相互转化
    jQuery 事件探秘
    eclipse 添加 hibernate 插件
    struts2 + jquery + json 简单的前后台信息交互
    匿名类、匿名方法、扩展方法
    禁用右键
    JS聊天室
    MVC知识汇总
    知识点汇总
  • 原文地址:https://www.cnblogs.com/li1999/p/13446032.html
Copyright © 2020-2023  润新知