Exemplo n.º 1
0
 internal bool Enabled(ProjectColumn column)
 {
     if (Ignore?.Any(i => i == column.Name) == true)
     {
         return(false);
     }
     return(Select is null || (Select.Length == 1 && Select[0] == "*") || Select.Any(i => i == column.Name));
 }
Exemplo n.º 2
0
        static void WriteColumn(ProjectColumn column)
        {
            writer.WriteLine(columnIndent + column.Name + writer.NewLine);
            writer.WriteLine(writer.NewLine + "---" + writer.NewLine);

            Parallel.ForEach(cardsClient.GetAll(column.Id).Result, card => {
                WriteCard(card);
            });

            writer.WriteLine();
        }
Exemplo n.º 3
0
        private async void OnProjectCard(ProjectCardEvent.RootObject obj)
        {
            //https://developer.github.com/v3/activity/events/types/#projectcardevent
            if (obj == null)
            {
                return;
            }

            ProjectColumn column = await _githubClient.Repository.Project.Column.Get(obj.project_card.column_id);

            Issue issue = null;

            string contentUrl = obj.project_card.content_url;

            if (!string.IsNullOrEmpty(contentUrl))
            {
                int    pos   = contentUrl.LastIndexOf("/") + 1;
                string strId = contentUrl.Substring(pos, contentUrl.Length - pos);

                if (int.TryParse(strId, out int id))
                {
                    issue = await _githubClient.Issue.Get(obj.repository.id, id);
                }
            }

            switch (obj.action)
            {
            case "created":
                SendEventMessage(DiscordMessageFormatter.GetOnProjectCardCreatedMessage(obj, column, issue));
                break;

            case "edited":
                SendEventMessage(DiscordMessageFormatter.GetOnProjectCardEditedMessage(obj));
                break;

            case "converted":
                SendEventMessage(DiscordMessageFormatter.GetOnProjectCardConvertedMessage(obj));
                break;

            case "moved":
                SendEventMessage(DiscordMessageFormatter.GetOnProjectCardMovedMessage(obj, column, issue));
                break;

            case "deleted":
                SendEventMessage(DiscordMessageFormatter.GetOnProjectCardDeletedMessage(obj, issue));
                break;
            }
        }
Exemplo n.º 4
0
        private ResourceItem CreateResourceItem(IXLRow row)
        {
            var project = row.Cell(ProjectColumn.ColumnNumber()).GetString();
            var file    = row.Cell(FileColumn.ColumnNumber()).GetString();
            var name    = row.Cell(NameColumn.ColumnNumber()).GetString();

            var resource = new ResourceItem
            {
                Key = new ResourceKey {
                    Project = project, File = file, Name = name
                },
                Values = new Dictionary <string, string>(StringComparer.InvariantCultureIgnoreCase)
            };

            return(resource);
        }
Exemplo n.º 5
0
 public ProjectEventArgs(ProjectColumn column)
 {
     this.column = column;
 }
Exemplo n.º 6
0
 public ProjectEventArgs(ProjectColumn column, object value)
 {
     this.column = column;
     this.value  = value;
 }
