• 有用吗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;
    }
    }
    }

  • 相关阅读:
    Python核心技术与实战——十四|Python中装饰器的使用
    Python核心技术与实战——十三|Python中参数传递机制
    GUI学习之三十四——QSS样式表
    数据分析思维(一):数据分析的三种核心思维
    python设计模式
    Docker架构
    云技术
    5G[generation]的知识收集
    计算机网络知识汇总---20191207
    odoo里面的read_group写法
  • 原文地址:https://www.cnblogs.com/li1999/p/13446032.html
Copyright © 2020-2023  润新知