Example #1
0
        /// <summary>
        /// 获取订单下拉
        /// </summary>
        /// <param name="loginName"></param>
        /// <param name="authority"></param>
        /// <returns></returns>
        public List <string> GetAdDesignList(string loginName, string authority)
        {
            List <string> list = new List <string>();

            CommonServiceFactory factory = new CommonServiceFactory();
            ICommonService       service = factory.GetInstance();

            StringBuilder where = new StringBuilder(" 1=1 ");
            tblUser_Sys user = CommonHelper.GetUserByLoginName(loginName);

            if (authority == "查看本人")
            {
                where.Append(" and (Seller= '" + user.UserName + "')");
            }
            else if (authority == "查看下级")
            {
                List <string> SellerXia = CommonHelper.ListUnderling(user.LoginName);
                string        CdtSeller = " (";
                CdtSeller += String.Join("", SellerXia.Select(p => "'" + p + "',").ToList());
                CdtSeller += "'" + user.UserName + "')";
                where.Append(" and (Seller in " + CdtSeller + ")");
            }
            else if (authority == "查看本部门")
            {
                string        Sql       = " select UserName from tblUser_Sys where dept_New in (select dept_New from tblUser_Sys where loginName='" + user.LoginName + "')";
                DataTable     DT        = DBContext.PTMMHZ.GetDataTable(Sql);
                List <string> SellerXia = new List <string>();
                for (int i = 0; i < DT.Rows.Count; i++)
                {
                    string UserName = Convert.ToString(DT.Rows[i]["UserName"]);
                    SellerXia.Add(UserName);
                }
                where.Append(" and (Seller in " + DBContext.PTMMHZ.AssemblyInCondition(SellerXia) + ")");
            }
            where.AppendFormat(@"and (adorderid in (select distinct  adorderid from tblAdOrderMedialist where InsureEndDate>='{0}') 
                                or adorderid in (select distinct  adorderid from tblAdFixingList where InsureEndDate>='{0}')
                                or adorderid in (select distinct  adorderid from tblOutdoorAdOrderMedia where EndDate>='{0}')
                                or adorderid in (select distinct  adorderid from tblBicycleMadialist where EndDate>='{0}'))", DateTime.Now);
            list = CommonHelper.ListDistinctField("tblAdOrder", "AdOrderId", where.ToString(), " adorderid desc");

            return(list);
        }