コード例 #1
0
 public MicroResource GetMicroCourseByKey(string key)
 {
     using (var dbres = new MODResourceEntities())
     {
         MicroResource microresource = new MicroResource();
         microresource.FileUrl           = AppSetting.FileUrl;
         microresource.microResourceList = new List <Resource>();
         List <tb_Code_Knowledge> CataAllids = CacheHelper.Get("CataIds") as List <tb_Code_Knowledge>;
         int[] konwledges = CataAllids.Select(s => s.ID).ToArray();
         IQueryable <tb_Resource> qresource = dbres.tb_Resource.Where(w => w.tb_ResourceKnowledge.Where(wrk => konwledges.Contains(wrk.KnowledgeID)).Select(s1 => s1.ResourceID).Contains(w.ID) && w.IsDelete == 0);
         if (!string.IsNullOrEmpty(key))
         {
             qresource = qresource.Where(w => w.Title.Contains(key));
         }
         microresource.microResourceList = qresource.OrderBy(o => o.UploadDate).Select(s => new Resource
         {
             ID          = s.ID.ToString(),
             FileID      = s.FileID.ToString(),
             Title       = s.Title,
             Description = s.Description,
             FileType    = s.FileType,
             KeyWords    = s.KeyWords,
             UploadDate  = s.UploadDate
         }).ToList();
         microresource.resourceCount = qresource.Count();
         return(microresource);
     }
 }
コード例 #2
0
 public MicroResource GetMicroCourseByKnowledgeID(string ids, string key)
 {
     using (var dbres = new MODResourceEntities())
     {
         MicroResource microresource = new MicroResource();
         microresource.FileUrl           = AppSetting.FileUrl;
         microresource.microResourceList = new List <Resource>();
         string[] cataids = ids.Split(',');
         IQueryable <tb_Resource> qresource = dbres.tb_Resource.Where(w => w.tb_ResourceKnowledge.Where(wrk => cataids.Contains(wrk.KnowledgeID.ToString())).Select(s1 => s1.ResourceID).Contains(w.ID) && w.IsDelete == 0);
         if (!string.IsNullOrEmpty(key))
         {
             qresource = qresource.Where(w => w.Title.Contains(key));
         }
         microresource.microResourceList = qresource.OrderBy(o => o.UploadDate).Select(s => new Resource
         {
             ID          = s.ID.ToString(),
             FileID      = s.FileID.ToString(),
             Title       = s.Title,
             Description = s.Description,
             FileType    = s.FileType,
             KeyWords    = s.KeyWords,
             UploadDate  = s.UploadDate
         }).ToList();
         microresource.resourceCount = microresource.microResourceList.Count;
         return(microresource);
     }
 }
コード例 #3
0
        public void TestMicroResources(string input, string expectedInvariantName, string expectedInvariantCategory)
        {
            var result = MicroResource.FromEDName(input);

            Assert.AreEqual(expectedInvariantName, result.invariantName);
            Assert.AreEqual(expectedInvariantCategory, result.Category.invariantName);
        }
コード例 #4
0
 public MicroResourcesPurchasedEvent(DateTime timestamp, MicroResource microResource, int amount, int price, long?marketid) : base(timestamp, NAME)
 {
     this.microResource = microResource;
     this.amount        = amount;
     this.price         = price;
     this.marketid      = marketid;
 }
コード例 #5
0
        public JsonResult GetMicroCourseByKey(string key = "")
        {
            MicroCourseBLL mCourseBll    = new MicroCourseBLL();
            MicroResource  microresource = mCourseBll.GetMicroCourseByKey(key);
            KingResponse   response      = KingResponse.GetResponse(null, microresource);

            return(Json(response));
        }
コード例 #6
0
 public MissionCompletedEvent(DateTime timestamp, long?missionid, string name, string faction, MicroResource microResource, CommodityDefinition commodity, int?amount, bool communal, long reward, List <string> permitsawarded = null, List <CommodityAmount> commodityrewards = null, List <MaterialAmount> materialsrewards = null, List <MicroResourceAmount> microResourceRewards = null, List <MissionFactionEffect> factionEffects = null, long donation = 0) : base(timestamp, NAME)
 {
     this.missionid            = missionid;
     this.name                 = name;
     this.faction              = faction;
     this.commodityDefinition  = commodity;
     this.microResource        = microResource;
     this.amount               = amount;
     this.communal             = communal;
     this.reward               = reward;
     this.permitsawarded       = permitsawarded;
     this.commodityrewards     = commodityrewards;
     this.materialsrewards     = materialsrewards;
     this.microresourcerewards = microResourceRewards;
     this.factionEffects       = factionEffects;
     this.donation             = donation;
     if (permitsawarded?.Count > 0)
     {
         this.rewardPermit = permitsawarded[0];
     }
     if (this.commodityrewards?.Count > 0)
     {
         this.rewardCommodity       = commodityrewards[0].commodity;
         this.rewardCommodityAmount = commodityrewards[0].amount;
     }
     if (materialsrewards?.Count > 0)
     {
         this.rewardMaterial       = materialsrewards[0].material;
         this.rewardMaterialAmount = materialsrewards[0].amount;
     }
     if (microResourceRewards?.Count > 0)
     {
         this.rewardMicroResource       = microResourceRewards[0].microResource?.localizedName;
         this.rewardMicroResourceAmount = microResourceRewards[0].amount;
     }
 }
コード例 #7
0
 public MissionAcceptedEvent(DateTime timestamp, long?missionid, string name, string localisedname, string faction, string destinationsystem, string destinationstation, MicroResource microResource, CommodityDefinition commodity, int?amount, bool?passengerwanted, string passengertype, bool?passengervips, string target, string targettype, string targetfaction, bool communal, DateTime?expiry, string influence, string reputation, int?reward, bool wing) : base(timestamp, NAME)
 {
     this.missionid           = missionid;
     this.name                = name;
     this.localisedname       = localisedname;
     this.faction             = faction;
     this.destinationsystem   = destinationsystem;
     this.destinationstation  = destinationstation;
     this.commodityDefinition = commodity;
     this.microResource       = microResource;
     this.amount              = amount;
     this.passengertype       = passengertype;
     this.passengerwanted     = passengerwanted;
     this.passengervips       = passengervips;
     this.target              = target;
     this.targettype          = targettype;
     this.targetfaction       = targetfaction;
     this.communal            = communal;
     this.expiry              = expiry;
     this.influence           = influence;
     this.reputation          = reputation;
     this.reward              = reward;
     this.wing                = wing;
 }