Ejemplo n.º 1
0
 public ActionResult SearchContent()
 {
     long pageCount = 0;//总页数
     List<Content> ct = new List<Content>();
     List<ysd> yd = new List<ysd>();
     List<long> ids = new List<long>();
     string t = Request.QueryString["t"];//1、公告;2、验收单
     string str = Request.QueryString["id"];
     if (str.Contains(","))
     {
         for (int i = 0; i < str.Split(',').Length - 1; i++)
         {
             ids.Add(long.Parse(str.Split(',')[i]));
         }
     }
     else
     {
         ids.Add(long.Parse(Request.QueryString["id"]));
     }
     int skip = int.Parse(Request.QueryString["skip"]);
     if (t.Contains("2") && !t.Contains("1"))
     {
         pageCount = 验收单管理.计数验收单(0, 0, Query<验收单>.In(m => m.审核数据.审核者.用户ID, ids)) / 20;
         if (验收单管理.计数验收单(0, 0, Query<验收单>.In(m => m.审核数据.审核者.用户ID, ids)) % 20 > 0)
         {
             pageCount++;
         }
         IEnumerable<验收单> y = 验收单管理.查询验收单(20 * (skip - 1), 20, Query<验收单>.In(m => m.审核数据.审核者.用户ID, ids));
         foreach (var item in y)
         {
             ysd c = new ysd();
             c.id = item.Id;
             if (item.供应商链接.用户数据 != null)
             {
                 c.supplier = item.供应商链接.用户数据.企业基本信息.企业名称;
             }
             else
             {
                 c.supplier = "未填写企业信息";
             }
             c.reciever = item.收货单位;
             c.money = item.总金额;
             if (item.审核数据.审核者.用户数据 != null)
             {
                 c.checker = item.审核数据.审核者.用户数据.验收单审核单位名称;
             }
             else
             {
                 c.checker = "没有单位信息";
             }
             c.status = item.审核数据.审核状态.ToString();
             c.time = item.基本数据.添加时间.ToString("yyyy/MM/dd");
             yd.Add(c);
         }
         JsonResult json = new JsonResult() { Data = new { info = yd, p = pageCount } };
         return Json(json, JsonRequestBehavior.AllowGet);
     }
     else if (!t.Contains("2") && t.Contains("1"))
     {
         pageCount = 公告管理.计数公告(0, 0, Query<公告>.In(m => m.内容基本信息.所有者.用户ID, ids)) / 20;
         if (公告管理.计数公告(0, 0, Query<公告>.In(m => m.内容基本信息.所有者.用户ID, ids)) % 20 > 0)
         {
             pageCount++;
         }
         IEnumerable<公告> y = 公告管理.查询公告(20 * (skip - 1), 20, Query<公告>.In(m => m.内容基本信息.所有者.用户ID, ids));
         foreach (var item in y)
         {
             Content c = new Content();
             c.id = item.Id;
             c.name = item.内容主体.标题;
             c.unit = item.公告信息.需求单位;
             c.time = item.基本数据.添加时间.ToString("yyyy/MM/dd");
             ct.Add(c);
         }
         JsonResult json = new JsonResult() { Data = new { info = ct, p = pageCount } };
         return Json(json, JsonRequestBehavior.AllowGet);
     }
     else
     {
         List<Content> ct1 = new List<Content>();
         long pageCount1 = 0;
         pageCount = 验收单管理.计数验收单(0, 0, Query<验收单>.In(m => m.审核数据.审核者.用户ID, ids)) / 20;
         if (验收单管理.计数验收单(0, 0, Query<验收单>.In(m => m.审核数据.审核者.用户ID, ids)) % 20 > 0)
         {
             pageCount++;
         }
         IEnumerable<验收单> y = 验收单管理.查询验收单(20 * (skip - 1), 20, Query<验收单>.In(m => m.审核数据.审核者.用户ID, ids));
         foreach (var item in y)
         {
             ysd c = new ysd();
             c.id = item.Id;
             if (item.供应商链接.用户数据 != null)
             {
                 c.supplier = item.供应商链接.用户数据.企业基本信息.企业名称;
             }
             else
             {
                 c.supplier = "未填写企业信息";
             }
             c.reciever = item.收货单位;
             c.money = item.总金额;
             if (item.审核数据.审核者.用户数据 != null)
             {
                 c.checker = item.审核数据.审核者.用户数据.验收单审核单位名称;
             }
             else
             {
                 c.checker = "没有单位信息";
             }
             c.status = item.审核数据.审核状态.ToString();
             c.time = item.基本数据.添加时间.ToString("yyyy/MM/dd");
             yd.Add(c);
         }
         ///////////////////////
         pageCount1 = 公告管理.计数公告(0, 0, Query<公告>.In(m => m.内容基本信息.所有者.用户ID, ids)) / 20;
         if (公告管理.计数公告(0, 0, Query<公告>.In(m => m.内容基本信息.所有者.用户ID, ids)) % 20 > 0)
         {
             pageCount1++;
         }
         IEnumerable<公告> g = 公告管理.查询公告(20 * (skip - 1), 20, Query<公告>.In(m => m.内容基本信息.所有者.用户ID, ids));
         foreach (var item in g)
         {
             Content c = new Content();
             c.id = item.Id;
             c.name = item.内容主体.标题;
             c.unit = item.公告信息.需求单位;
             c.time = item.基本数据.添加时间.ToString("yyyy/MM/dd");
             ct1.Add(c);
         }
         JsonResult json = new JsonResult() { Data = new { ysd = yd, g = ct1, yp = pageCount, gp = pageCount1 } };
         return Json(json, JsonRequestBehavior.AllowGet);
     }
 }
Ejemplo n.º 2
0
 public ActionResult SearchYsd()
 {
     long pageCount = 0;//总页数
     List<ysd> ct = new List<ysd>();
     List<long> ids = new List<long>();
     string str = Request.QueryString["id"];
     if (str.Contains(","))
     {
         for (int i = 0; i < str.Split(',').Length - 1; i++)
         {
             ids.Add(long.Parse(str.Split(',')[i]));
         }
     }
     else
     {
         ids.Add(long.Parse(Request.QueryString["id"]));
     }
     int skip = int.Parse(Request.QueryString["skip"]);
     pageCount = 验收单管理.计数验收单(0, 0, Query<验收单>.In(m => m.审核数据.审核者.用户ID, ids)) / 20;
     if (验收单管理.计数验收单(0, 0, Query<验收单>.In(m => m.审核数据.审核者.用户ID, ids)) % 20 > 0)
     {
         pageCount++;
     }
     IEnumerable<验收单> y = 验收单管理.查询验收单(20 * (skip - 1), 20, Query<验收单>.In(m => m.审核数据.审核者.用户ID, ids));
     foreach (var item in y)
     {
         ysd c = new ysd();
         c.id = item.Id;
         if (item.供应商链接.用户数据 != null)
         {
             c.supplier = item.供应商链接.用户数据.企业基本信息.企业名称;
         }
         else
         {
             c.supplier = "未填写企业信息";
         }
         c.reciever = item.收货单位;
         c.money = item.总金额;
         if (item.审核数据.审核者.用户数据 != null)
         {
             c.checker = item.审核数据.审核者.用户数据.验收单审核单位名称;
         }
         else
         {
             c.checker = "没有单位信息";
         }
         c.status = item.审核数据.审核状态.ToString();
         c.time = item.基本数据.添加时间.ToString("yyyy/MM/dd");
         ct.Add(c);
     }
     JsonResult json = new JsonResult() { Data = new { info = ct, p = pageCount } };
     return Json(json, JsonRequestBehavior.AllowGet);
 }