示例#1
0
        public AjaxMessage GetOrderCustomer(int page, int pagesize, string sortName, PropModel[] searchs, string orderEmployee)
        {
            AjaxMessage ajax = new AjaxMessage();

            ajax.IsSuccess = false;
            try
            {
                List <Expression <Func <OrderDto, bool> > > parmList = new List <Expression <Func <OrderDto, bool> > >();

                if (!string.IsNullOrEmpty(orderEmployee))
                {
                    parmList.Add(c => c.EmployeeId.ToString() == orderEmployee);

                    string employeeId = orderEmployee.ToInt32() > 0 ? orderEmployee : LoginInfo.UserInfo.EmployeeId.ToString();
                    //选择只显示选择人个人的邀约信息
                    bool isLookLowLevel = orderEmployee.ToInt32() > 0 ? false : true;
                    ExpressionTools.GetParsByCondition <OrderDto>("EmployeeId", parmList, employeeId, "Contains", true, isLookLowLevel);
                }
                else
                {
                    //默认获取本人及下级邀约信息
                    MyEmployee sel_emp = new MyEmployee();
                    sel_emp.GetMyEmployee <OrderDto>("EmployeeId", parmList, true);
                }

                if (searchs.Count() > 0)
                {
                    foreach (PropModel item in searchs)
                    {
                        if (item.value != "-1")          //有明确的某个状态
                        {
                            if (!string.IsNullOrEmpty(item.value))
                            {
                                if (!(item.value.Contains(',')))
                                {
                                    ExpressionTools.GetEqualPars(item.property, parmList, item.value, item.method);
                                }
                                else if (item.value.Contains(','))      //时间 婚期
                                {
                                    TimeHelper.GetPartyDateTime(item.value.ToString(), out start, out end);
                                    parmList.Add(c => c.PartyDate >= start && c.PartyDate <= end);
                                }
                            }
                        }
                        else            //二选一/多选一/确认到店
                        {
                            parmList.Add(c => ("5,6,7,8").Contains(c.OrderState.ToString()));
                        }
                    }
                }
                int count = 0;

                var dataList = _orderService.GetAllByPages(page, pagesize, parmList, sortName, out count);
                if (dataList.Count > 0)
                {
                    ajax.IsSuccess = true;

                    ajax.data      = dataList;
                    ajax.total     = count;                                    //数据总条数
                    ajax.PageIndex = page;                                     //当前页
                    ajax.PageSize  = pagesize;                                 //每页显示条数
                    ajax.EmpId     = LoginInfo.UserInfo.EmployeeId.ToString(); //登录员工
                }
            }
            catch (Exception e)
            {
                ajax.Message = e.Message;
            }

            return(ajax);
        }
示例#2
0
        public AjaxMessage GetInviteCustomer(int page, int pageSize, string sortName, PropModel[] searchs, string inviteEmployee)
        {
            AjaxMessage ajax = new AjaxMessage();

            ajax.IsSuccess = false;
            ajax.Message   = "查询失败,系统异常";
            try
            {
                int count = 0;
                List <Expression <Func <InviteDto, bool> > > parmList = new List <Expression <Func <InviteDto, bool> > >();

                #region 条件
                //默认显示当前登录人以及下级的邀约的信息
                if (!string.IsNullOrEmpty(inviteEmployee))
                {
                    string employeeId = inviteEmployee.ToInt32() > 0 ? inviteEmployee : LoginInfo.UserInfo.EmployeeId.ToString();
                    //选择只显示选择人个人的邀约信息
                    bool isLookLowLevel = inviteEmployee.ToInt32() > 0 ? false : true;
                    ExpressionTools.GetParsByCondition <InviteDto>("InviteEmployee", parmList, employeeId, "Contains", true, isLookLowLevel);
                }
                else
                {
                    //默认获取本人及下级邀约信息
                    MyEmployee sel_emp = new MyEmployee();
                    sel_emp.GetMyEmployee <InviteDto>("InviteEmployee", parmList, true);
                }

                if (searchs.Count() > 0)
                {
                    foreach (PropModel item in searchs)
                    {
                        if (item.value != "-1")          //有明确的某个状态
                        {
                            if (!string.IsNullOrEmpty(item.value))
                            {
                                if (!(item.value.Contains(',')))
                                {
                                    ExpressionTools.GetEqualPars(item.property, parmList, item.value, item.method);
                                }
                                else if (item.value.Contains(','))      //时间 婚期
                                {
                                    TimeHelper.GetPartyDateTime(item.value.ToString(), out start, out end);
                                    parmList.Add(c => c.PartyDate >= start && c.PartyDate <= end);
                                }
                            }
                        }
                        else            //邀约/未邀约/邀约成功/确认到店
                        {
                            parmList.Add(c => ("1,2,3,5").Contains(c.State.ToString()));
                        }
                    }
                }


                #endregion

                var DataList = _inviteService.GetAllByPage(page, pageSize, parmList, sortName, out count);
                ajax.data      = DataList;
                ajax.total     = count;                                    //数据总条数
                ajax.PageIndex = page;                                     //当前页
                ajax.PageSize  = pageSize;                                 //每页显示条数
                ajax.EmpId     = LoginInfo.UserInfo.EmployeeId.ToString(); //登录员工

                ajax.IsSuccess = true;
            }
            catch (Exception e)
            {
                ajax.Message = e.Message;
            }

            return(ajax);
        }