Esempio n. 1
0
        public async Task Issue30_PartialSearch_True()
        {
            TrelloAuthorization.Default.AppKey = TrelloIds.AppKey;

            var board      = _factory.Board(TrelloIds.BoardId);
            var searchText = "car";
            var search     = _factory.Search(_factory.SearchQuery().Text(searchText), modelTypes: SearchModelType.Cards, context: new[] { board }, isPartial: true);

            await search.Refresh();

            // search will include archived cards as well as matches in card descriptions.
            Assert.AreEqual(6, search.Cards.Count());

            await TrelloProcessor.Flush();
        }
Esempio n. 2
0
        static async System.Threading.Tasks.Task Main(string[] args)
        {
            //Авторизация, для которой нужен ключ разработчика https://trello.com/app-key
            TrelloAuthorization.Default.AppKey    = "16a605bc7686b56000bac3a0c88ad11c";
            TrelloAuthorization.Default.UserToken = "09d5a1bef5a2aeb437e783d2e3a5066eea293750d98ab64a03a1c7cf335ccf27";

            //Создание доски и подключение к нужно нам
            ITrelloFactory factory = new TrelloFactory();
            var            board   = factory.Board("hYFRk7rz");
            await board.Refresh();                        //Обязательно, после загрузки данных

            var list = board.Lists.FirstOrDefault();      //Подключение к спискам (колонкам в Trello)
            await list.Refresh();

            var card = list.Cards.FirstOrDefault();       //Подключение к карточкам
            await card.Refresh();

            /*//Выводит название списков
             * foreach (var listq in board.Lists)
             * {
             *  Console.WriteLine(listq);
             *  await list.Refresh();
             *   Console.WriteLine(" ");
             *       //Выводит название карточек первого списка*/
            foreach (var cardq in list.Cards)
            {
                Console.WriteLine("[" + cardq.Id + "]");
                Console.WriteLine("[" + cardq.Name + "]");
                Console.WriteLine("[" + cardq.Description + "]");
                Console.WriteLine("[" + cardq.CreationDate + "]");
            }

            Console.WriteLine(" ");
        }
Esempio n. 3
0
        public async Task <IBoard> _GetTrelloBoardAsync(string boardID)
        {
            var _tempBoard = _factory.Board(boardID, _auth);
            await _tempBoard.Lists.Refresh();

            return(_tempBoard);
        }
Esempio n. 4
0
        public async Task TestMethod1()
        {
            await Run(async ct =>
            {
                Board.DownloadedFields |= Board.Fields.Cards;
                var board = _factory.Board(TrelloIds.BoardId);
                await board.Refresh(ct: ct);

                Console.WriteLine(board.Cards["Card"].CustomFields[0].Definition.Name);
            });
        }