Exemplo n.º 7
0
        public IHttpActionResult PostTable(Table tables)
        {
            try
            {
                var existingTable  = checkTableName(tables.name);
                var checkTableType = checkMainTable(tables.tableType, tables.tableType);
                if (!existingTable)
                {
                    string message = "Table already existed";
                    return(BadRequest(message));
                }
                else if (!checkTableType)
                {
                    string message = "One main table for project";
                    return(BadRequest(message));
                }
                else
                {
                    string connectionString = @"Data Source=NIBLP535;Initial Catalog=GetixAdminDb;Integrated Security=True";
                    using (SqlConnection con = new SqlConnection(connectionString))
                    {
                        con.Open();
                        var  commandStr = "CREATE TABLE " + tables.name + "(" + " PRJ_TASK_ID" + " int identity(1,1) not null, ";
                        bool isFirstCol = true;
                        foreach (var item in tables.columns)
                        {
                            if (!isFirstCol)
                            {
                                commandStr += ",";
                            }
                            commandStr += "[" + item.columnName + "]" + item.dataType;
                            isFirstCol  = false;
                        }
                        commandStr += ", constraint " + "[PK_" + tables.name + "]" + " primary key clustered(PRJ_TASK_ID) " + ")";
                        using (SqlCommand command = new SqlCommand(commandStr, con))
                            command.ExecuteNonQuery();

                        con.Close();
                    }

                    ProjectTable projectTable = new ProjectTable();
                    projectTable.ProjectTableName = tables.name;
                    projectTable.ProjectID        = tables.projectId;
                    projectTable.TableType        = tables.tableType;
                    projectTable.RowInsertBy      = "shivappa";
                    projectTable.RowInsertDate    = Convert.ToDateTime(DateTime.Now.ToString("hh:mm:ss tt", System.Globalization.DateTimeFormatInfo.InvariantInfo));

                    db.ProjectTables.Add(projectTable);
                    db.SaveChanges();

                    foreach (var column in tables.columns)
                    {
                        ProjectColumn projectColumn = new ProjectColumn();
                        projectColumn.CoulmnName     = column.columnName;
                        projectColumn.Datatype       = column.dataType;
                        projectColumn.IsDisplay      = column.isDisplay;
                        projectColumn.ProjectId      = tables.projectId;
                        projectColumn.ProjectTableID = projectTable.ProjectTableID;
                        projectColumn.RowInsertDate  = Convert.ToDateTime(DateTime.Now.ToString("hh:mm:ss tt", System.Globalization.DateTimeFormatInfo.InvariantInfo));
                        db.ProjectColumns.Add(projectColumn);
                    }
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }

            return(Ok());
        }
Exemplo n.º 8
0
 public CardWrapper(ProjectColumn column, ProjectCard card)
 {
     Column = column;
     Card   = card;
     _uri   = new Uri(card.ContentUrl);
 }
Exemplo n.º 9
0
        public static EmbedBuilder GetOnProjectCardMovedMessage(ProjectCardEvent.RootObject obj, ProjectColumn column, Issue issue)
        {
            var builder = new EmbedBuilder()
            {
                Color       = Const.DISCORD_EMBED_COLOR,
                Description = $"{obj.sender.login} moved a project card for {obj.repository.full_name}"
            };

            builder.AddField(x =>
            {
                x.Name     = "Moved to";
                x.Value    = column.Name;
                x.IsInline = false;
            });

            if (issue == null)
            {
                builder.AddField(x =>
                {
                    x.Name     = "Card note";
                    x.Value    = !string.IsNullOrEmpty(obj.project_card.note) ? obj.project_card.note : "Not available";
                    x.IsInline = false;
                });
            }
            else
            {
                builder.AddField(x =>
                {
                    x.Name     = "Issue title";
                    x.Value    = issue.Title;
                    x.IsInline = false;
                });

                builder.AddField(x =>
                {
                    x.Name     = "Url";
                    x.Value    = issue.HtmlUrl;
                    x.IsInline = false;
                });
            }

            builder.AddField(x =>
            {
                x.Name     = "Creation date";
                x.Value    = obj.project_card.created_at.ToString("MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture);
                x.IsInline = false;
            });

            return(builder);
        }
Exemplo n.º 10
0
        public static EmbedBuilder GetOnProjectCardCreatedMessage(ProjectCardEvent.RootObject obj, ProjectColumn column, Issue issue)
        {
            var builder = new EmbedBuilder()
            {
                Color       = Const.DISCORD_EMBED_COLOR,
                Description = $"{obj.sender.login} created a new project card for {obj.repository.full_name} in column {column.Name}"
            };

            if (issue == null)
            {
                builder.AddField(x =>
                {
                    x.Name     = "Card note";
                    x.Value    = !string.IsNullOrEmpty(obj.project_card.note) ? obj.project_card.note : "Not available";
                    x.IsInline = false;
                });
            }
            else
            {
                builder.AddField(x =>
                {
                    x.Name     = "Issue title";
                    x.Value    = issue.Title;
                    x.IsInline = false;
                });

                builder.AddField(x =>
                {
                    x.Name     = "Url";
                    x.Value    = issue.HtmlUrl;
                    x.IsInline = false;
                });
            }

            return(builder);
        }
Exemplo n.º 11
0
 public ProjectComparer(ProjectColumn column)
 {
     this.whichComparison = column;
 }