Ejemplo n.º 1
0
        public ActionResult BaoXianListProvide(BaoXianDTO baoDanDTO)
        {
            if (!base.HasPermission("BaoXian", PermissionOperate.manager))
            {
                return(null);
            }

            int isAll = 1;

            if (!base.HasPermission("BaoXianAll", PermissionOperate.manager))
            {
                baoDanDTO.MpUserId = base.LoginAdmin.MpUserId.HasValue ? base.LoginAdmin.MpUserId : Guid.Empty;
                isAll = 0;
            }
            OceanDynamicList <object> list = _baodanService.GetPageDynamicList(PageIndex, PageSize, baoDanDTO, isAll);

            if (list != null)
            {
                return(Content(list.ToJson(), "text/javascript"));
            }
            else
            {
                return(Content("{\"rows\":[],\"total\":0}", "text/javascript"));
            }
        }
Ejemplo n.º 2
0
        public OceanDynamicList <object> GetPageDynamicList(int pageIndex, int pageSize, BaoXianDTO baodanDTO, int isAll)
        {
            string condition = "";
            Dictionary <string, object> parms = new Dictionary <string, object>();

            if (!string.IsNullOrEmpty(baodanDTO.TouBaoGongSi))
            {
                parms.Add("TouBaoGongSi", baodanDTO.TouBaoGongSi);
                if (!string.IsNullOrEmpty(condition))
                {
                    condition += " and ";
                }
                else
                {
                    condition += " where ";
                }
                condition += "TouBaoGongSi=@TouBaoGongSi";
            }
            if (!string.IsNullOrEmpty(baodanDTO.TouBaoRen))
            {
                parms.Add("TouBaoRen", baodanDTO.TouBaoRen);
                if (!string.IsNullOrEmpty(condition))
                {
                    condition += " and ";
                }
                else
                {
                    condition += " where ";
                }
                condition += "TouBaoRen like '%'+@TouBaoRen+'%'";
            }
            if (baodanDTO.StartDate.HasValue)
            {
                parms.Add("StartDate", baodanDTO.StartDate);
                if (!string.IsNullOrEmpty(condition))
                {
                    condition += " and ";
                }
                else
                {
                    condition += " where ";
                }
                condition += "f.QiBaoDate >= @StartDate";
            }
            if (baodanDTO.EndDate.HasValue)
            {
                parms.Add("EndDate", baodanDTO.EndDate);
                if (!string.IsNullOrEmpty(condition))
                {
                    condition += " and ";
                }
                else
                {
                    condition += " where ";
                }
                condition += "f.QiBaoDate <= @EndDate";
            }
            if (!string.IsNullOrEmpty(baodanDTO.ChePai))
            {
                parms.Add("ChePai", baodanDTO.ChePai);
                if (!string.IsNullOrEmpty(condition))
                {
                    condition += " and ";
                }
                else
                {
                    condition += " where ";
                }
                condition += "ChePai like '%'+@ChePai+'%'";
            }
            if (baodanDTO.BaoXianQiXian.HasValue)
            {
                parms.Add("BaoXianQiXian", baodanDTO.BaoXianQiXian);
                if (!string.IsNullOrEmpty(condition))
                {
                    condition += " and ";
                }
                else
                {
                    condition += " where ";
                }
                condition += "BaoXianQiXian = @BaoXianQiXian'";
            }
            if (!string.IsNullOrEmpty(baodanDTO.HouSiWei))
            {
                parms.Add("HouSiWei", baodanDTO.HouSiWei);
                if (!string.IsNullOrEmpty(condition))
                {
                    condition += " and ";
                }
                else
                {
                    condition += " where ";
                }
                condition += "HouSiWei like '%'+@HouSiWei+'%'";
            }
            if (!string.IsNullOrEmpty(baodanDTO.LaiYuan))
            {
                parms.Add("LaiYuan", baodanDTO.LaiYuan);
                if (!string.IsNullOrEmpty(condition))
                {
                    condition += " and ";
                }
                else
                {
                    condition += " where ";
                }
                condition += "LaiYuan like '%'+@LaiYuan+'%'";
            }
            if (baodanDTO.XianZhong.HasValue)
            {
                parms.Add("XianZhong", baodanDTO.XianZhong);
                if (!string.IsNullOrEmpty(condition))
                {
                    condition += " and ";
                }
                else
                {
                    condition += " where ";
                }
                condition += "XianZhong = @XianZhong'";
            }

            if (isAll == 0)
            {
                parms.Add("MpUserId", baodanDTO.MpUserId);
                if (!string.IsNullOrEmpty(condition))
                {
                    condition += " and ";
                }
                else
                {
                    condition += " where ";
                }
                condition += "MpUserId = @MpUserId";
            }
            return(this.GetDynamicList("SELECT f.Id,f.MpUserId MpUserId,f.TouBaoGongSi,f.TouBaoRen,f.ChePai,f.QiBaoDate,f.BaoXianQiXian,f.HouSiWei,f.DengJiDate,f.BaoXianFei,f.CheChuanSui,f.LaiYuan,f.XianZhong,f.CreateDate CreateDate FROM BaoDan f " + condition + " order by f.CreateDate desc", pageIndex, pageSize, parms));
        }