private string GetList(HttpContext context)
        {
            int    pageIndex = ObjectConvertHelper.ConvertToInt(context.Request["page"]);
            int    pageSize  = ObjectConvertHelper.ConvertToInt(context.Request["limit"]);
            string name      = ObjectConvertHelper.ConvertToString(context.Request["txtName"]);

            string strWhere = "";

            if (!string.IsNullOrEmpty(name))
            {
                strWhere += " and (UserName like '%" + name + "%' or StaffName like '%" + name + "%' )";
            }

            StaffsBLL     bll  = new StaffsBLL();
            List <Staffs> list = bll.GetList(strWhere, pageIndex, pageSize);

            int count = bll.GetCount(strWhere);

            var iso = new IsoDateTimeConverter();

            iso.DateTimeFormat = "yyyy-MM-dd";
            return(JsonConvert.SerializeObject(new
            {
                code = "0",
                msg = "",
                count = count,
                data = list
            }, iso));
        }
示例#2
0
        private string GetModel(HttpContext context)
        {
            int        id    = ObjectConvertHelper.ConvertToInt(context.Request["id"]);
            SysMenuBLL bll   = new SysMenuBLL();
            var        model = bll.GetModel(id);

            return(JsonConvert.SerializeObject(model));
        }
示例#3
0
        private string GetModel(HttpContext context)
        {
            SysDepartBLL bll = new SysDepartBLL();
            int          id  = ObjectConvertHelper.ConvertToInt(context.Request["id"]);

            SysDepart model = bll.GetModel(id);

            if (model.ParentId == 0)
            {
                model.ParentName = "无上级部门";
            }
            return(JsonConvert.SerializeObject(model));
        }
示例#4
0
        private string GetMaxCode(HttpContext context)
        {
            SysDepartBLL bll      = new SysDepartBLL();
            int          parentId = ObjectConvertHelper.ConvertToInt(context.Request["parentId"]);
            SysDepart    model    = bll.GetModel(parentId);

            if (model == null)
            {
                model            = new SysDepart();
                model.DepartName = "无上级部门";
                model.Id         = parentId;
            }
            return(JsonConvert.SerializeObject(model));
        }
        private string GetList(HttpContext context)
        {
            int    pageIndex = ObjectConvertHelper.ConvertToInt(context.Request["page"]);
            int    pageSize  = ObjectConvertHelper.ConvertToInt(context.Request["limit"]);
            string name      = ObjectConvertHelper.ConvertToString(context.Request["txtName"]);

            string strWhere = " and OrderType=1 ";

            if (!string.IsNullOrEmpty(name))
            {
                strWhere += "  and OrderType=1 and UserName like '%" + name + "%' ";
            }
            if (context.User != null)
            {
                OrdersBLL     bll    = new OrdersBLL();
                List <Orders> list   = bll.GetList(strWhere, pageIndex, pageSize);
                var           config = new MapperConfiguration(cfg => cfg.CreateMap <Orders, ViewOrders>()
                                                               .ForMember(dest => dest.Sex, opt => opt.MapFrom((src, des) => { if (src.Sex == 1)
                                                                                                                               {
                                                                                                                                   return("男");
                                                                                                                               }
                                                                                                                               return("女"); }))
                                                               .ForMember(dest => dest.CreateTime, opt => opt.MapFrom((src, des) => src.CreateTime.ToString("yyyy-MM-dd HH:mm"))));

                var mapper = config.CreateMapper();
                List <ViewOrders> list2 = mapper.Map <List <Orders>, List <ViewOrders> >(list);
                int count = bll.GetCount(strWhere);
                return(JsonConvert.SerializeObject(new
                {
                    code = "0",
                    msg = "",
                    count = count,
                    data = list2
                }));
            }
            else
            {
                return(JsonConvert.SerializeObject(new
                {
                    code = "0",
                    msg = "",
                    count = 0,
                    data = ""
                }));
            }
        }
        private string ResetPwd(HttpContext context)
        {
            int       id  = ObjectConvertHelper.ConvertToInt(context.Request["id"]);
            StaffsBLL bll = new StaffsBLL();

            if (bll.ResetPwd(id))
            {
                return(JsonConvert.SerializeObject(new
                {
                    success = 0,
                    msg = "操作成功"
                }));
            }
            return(JsonConvert.SerializeObject(new
            {
                success = 1,
                msg = "操作失败"
            }));
        }
