/// <summary>
        /// 获取终端用户的车辆列表
        /// </summary>
        /// <param name="tenantCode"></param>
        /// <returns></returns>
        public List<ChangeCusCarWithOMViewModel> GetEndCustomerCarList(string tenantCode, string iconSkin)
        {
            List<ChangeCusCarWithOMViewModel> list = new List<ChangeCusCarWithOMViewModel>();
            ChangeCusCarWithOMViewModel car=new ChangeCusCarWithOMViewModel ();
            TenantDAL dal=new TenantDAL ();
            EMTenant emt=new EMTenant ();
            emt=dal.GetTenantBySuperTenantID(tenantCode);
            car.IsLastCreated = false;
            car.IsOM = emt.TenantType == EnumTenantType.EndCustomer;
            car.TenantCode = emt.TenantCode;
            car.TenantName = emt.TenantName;
            car.OperatorLevel = emt.OperatorLevel;
            car.Children = new List<ChangeCusCarWithOMViewModel>();
            car.RegisterUserCode = emt.RegisterUserCode;
            car.VehicleCount = 0;
            car.VehicleOnlineNum = 0;
            car.iconSkin = "pIcon";
            list.Add(car);

            List<EMVehicle> veList = new VehicleDAL().GetVehicleListByTenantCode(tenantCode);
            if (veList != null && veList.Count > 0)
            {
                List<ChangeCusCarWithOMViewModel>   vechileList = new List<ChangeCusCarWithOMViewModel>();
                for (int a = 0; a < veList.Count; a++)
                {
                    ChangeCusCarWithOMViewModel ve = new ChangeCusCarWithOMViewModel();
                    ve.TenantCode = veList[a].VehicleCode.ToString();
                    ve.TenantName = veList[a].LicenceNumber;
                    ve.iconSkin = "CarDeviceNo";

                    vechileList.Add(ve);
                }
                list[0].iconSkin = iconSkin; //值为CarDeviceNo表示是车辆的上一级可以选中,为空表示车辆的上一级不可以选中
                list[0].Children.AddRange(vechileList);
            }
            return list;
        }
Esempio n. 2
0
        /// <summary>
        /// 采用ado显示运营商管理列表
        /// </summary>
        /// <param name="likeValue"></param>
        /// <param name="rowIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="rowCount"></param>
        /// <returns></returns>
        public IList<EMUser> SearchOperatingMerchant(string likeValue, int rowIndex, int pageSize, ref int rowCount)
        {
            TenantDAL dal = new TenantDAL();
            return  dal.SearchOperatingMerchant(likeValue, rowIndex, pageSize, ref rowCount);

            //Query query = new Query(typeof(EMUser));
            //query.Associations.Add(new Association("Tenant"));
            //Expression expression = Expression.CreateExpression("IsRegisterUser", BinaryOperatorType.EqualTo, true);
            //if (!string.IsNullOrEmpty(likeValue.Trim()))
            //{
            //    likeValue = "%" + likeValue + "%";
            //    expression &= (Expression.CreateExpression("UserName", BinaryOperatorType.Like, likeValue)
            //        | Expression.CreateExpression("Tenant.TenantName", BinaryOperatorType.Like, likeValue)
            //        | Expression.CreateExpression("Tenant.ContactName", BinaryOperatorType.Like, likeValue)
            //        | Expression.CreateExpression("Tenant.PhoneNumber", BinaryOperatorType.Like, likeValue));
            //}
            //expression &= Expression.CreateExpression("Tenant.TenantType", BinaryOperatorType.EqualTo, EnumTenantType.OperatingMerchant);
            //query.Expression = expression;
            //using (IRepository session = SessionManager.CreateRepository(typeof(EMUser)))
            //{
            //    query.Projections.Add(Projection.RowCount());
            //    rowCount = session.Single<int>(query);
            //    if (rowCount == 0)
            //        return null;
            //    query.Order = Order.Desc("Tenant.CreateTime");
            //    query.Index = rowIndex;
            //    query.Count = pageSize;
            //    query.Projections.Clear();
            //    return session.List<EMUser>(query);
            //}
        }