示例#1
0
        //微信用获取工票信息
        public ActionResult GetGPtopInfo()
        {
            int pageIndex = Request["page"] != null?int.Parse(Request["page"]) : 1;

            int pageSize = Request["rows"] != null?int.Parse(Request["rows"]) : 15;

            int    toalcount = 0;
            var    temp      = new List <YSGPtop>();
            var    rtmp      = new List <GPtop>();
            var    userList  = UserInfoService.LoadEntities(x => x.ID > 0).DefaultIfEmpty().ToList();
            int    uid       = Convert.ToInt32(Request["uid"]);
            string uidStr    = Request["uid"];

            temp = YSGPtopService.LoadPageEntities(pageIndex, pageSize, out toalcount, x => x.Del_f == 0 && (x.AddUser == uid || x.PGperson.Contains(uidStr)), x => x.GPtime, false).DefaultIfEmpty().ToList();
            if (temp != null && temp[0] != null)
            {
                foreach (var a in temp)
                {
                    GPtop gt = new GPtop();
                    gt.ID      = a.ID;
                    gt.GPtime  = a.GPtime;
                    gt.PGbumen = a.BumenInfoSet.Name;
                    if (a.PGperson.IndexOf("|") == -1)
                    {
                        int id       = Convert.ToInt32(a.PGperson);
                        var userinfo = userList.Where(x => x.ID == id).FirstOrDefault();
                        gt.PGperson = userinfo.PerSonName;
                    }
                    else
                    {
                        string userStr = "";
                        var    ary     = a.PGperson.Split('|');
                        foreach (var b in ary)
                        {
                            int sid      = Convert.ToInt32(b.Trim());
                            var userinfo = userList.Where(x => x.ID == sid).FirstOrDefault();
                            userStr = userStr == "" ? userinfo.PerSonName : userStr + "、" + userinfo.PerSonName;
                        }
                        gt.PGperson = userStr;
                    }
                    gt.StartTime        = a.StartTime;
                    gt.EndTime          = a.EndTime;
                    gt.WorkTime         = a.WorkTime;
                    gt.PGpersonAllWages = a.PGpersonAllWages;
                    gt.SettlementAmount = a.SettlementAmount;
                    gt.gpInfo           = a.WorkInfo;
                    gt.WorkAddress      = a.BumenInfoSet1.Name;
                    gt.GPState          = T_BoolItemService.LoadEntities(x => x.ItemsID == 9 && x.@int == a.GPState).First().str;
                    gt.GPStateNum       = a.GPState;
                    gt.pingJiaStateNum  = a.pingjiaState;
                    gt.pingJiaState     = a.pingjiaState == 0 ? "满意" : a.pingjiaState == 1 ? "一般" : "不满意";
                    rtmp.Add(gt);
                }
            }
            return(Json(new { rows = rtmp, total = toalcount }, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        //获取工票头信息
        public ActionResult GetAllGPtopInfo()
        {
            int pageIndex = Request["page"] != null?int.Parse(Request["page"]) : 1;

            int pageSize = Request["rows"] != null?int.Parse(Request["rows"]) : 15;

            int    bumenID   = Request["BMID"] != null && Request["BMID"].Trim().Length > 0 ? int.Parse(Request["BMID"]) : 0;
            string uid       = Request["uid"] != null && Request["uid"].Trim().Length > 0 ? Request["uid"] : "0";
            string startDate = Request["startDate"] != null && Request["startDate"].Trim().Length > 0 ? Request["startDate"] : "0";
            string endDate   = Request["endDate"] != null && Request["endDate"].Trim().Length > 0 ? Request["endDate"] : "0";
            int    toalcount = 0;
            var    temp      = new List <YSGPtop>();
            var    rtmp      = new List <GPtop>();
            var    userList  = UserInfoService.LoadEntities(x => x.ID > 0).DefaultIfEmpty().ToList();

            if (bumenID == 0 && uid == "0")
            {
                temp = YSGPtopService.LoadPageEntities(pageIndex, pageSize, out toalcount, x => x.Del_f == 0 && x.GPState == 2, x => x.GPtime, false).DefaultIfEmpty().ToList();
            }
            else if (bumenID != 0 && uid == "0")
            {
                temp = YSGPtopService.LoadEntities(x => x.Del_f == 0 && x.PGbumen == bumenID && x.GPState == 2).DefaultIfEmpty().OrderBy(x => x.GPtime).ToList();
            }
            else if (bumenID != 0 && uid != "0")
            {
                temp = YSGPtopService.LoadEntities(x => x.Del_f == 0 && x.PGperson.Contains(uid) && x.GPState == 2).DefaultIfEmpty().OrderBy(x => x.GPtime).ToList();
            }
            if (startDate != "0" && endDate != "0")
            {
                DateTime start = Convert.ToDateTime(startDate);
                DateTime end   = Convert.ToDateTime(endDate);
                temp = temp.Where(x => x.GPtime >= start && x.GPtime <= end).DefaultIfEmpty().ToList();
            }
            if (temp != null && temp[0] != null)
            {
                foreach (var a in temp)
                {
                    GPtop gt = new GPtop();
                    gt.ID      = a.ID;
                    gt.GPtime  = a.GPtime;
                    gt.PGbumen = a.BumenInfoSet.Name;
                    if (a.PGperson.IndexOf("|") == -1)
                    {
                        int id       = Convert.ToInt32(a.PGperson);
                        var userinfo = userList.Where(x => x.ID == id).FirstOrDefault();
                        gt.PGperson = userinfo.PerSonName;
                    }
                    else
                    {
                        string userStr = "";
                        var    ary     = a.PGperson.Split('|');
                        foreach (var b in ary)
                        {
                            int sid      = Convert.ToInt32(b.Trim());
                            var userinfo = userList.Where(x => x.ID == sid).FirstOrDefault();
                            userStr = userStr == "" ? userinfo.PerSonName : userStr + "、" + userinfo.PerSonName;
                        }
                        gt.PGperson = userStr;
                    }
                    gt.StartTime        = a.StartTime;
                    gt.EndTime          = a.EndTime;
                    gt.WorkTime         = a.WorkTime;
                    gt.PGpersonAllWages = a.PGpersonAllWages;
                    gt.SettlementAmount = a.SettlementAmount;
                    gt.gpInfo           = a.WorkInfo;
                    gt.WorkAddress      = a.BumenInfoSet1.Name;
                    gt.pingJiaStateNum  = a.pingjiaState;
                    gt.pingJiaState     = a.pingjiaState == 0 ? "满意" : a.pingjiaState == 1 ? "一般" : "不满意";
                    rtmp.Add(gt);
                }
            }
            return(Json(new { rows = rtmp, total = toalcount }, JsonRequestBehavior.AllowGet));
        }