示例#7
0
        private string DeleteData(HttpContext context)
        {
            int    id   = ObjectConvertHelper.ConvertToInt(context.Request["id"]);
            string name = context.Request["name"];

            SysDepartBLL bll     = new SysDepartBLL();
            var          dept    = bll.GetModel(id);
            StaffsBLL    userBll = new StaffsBLL();

            if (bll.GetCount(" and ParentId=" + id) > 1)
            {
                return(JsonConvert.SerializeObject(new
                {
                    success = 1,
                    msg = "该部门下面子级部门,不能删除!"
                }));
            }
            if (userBll.GetCount(" and DepartId='" + id + "' ") > 0)
            {
                return(JsonConvert.SerializeObject(new
                {
                    success = 1,
                    msg = "该部门下面有用户,不能删除!"
                }));
            }
            if (bll.Delete(id))
            {
                return(JsonConvert.SerializeObject(new
                {
                    success = 0,
                    msg = "Success"
                }));
            }
            else
            {
                return(JsonConvert.SerializeObject(new
                {
                    success = 1,
                    msg = "删除失败"
                }));
            }
        }
        private string DeleteData(HttpContext context)
        {
            int       id  = ObjectConvertHelper.ConvertToInt(context.Request["id"]);
            StaffsBLL bll = new StaffsBLL();

            if (bll.Delete(id))
            {
                return(JsonConvert.SerializeObject(new
                {
                    success = 0,
                    msg = "删除成功"
                }));
            }
            else
            {
                return(JsonConvert.SerializeObject(new
                {
                    success = 1,
                    msg = "删除失败"
                }));
            }
        }
示例#9
0
        private string GetList(HttpContext context)
        {
            int    pageIndex = ObjectConvertHelper.ConvertToInt(context.Request["page"]);
            int    pageSize  = ObjectConvertHelper.ConvertToInt(context.Request["limit"]);
            string name      = ObjectConvertHelper.ConvertToString(context.Request["txtName"]);

            string strWhere = "";

            if (!string.IsNullOrEmpty(name))
            {
                strWhere += " and Name like '%" + name + "%' ";
            }
            if (context.User != null)
            {
                SysMenuBLL     bll   = new SysMenuBLL();
                List <SysMenu> list  = bll.GetList(strWhere, pageIndex, pageSize);
                int            count = bll.GetCount(strWhere);
                return(JsonConvert.SerializeObject(new
                {
                    code = "0",
                    msg = "",
                    count = count,
                    data = list
                }));
            }
            else
            {
                return(JsonConvert.SerializeObject(new
                {
                    code = "0",
                    msg = "",
                    count = 0,
                    data = ""
                }));
            }
        }
        private string GetOrderDetail(HttpContext context)
        {
            string orderNo = ObjectConvertHelper.ConvertToString(context.Request["OrderNo"]);

            string strWhere = "";

            if (!string.IsNullOrEmpty(orderNo))
            {
                strWhere += string.Format(" and orderNo='{0}'", orderNo);
            }
            if (context.User != null)
            {
                OrderDetailBLL            bll  = new OrderDetailBLL();
                List <Models.OrderDetail> list = bll.GetList(strWhere);
                var config = new MapperConfiguration(cfg => cfg.CreateMap <Models.OrderDetail, ViewOrderDetail>()
                                                     .ForMember(dest => dest.SPPaymentAge, opt => opt.MapFrom((src, des) => src.SPPaymentAge.ToString() + "年"))
                                                     .ForMember(dest => dest.SavingProduct, opt => opt.MapFrom((src, des) =>
                {
                    if (src.ProductType == 1)                                              //储蓄类
                    {
                        switch (src.SavingProduct)
                        {
                        case 1:
                            return("财富20");

                        case 2:
                            return("金瑞20");

                        default:
                            return("");
                        }
                    }
                    else                                             //保障类
                    {
                        switch (src.SavingProduct)
                        {
                        case 10:
                            return("成人平安福");

                        case 20:
                            return("少儿平安福");

                        case 30:
                            return("大福星");

                        case 40:
                            return("小福星");

                        case 50:
                            return("福满分");

                        case 60:
                            return("爱满分");

                        default:
                            return("");
                        }
                    }
                }))
                                                     .ForMember(dest => dest.CreateTime, opt => opt.MapFrom((src, des) => src.CreateTime.ToString("yyyy-MM-dd HH:mm"))));

                var mapper = config.CreateMapper();
                List <ViewOrderDetail> list2 = mapper.Map <List <Models.OrderDetail>, List <ViewOrderDetail> >(list);
                int count = bll.GetCount(strWhere);
                return(JsonConvert.SerializeObject(new
                {
                    code = "0",
                    msg = "",
                    count = count,
                    data = list2
                }));
            }
            else
            {
                return(JsonConvert.SerializeObject(new
                {
                    code = "0",
                    msg = "",
                    count = 0,
                    data = ""
                }));
            }
        }