public ListDetail Get(ListCriteria criteria) { using (var uow = UnitOfWorkFactory.Create <NovelContext>()) { var service = new ListService(uow); var detail = service.Get(criteria); // connector detail.Connectors = service.View <Connector>() .Where(w => w.IsDeleted == false && w.ConnectorType == R.ConnectorType.SERIES_USERLIST) .Where(w => w.TargetID == detail.ID).ToList(); // series var listSeriesIDs = detail.Connectors.Select(s => s.SourceID).ToList(); detail.Series = new SeriesService(uow).Search(new SearchModel <SeriesCriteria> { Criteria = new SeriesCriteria { IDs = listSeriesIDs }, PagedListConfig = new PagedListConfig { PageSize = int.MaxValue } }).Data; // releases detail.Releases = service.View <Release>().Where(w => listSeriesIDs.Contains(w.SeriesID)).ToList(); // user reads var releaseIDs = detail.Releases.Select(s => s.ID); detail.Reads = service.View <UserRead>().Where(w => w.UserID == criteria.ByUserID) .Where(w => w.SourceTable == R.SourceTable.RELEASE) .Where(w => releaseIDs.Contains(w.SourceID)).ToList(); return(detail); } }
public ActionResult <List <List> > Get() => _listService.Get();
public static void ReceivefromIdeaZone() { _channel = _connection.CreateModel(); { var queueName = _channel.QueueDeclare( queue: IdeaZoneQueueName, durable: true, exclusive: false, autoDelete: false, arguments: null); // _channel.ExchangeDeclare(exchange: "logs", type: ExchangeType.Fanout); Console.WriteLine(" [*] Waiting for Ideas."); var consumer = new EventingBasicConsumer(_channel); consumer.Received += (model, ea) => { //Console.WriteLine("coming here"); var body = ea.Body; string message = Encoding.Default.GetString(body); Console.WriteLine(" [x] ----> {0}", message); var userstoryfromidea = JsonConvert.DeserializeObject <UserStoryIdeas>(message); Console.WriteLine("Object:{0}", userstoryfromidea.linkedtoId); //KanbanUserStory sendData = new KanbanUserStory(); // sendData = GetUserStoryfromGantt(sendData,userstory); // userService.Create(sendData); // Console.WriteLine("text:{0}",sendData); //b.SendUserStoryToAddOnList(userstoryfromidea.projectId,"success"); //Clients.Group(userstoryfromidea.projectId).SendAsync("RabbitListUpdate","success"); if (userstoryfromidea.action == "post") { KanbanUserStory sendData = new KanbanUserStory(); sendData.uniqueId = userstoryfromidea.linkedtoId; sendData.shortName = userstoryfromidea.description; //sendData.acceptanceCriteria = userstoryfromidea.acceptanceCriteria; if (userstoryfromidea.acceptanceCriteria == null) { sendData.acceptanceCriteria = new string[0] { }; } else { sendData.acceptanceCriteria = userstoryfromidea.acceptanceCriteria; } sendData.linkedToId = userstoryfromidea.linkedtoId; sendData.startTime = DateTime.Now; sendData.endTime = DateTime.Now; sendData.status = "Product Backlog"; //sendData.linkedToId = userstoryfromidea.linkedtoId; sendData.projectId = userstoryfromidea.projectId; sendData.tasks = new USTask[0] { }; sendData.assignedTo = new AssignedTo[0] { }; sendData.startTime = DateTime.Now; sendData.endTime = DateTime.Now; //sendData.progress = userstoryfromidea.progress; var userstoryCreated = userService.Create(sendData); //var kanbanUS = userService.GetByProjectId(userstoryfromidea.projectId); var listobj = listService.GetByProjectIdAndPB(sendData.projectId); if (listobj == null) { Console.WriteLine("Inside list obj == null"); List objr = new List() { name = "Product Backlog", projectId = sendData.projectId, index = 0, UserStory = new UserStory[1] { new UserStory() { UserStoryId = userstoryCreated.Id, UserStoryName = sendData.shortName } } }; listService.Create(objr); } else { Console.WriteLine("obj not null so updating list"); //List<UserStory> obj=listobj.UserStory.ToList(); UserStory abc = new UserStory() { UserStoryId = userstoryCreated.Id, UserStoryName = sendData.shortName }; //listobj.UserStory=listobj.UserStory.Concat(abc).ToArray(); // Array.Resize(ref listobj.UserStory, listobj.UserStory.Length + 1); // listobj.UserStory[listobj.UserStory.Length - 1] = abc; List <UserStory> uslist = new List <UserStory>(); for (int i = 0; i < listobj.UserStory.Length; i++) { uslist.Add(listobj.UserStory[i]); } uslist.Add(abc); listobj.UserStory = uslist.ToArray(); // listobj.UserStory=listobj.UserStory.ToList().Add(new UserStory(){UserStoryId=userstoryCreated.Id, // UserStoryName=sendData.shortName}).ToArray();/// listService.Update(listobj.Id, listobj); } //userService.SendRabbit(userstoryfromidea.projectId); //var kmm=RabbitMQReceiver.b.SendUserStoryToAddOnList(userstoryfromidea.projectId,"aadasdasd"); } else if (userstoryfromidea.action == "delete") { Console.WriteLine("inside delete now"); var getuserstory = userService.GetByUniqueId(userstoryfromidea.linkedtoId); userService.RemoveByUniqueId(userstoryfromidea.linkedtoId); var allLists = listService.GetProjectById(userstoryfromidea.projectId); var linkedToCards = userService.GetByLinkedId(userstoryfromidea.linkedtoId); // Console.WriteLine(linkedToCards+"linked"); foreach (var i in linkedToCards) { userService.Remove(i.Id); Console.WriteLine(i.shortName); foreach (var j in allLists) { List <UserStory> linklist = new List <UserStory>(); foreach (var k in j.UserStory) { if (k.UserStoryId != i.Id) { linklist.Add(k); } } j.UserStory = linklist.ToArray(); listService.Update(j.Id, j); } } string listidwherefound = allLists[0].Id; foreach (var i in allLists) { foreach (var j in i.UserStory) { if (j.UserStoryId == getuserstory.Id) { listidwherefound = i.Id; Console.WriteLine("list id {0}", listidwherefound); } } } var listobj = listService.Get(listidwherefound); //var listobj=listwhereidfound.UserStory; List <UserStory> uslist = new List <UserStory>(); for (int i = 0; i < listobj.UserStory.Length; i++) { if (listobj.UserStory[i].UserStoryId == getuserstory.Id) { } else { uslist.Add(listobj.UserStory[i]); } } //uslist.Add(abc); listobj.UserStory = uslist.ToArray(); listService.Update(listobj.Id, listobj); } //else if (taskfromgantt.action == "delete") //{ // var kanbanUS = userService.GetByUniqueId(taskfromgantt.unique_id); // if (kanbanUS == null) // { // } // else // { // userService.Remove(kanbanUS.Id); // } //} }; _channel.BasicConsume(queue: IdeaZoneQueueName, autoAck: true, consumer: consumer ); Console.WriteLine(" Press [enter] to exit."); // Console.ReadLine(); } }
public IEnumerable <List> Get() { return(_listService.Get()); }
public ListController(ListService listService) { _listService = listService; _Lists = listService.Get(); }
public static void Show() { //{//String类型 // using (StringService service = new StringService()) // { // service.Set("test_String1", "123"); // service.Set<int>("test_Int1", 1); // service.Set<bool>("test_String1", true); // service.Set("test_String2", "456", new TimeSpan(0, 0, 0, 5)); // }; //} //{//Hash类型 // using (HashService service = new HashService()) // { // service.FlushAll(); // service.SetEntryInHash("student", "id", "123456"); // service.SetEntryInHash("student", "name", "张xx"); // service.SetEntryInHash("student", "remark", "高级班的学员"); // var keys = service.GetHashKeys("student"); // var values = service.GetHashValues("student"); // var keyValues = service.GetAllEntriesFromHash("student"); // Console.WriteLine(service.GetValueFromHash("student", "id")); // service.SetEntryInHashIfNotExists("student", "name", "太子爷"); // service.SetEntryInHashIfNotExists("student", "description", "高级班的学员2"); // Console.WriteLine(service.GetValueFromHash("student", "name")); // Console.WriteLine(service.GetValueFromHash("student", "description")); // service.RemoveEntryFromHash("student", "description"); // Console.WriteLine(service.GetValueFromHash("student", "description")); // } //} //{//Set // using (SetService service = new SetService()) // { // service.Add("Set1", "1"); // service.Add("Set1", "2"); // service.Add("Set1", "3"); // service.Add("Set1", "4"); // service.Add("Set2", "2"); // service.Add("Set2", "3"); // service.Add("Set2", "4"); // service.Add("Set2", "45"); // } //} //{//ZSet // using (ZSetService service = new ZSetService()) // { // service.Add("Set1", "1"); // service.Add("Set1", "2"); // service.Add("Set1", "3"); // service.Add("Set1", "4"); // service.Add("Set2", "2"); // service.Add("Set2", "3"); // service.Add("Set2", "4"); // service.Add("Set2", "45"); // List<string> sList1=service.GetAllDesc("Set1"); // List<string> sList2 = service.GetAllDesc("Set2"); // } //} {//List(从控制台写入数据,BackService开启线程执行并发处理) using (ListService service = new ListService()) { Action act = new Action(() => { while (true) { Console.WriteLine("请输入:r:读取,w:写入,c:清空"); string testTask = Console.ReadLine(); if (testTask == "r") { Console.WriteLine("请输入Key(-1退出):"); string key = Console.ReadLine(); if (key == "-1") { break; } service.Get(key).ForEach(s => { Console.WriteLine("data:" + s); }); } else if (testTask == "w") { Console.WriteLine("请输入Key(-1退出):"); string key = Console.ReadLine(); while (true && key != "-1") { Console.WriteLine("请输入Value(-1退出):"); string value = Console.ReadLine(); if (value == "-1") { break; } service.LPush(key, value); } } else if (testTask == "c") { Console.WriteLine("请输入Key(-1退出/-all全部清空):"); string key = Console.ReadLine(); if (key == "-1") { break; } else if (key == "-all") { service.FlushAll(); } else { service.RemoveAllByKey(key); } } else { Console.WriteLine("请重新输入"); } } }); //通过EndInvoke方法检测异步调用的结果。如果异步调用尚未完成,EndInvoke将阻塞调用线程,直到它完成 act.EndInvoke(act.BeginInvoke(null, null)); } } }