Esempio n. 5
0
        public async Task loadTrelloAsync()
        {
            if (authDone)
            {
                TrelloFactory factory = new TrelloFactory();
                var           board   = factory.Board(boardId, authData);
                await board.Refresh();

                btnBrdName.Text = board.Name;
                var lists = board.Lists;
                for (int i = 0; i < lists.Count(); i++)
                {
                    TabPage page = new TabPage();
                    page.Text = lists[i].Name;
                    page.Tag  = i.ToString();
                    tcLists.TabPages.Add(page);
                    await lists[i].Refresh();

                    rowCol c = new rowCol();
                    c.nameOfList = lists[i].Name;
                    c.row        = 0;
                    c.col        = 0;
                    coord.Add(c);

                    var cards = lists[i].Cards;
                    if (cards.Count() > 0)
                    {
                        for (int j = 0; j < cards.Count(); j++)
                        {
                            Button task = new Button();
                            task.Text        = cards[j].Name;
                            task.MinimumSize = new Size(360, 80);
                            if (80 * coord[i].row + 3 < tcLists.Size.Height - 80)
                            {
                                task.Location = new Point(360 * coord[i].col + 3, 80 * coord[i].row + 3);
                                coord[i].row++;
                            }
                            else
                            {
                                coord[i].col++;
                                coord[i].row  = 0;
                                task.Location = new Point(360 * coord[i].col + 3, 80 * coord[i].row + 3);
                            }
                            task.AutoEllipsis = true;
                            tcLists.TabPages[i].Controls.Add(task);
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("Вы не авторизовались. Для повторной попытки повторите запуск приложения!");
            }
        }
Esempio n. 6
0
        protected async void deleteList()
        {
            TrelloFactory factory = new TrelloFactory();
            var           board   = factory.Board(boardId, authData);
            await board.Refresh();

            var list = board.Lists.FirstOrDefault(l => l.Name == tcLists.SelectedTab.Text);
            await list.Refresh();

            list.IsArchived = true;
            tcLists.TabPages.Remove(tcLists.SelectedTab);
        }
Esempio n. 7
0
        protected async void editListName()
        {
            editList edit = new editList();

            if (edit.ShowDialog() == DialogResult.OK)
            {
                TrelloFactory factory = new TrelloFactory();
                var           board   = factory.Board(boardId, authData);
                await board.Refresh();

                var list = board.Lists.FirstOrDefault(l => l.Name == tcLists.SelectedTab.Text);
                list.Name = edit.name;
                tcLists.SelectedTab.Text = edit.name;
            }
        }
Esempio n. 8
0
        protected async void createList()
        {
            crList create = new crList();

            if (create.ShowDialog() == DialogResult.OK)
            {
                TrelloFactory factory = new TrelloFactory();
                var           board   = factory.Board(boardId, authData);
                await board.Refresh();

                var newList = await board.Lists.Add(create.name);

                TabPage page = new TabPage();
                page.Text = create.name;
                tcLists.TabPages.Add(page);
            }
        }
Esempio n. 9
0
        private async Task DoIt(CancellationToken ct)
        {
            var board = _factory.Board(TrelloIds.BoardId);
            await board.Refresh(true, ct);

            Console.WriteLine(board);

            var list1 = board.Lists[0];
            var list2 = board.Lists[1];
            var list3 = board.Lists[2];

            await Task.WhenAll(list1.Refresh(true, ct),
                               list2.Refresh(true, ct),
                               list3.Refresh(true, ct));

            Console.WriteLine(list1);
            Console.WriteLine(list2);
            Console.WriteLine(list3);

            var allCards = list1.Cards.Concat(list2.Cards).Concat(list3.Cards).ToList();

            Console.WriteLine(allCards.Count);
        }
        private static async Task <object> GetDataAsync()
        {
            TrelloAuthorization.Default.AppKey    = "660a224291cd8cd592b315947a05c402";
            TrelloAuthorization.Default.UserToken = "5688f1600c6e7f3e30113e478363fb3d1b3f3c1a6cb1e1ce1bab31b5e24b6adf";

            var          factory           = new TrelloFactory();
            const string weeklyEatsBoardId = "GgB8CiSU";
            var          board             = factory.Board(weeklyEatsBoardId);
            await board.Lists.Refresh();

            var recipeIngredients = new List <object>();
            var thisWeekListCards = board.Lists
                                    .Where(list => list.Name.StartsWith("This Week"))
                                    .SelectMany(list => list.Cards)
                                    .ToList();

            foreach (var card in thisWeekListCards)
            {
                await card.Comments.Refresh();

                var ingredientComment = card.Comments.SingleOrDefault(comment => comment.Data.Text.StartsWith("Ingredients"));
                if (ingredientComment != null)
                {
                    var ingredientsString = ingredientComment.Data.Text.Substring("Ingredients\n".Length);
                    var ingredients       = ingredientsString.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);

                    recipeIngredients.Add(
                        new
                    {
                        RecipeName  = card.Name,
                        Ingredients = ingredients,
                    });
                }
            }
            return(recipeIngredients);
        }
Esempio n. 11
0
        static async System.Threading.Tasks.Task Main(string[] args)
        {
            string    SQLPRoofDate;
            ArrayList JobDetails = new ArrayList();
            bool      done       = false;



            try
            {
                do
                {
                    Console.WriteLine("Enter Pace Job Number");
                    string jn = Console.ReadLine();
                    int    i  = 0;
                    JobDetails.Clear();


                    var connString = "Host=6.1.1.13;Username=epace_read;Password=epace;Database=epace"; // ** Connection Details ** //

                    //var conn1 = @"Data Source=AG00072\SQLEXPRESS; Database=TrelloJobs; Connection Timeout=30;Integrated Security=SSPI;";

                    using (var conn = new NpgsqlConnection(connString))
                    {
                        conn.Open();

                        // ** Connection string ** //
                        using (var cmd = new NpgsqlCommand("SELECT job.ccmasterid, job.amounttoinvoice, Customer.arcustname, job.ccdescription, job.ccscheduledshipdate, jobpart.ccact2date FROM job INNER Join customer ON job.armasterid = customer.armasterid INNER Join jobpart ON job.ccmasterid = jobpart.ccmasterid WHERE  job.ccmasterid =" + jn, conn))

                            using (NpgsqlDataReader reader = cmd.ExecuteReader())



                                while (JobDetails.Count < 5)
                                {
                                    while (reader.Read()) //Loop through SQL reader //
                                    {
                                        switch (JobDetails.Count)
                                        {
                                        case 0:

                                            JobDetails.Add(reader[0]);
                                            JobDetails.Add(reader[1]);
                                            JobDetails.Add(reader[2]);
                                            JobDetails.Add(reader[3]);
                                            JobDetails.Add(reader[4]);
                                            break;

                                        case 5:
                                            JobDetails.Clear();
                                            JobDetails.Insert(0, reader[0]);
                                            JobDetails.Insert(1, reader[1]);
                                            JobDetails.Insert(2, reader[2]);
                                            JobDetails.Insert(3, reader[3]);
                                            JobDetails.Insert(4, reader[4]);

                                            break;
                                        }

                                        if (reader.GetValue(5).ToString() != "")
                                        {
                                            JobDetails.Add(reader[5]); // Proof Date //
                                        }
                                    }
                                }
                    }

                    //using (var conn2 = new SqlConnection(conn1))
                    // {
                    // conn2.Open();



                    if (JobDetails.Count == 5)
                    {
                        SQLPRoofDate = "N/A";
                    }
                    else
                    {
                        SQLPRoofDate = JobDetails[5].ToString();
                    }

                    //  using (var cmdd = new SqlCommand("INSERT INTO Jobs VALUES ('" + JobDetails[0] + "','" + JobDetails[2] + "','" + JobDetails[3] + "','" + SQLPRoofDate + "','To Start','" + JobDetails[4] + "')", conn2))
                    // using (SqlDataReader r1 = cmdd.ExecuteReader()) ;



                    TrelloAuthorization.Default.AppKey    = "234d8eb40d3f3133b0812df057f7bdc3";                                 // Trello API key //
                    TrelloAuthorization.Default.UserToken = "0e956ba7f0000d7ca7db8504e58a3301d45102e400297f230bfbdda2acc30e1e"; // Trello UserToken //


                    ITrelloFactory factory = new TrelloFactory();    // Get Trello board using board ID//
                    var            board   = factory.Board("5db19603e4428377d77963b1");
                    await board.Refresh();

                    var TDList = factory.List("5db19603e4428377d77963b2");
                    await TDList.Refresh();

                    var newCard = TDList.Cards.Add(JobDetails[0].ToString().Trim() + " - " + JobDetails[2].ToString().Trim());

                    var Card = factory.Card(newCard.Result.Id);
                    Card.DueDate = (DateTime)JobDetails[4];


                    var desc  = board.CustomFields.FirstOrDefault(f => f.Name == ":.");
                    var field = desc.SetValueForCard(Card, JobDetails[3].ToString());



                    if (JobDetails.Count == 6)
                    {
                        var ProofDate = board.CustomFields.FirstOrDefault(f => f.Name == "Proof Date");
                        var field1    = ProofDate.SetValueForCard(Card, (DateTime)JobDetails[5]);
                    }

                    await Card.Refresh();

                    await Card.Labels.Refresh();

                    Console.WriteLine("Type N to input another Job Number or X to Exit");
                    var e = Console.ReadLine();

                    if (e == "X")
                    {
                        done = true;
                    }
                } while (done != true);
            }



            catch (IndexOutOfRangeException e)
            {
                Console.WriteLine(e);
            }
        }
Esempio n. 12
0
        async void items_ItemAddAsync(object Item)
        {
            bool   test      = false;
            var    cardid    = "";
            var    LID       = "";
            string jnum      = "";
            int    i         = 0;
            var    cardindex = "";

            try
            {
                Outlook.MailItem mail = (Outlook.MailItem)Item;

                TrelloAuthorization.Default.AppKey    = "234d8eb40d3f3133b0812df057f7bdc3";                                 // Trello API key //
                TrelloAuthorization.Default.UserToken = "0e956ba7f0000d7ca7db8504e58a3301d45102e400297f230bfbdda2acc30e1e"; // Trello UserToken //


                ITrelloFactory factory = new TrelloFactory();    // Get Trello board using board ID//
                var            board   = factory.Board("5db19603e4428377d77963b1");
                await board.Refresh();

                var TDList = factory.List("5db19603e4428377d77963b2");
                //var TList = factory.List("");
                await TDList.Refresh();

                var Start = mail.Subject.IndexOf("t").ToString();
                jnum = mail.Subject.Substring(int.Parse(Start) + 1, 7);

                string[] ListID = new string[3];

                //
                ListID[0] = "5db19603e4428377d77963b2"; //To Start Board ID
                ListID[1] = "5db19603e4428377d77963b3"; // On Proof Board ID
                ListID[2] = "5db19603e4428377d77963b4"; // Signed Off Board ID

                //board = TDList.Contains("255705");

                // find Card



                string query  = jnum;
                var    search = factory.Search(query, 1, SearchModelType.Cards, new IQueryable[] { board });
                await search.Refresh();

                var CardList = search.Cards.ToList();

                foreach (var card in CardList)
                {
                    string tName = card.Name.Substring(0, 6);

                    if (tName == jnum.Trim())
                    {
                        cardid = card.Id;
                    }
                }

                var    FoundCard   = factory.Card(cardid);
                string FoundListid = FoundCard.List.Id;
                var    fromlist    = factory.List(FoundListid);
                Person p1          = new Person();
                p1.Name = "Shaun";


                //var FoundList = board.Lists.FirstOrDefault(l => l.Name == "Swim Lane");



                if (Item != null)
                {
                    if (mail.Body.ToUpper().Contains("Approved for Print".ToUpper()))

                    {
                        //var ToList = factory.List("5db19603e4428377d77963b4");
                        var ToList = board.Lists.FirstOrDefault(l => l.Name == "Signed Off");
                        FoundCard.List = ToList;
                        // from on proof


                        //MessageBox.Show("Approved for Print");
                    }
                    else if (mail.Body.ToUpper().Contains("Awaiting Review".ToUpper()))

                    {
                        //var ToList = factory.List("5db19603e4428377d77963b3");
                        var ToList = board.Lists.FirstOrDefault(l => l.Name == "On Proof");

                        FoundCard.List = ToList;

                        // from in progress or to start

                        // MessageBox.Show("Awaiting Review");
                    }
                    else if (mail.Body.ToUpper().Contains("Amends".ToUpper()))
                    {
                        var ToList = factory.List("5dc9442eb245e60a39b3d4a7");
                        FoundCard.List = ToList;

                        // from on proof
                        //MessageBox.Show("Amends");
                    }
                    else
                    {
                        // non job mail
                    }
                }
            }
            catch (Exception e)
            {
                //MessageBox.Show(e.Message);
            }
        }