Exemplo n.º 1
0
        public IActionResult Index(string member)
        {
            var memberResult = new GetMemberResult();

            if (!string.IsNullOrEmpty(member))
            {
                var memberJson = member.UrlDecode();
                memberResult = JsonConvert.DeserializeObject <GetMemberResult>(memberJson);
            }
            else
            {
                memberResult = AppSessions.GetMember();
                if (memberResult == null)
                {
                    ViewData["Message"] = "人员信息不存在!";
                    return(View());
                }
            }

            if (string.IsNullOrEmpty(memberResult.userid))
            {
                ViewData["Message"] = "人员信息无效!";
                return(View());
            }

            AppSessions.SetMember(memberResult);
            return(View(memberResult));
        }
        public IActionResult 异常填报_Post(Wx异常说明 model)
        {
            if (model == null)
            {
                return(RedirectToAction(nameof(填报失败), "异常说明"));
            }

            var memberResult = AppSessions.GetMember();

            if (memberResult == null)
            {
                return(Redirect(OAuth2Api.GetCode(WeixinOptions.CorpId, "wx.pinhuadashi.com%2Fwxclock%2Foauth%3Freturnurl%3D%252Fwxclock%252Findex", "STATE")));
            }

            model.用户号 = memberResult.userid;
            model.姓名  = memberResult.name;

            if (!model.时间.HasValue || !model.类型.HasValue || string.IsNullOrEmpty(model.用户号))
            {
                return(RedirectToAction(nameof(填报失败), "异常说明"));
            }

            var rtId = "148.1";
            var rcId = pinhuaContext.GetNewRcId();

            model.ExcelServerRtid = rtId;
            model.ExcelServerRcid = rcId;
            model.是否通知            = 0;
            model.是否处理            = 0;
            model.填报时间            = DateTime.Now;

            var repCase = new EsRepCase
            {
                RcId          = rcId,
                RtId          = rtId,
                LstFiller     = 2,
                LstFillerName = memberResult.name,
                LstFillDate   = DateTime.Now,
                FillDate      = DateTime.Now,
            };

            pinhuaContext.EsRepCase.Add(repCase);
            pinhuaContext.Wx异常说明.Add(model);
            var iRet = pinhuaContext.SaveChanges();

            if (iRet > 0)
            {
                return(RedirectToAction(nameof(填报成功), "异常说明"));
            }
            else
            {
                return(RedirectToAction(nameof(填报失败), "异常说明"));
            }
        }
        public IActionResult Index()
        {
            var memberResult = AppSessions.GetMember();

            if (memberResult == null)
            {
                return(Redirect(OAuth2Api.GetCode(WeixinOptions.CorpId, "wx.pinhuadashi.com%2Fwxclock%2Foauth%3Freturnurl%3D%252Fwxclock%252Findex", "STATE")));
            }

            return(View(memberResult));
        }
Exemplo n.º 4
0
        public IActionResult Tab4()
        {
            var memberResult = AppSessions.GetMember();

            if (memberResult == null)
            {
                return(Redirect(OAuth2Api.GetCode(WeixinOptions.CorpId, "wx.pinhuadashi.com%2Fwxclock%2Foauth%3Freturnurl%3D%252Fwxclock%252Findex", "STATE")));
            }

            ViewData[nameof(GetDepartmentListResult)] = GetDepartmentList();

            return(View(memberResult));
        }
Exemplo n.º 5
0
        public IActionResult OAuth(string code, string state, string returnUrl)
        {
            if (string.IsNullOrEmpty(code))
            {
                ViewData["Message"] = "code值为空";
                return(View());
            }

            var tokenResult = CommonApi.GetToken(WeixinOptions.CorpId, WeixinOptions.Secret);

            if (!(tokenResult.errcode == Senparc.Weixin.ReturnCode_QY.请求成功))
            {
                ViewData["Message"] = JsonConvert.SerializeObject(tokenResult);
                return(View());
            }

            var userinfoResult = OAuth2Api.GetUserId(tokenResult.access_token, code);

            if (!(userinfoResult.errcode == Senparc.Weixin.ReturnCode_QY.请求成功))
            {
                ViewData["Message"] = JsonConvert.SerializeObject(userinfoResult);
                return(View());
            }

            if (string.IsNullOrEmpty(userinfoResult.UserId))
            {
                ViewData["Message"] = "非企业人员,考勤功能不可用!";
                return(View());
            }

            var memberResult = MailListApi.GetMember(tokenResult.access_token, userinfoResult.UserId);

            if (memberResult.errcode == Senparc.Weixin.ReturnCode_QY.请求成功)
            {
                if (string.IsNullOrEmpty(returnUrl))
                {
                    return(View());
                }
                else
                {
                    AppSessions.SetMember(memberResult);
                    return(RedirectToAction(nameof(Index)));
                }
            }

            return(View());
        }
Exemplo n.º 6
0
        public IActionResult 待办审批DisAgree(Wx异常说明 model)
        {
            if (model == null)
            {
                return(View());
            }

            var memberResult = AppSessions.GetMember();

            if (memberResult == null)
            {
                return(Redirect(OAuth2Api.GetCode(WeixinOptions.CorpId, "wx.pinhuadashi.com%2Fwxclock%2Foauth%3Freturnurl%3D%252Fwxclock%252Findex", "STATE")));
            }

            pinhuaContext.Wx异常说明.Where(p => p.ExcelServerRcid == model.ExcelServerRcid).FirstOrDefault().是否处理 = 2;
            pinhuaContext.Wx异常说明.Where(p => p.ExcelServerRcid == model.ExcelServerRcid).FirstOrDefault().处理人  = memberResult.name;
            pinhuaContext.Wx异常说明.Where(p => p.ExcelServerRcid == model.ExcelServerRcid).FirstOrDefault().处理时间 = DateTime.Now;
            pinhuaContext.SaveChanges();

            return(RedirectToAction("Index", "WxClock", new { member = JsonConvert.SerializeObject(memberResult) }));
        }