Exemplo n.º 1
0
        /// <summary>
        /// 显示修改窗口
        /// </summary>
        public void ShowEditWindow()
        {
            List <GridRow> rows       = m_gridDgvTable.SelectedRows;
            Jira           jira       = rows[0].Tag as Jira;
            EditWindow     editWindow = new EditWindow(Native);

            editWindow.MainFrame = this;
            editWindow.Create(jira);
            editWindow.ShowDialog();//只允许对当前窗口操作
        }
Exemplo n.º 2
0
        public static void SaveJira(Jira jira)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(@"<?xml version='1.0' encoding='gb2312' ?>");
            sb.Append("\r\n");
            sb.Append(jira.GetXml());
            Binary bi = new Binary();

            bi.WriteBytes(System.Text.Encoding.Default.GetBytes(sb.ToString()));
            byte[] sendData = bi.GetBytes();
            HttpPostService.Post(DataCenter.ServerAddr + "giraservice?func=savegira&gid=" + jira.JiraID, sendData, true);
            m_dataDic[jira.JiraID] = sb.ToString();
        }
Exemplo n.º 3
0
        public static List <Jira> GetJiras()
        {
            InitServer();
            int         infoLength = m_dataDic.Count;
            List <Jira> jiras      = new List <Jira>(infoLength);

            foreach (String jid in m_dataDic.Keys)
            {
                Jira jira = GetJira(jid);
                if (jira != null)
                {
                    jiras.Add(jira);
                }
            }
            return(jiras);
        }
Exemplo n.º 4
0
 public static void InsertJiraToDataRow(DataRow dr, Jira jira)
 {
     try
     {
         dr[0]  = jira.JiraID;
         dr[1]  = jira.Title;
         dr[2]  = jira.HttpPath;
         dr[3]  = jira.Creater;
         dr[4]  = jira.Developer;
         dr[5]  = jira.DeveloperReceive ? "是" : "否";
         dr[6]  = jira.DeveloperPass ? "是" : "否";
         dr[7]  = jira.TestPass ? "是" : "否";
         dr[8]  = jira.ProductPass ? "是" : "否";
         dr[9]  = jira.WaitPublish ? "是" : "否";
         dr[10] = jira.Published ? "是" : "否";
         dr[11] = jira.CloseTask ? "是" : "否";
         dr[12] = jira.Hurry;
         dr[13] = jira.Description;
         dr[14] = jira.Branches;
         dr[15] = jira.StartDate;
         dr[16] = jira.EndDate;
         dr[17] = jira;
         dr[18] = jira.RelativeGroup;
         for (int x = 0; x < XmlHandle.Groups.Count; x++)
         {
             if (XmlHandle.Groups[x].Id == jira.GroupID)
             {
                 dr[19] = XmlHandle.Groups[x].Name;
                 dr[20] = XmlHandle.Groups[x].Manager;
                 List <JCategory> categories = XmlHandle.Groups[x].Categories;
                 for (int j = 0; j < categories.Count; j++)
                 {
                     if (categories[j].Id == jira.CategoryID)
                     {
                         dr[21] = categories[j].Name;
                         break;
                     }
                 }
                 break;
             }
         }
     }
     catch (Exception ex)
     {
         ErrorException.OnError(ex);
     }
 }
Exemplo n.º 5
0
 public static Jira GetJira(string jiraID)
 {
     try
     {
         XmlDocument xmlDoc = new XmlDocument();
         xmlDoc.LoadXml(m_dataDic[jiraID]);
         XmlNode rootNode = xmlDoc.DocumentElement;
         Jira    jira     = new Jira();
         jira.ReadXml(rootNode);
         return(jira);
     }
     catch (Exception ex)
     {
         ErrorException.OnError(ex);
     }
     return(null);
 }
Exemplo n.º 6
0
        /// <summary>
        /// 回调方法,筛选表格
        /// </summary>
        /// <param name="expressions"></param>
        public void ExpressionChange(List <Expression> expressions)
        {
            int            count     = expressions.Count;
            List <GridRow> rows      = m_gridDgvTable.GetRows();
            int            rowsCount = rows.Count;

            for (int j = 0; j < rowsCount; j++)
            {
                bool flag = true;
                for (int i = 0; i < count; i++)
                {
                    Expression expression        = expressions[i];
                    int        expressionID      = expression.Id;
                    String     expressionContent = expression.Content;
                    Jira       jira = rows[j].Tag as Jira;
                    if (expression.Name == "ID")
                    {
                        if (expression.Content != jira.JiraID)
                        {
                            flag = false;
                            break;
                        }
                    }
                    else if (expression.Name == "Title")
                    {
                        if (!expression.Content.Contains(jira.Title))
                        {
                            flag = false;
                            break;
                        }
                    }
                    else if (expression.Name == "Developer")
                    {
                        if (!expression.Content.Contains(jira.Developer))
                        {
                            flag = false;
                            break;
                        }
                    }
                    else if (expression.Name == "DevelopePass")
                    {
                        if (expression.Content != rows[j].GetCell("colT8").Text)
                        {
                            flag = false;
                            break;
                        }
                    }
                    else if (expression.Name == "TestPass")
                    {
                        if (expression.Content != rows[j].GetCell("colT10").Text)
                        {
                            flag = false;
                            break;
                        }
                    }
                    else if (expression.Name == "WaitPublish")
                    {
                        if (expression.Content != rows[j].GetCell("colT12").Text)
                        {
                            flag = false;
                            break;
                        }
                    }
                    else if (expression.Name == "Publish")
                    {
                        if (expression.Content != rows[j].GetCell("colT13").Text)
                        {
                            flag = false;
                            break;
                        }
                    }
                    else if (expression.Name == "CloseTask")
                    {
                        if (expression.Content != rows[j].GetCell("colT14").Text)
                        {
                            flag = false;
                            break;
                        }
                    }
                    else if (expression.Name == "ProductPass")
                    {
                        if (expression.Content != rows[j].GetCell("colT11").Text)
                        {
                            flag = false;
                            break;
                        }
                    }
                    else if (expression.Name == "StartDate")
                    {
                        long     expressionDate = Convert.ToDateTime(expression.Content).ToFileTime();
                        DateTime colt6          = (DateTime)(rows[j].GetCell("colT16").Tag);
                        long     cellDate       = colt6.ToFileTime();
                        if (expression.Str == "=")
                        {
                            if (expressionDate == cellDate)
                            {
                                flag = false;
                                break;
                            }
                        }
                        if (expression.Str == ">=")
                        {
                            if (expressionDate >= cellDate)
                            {
                                flag = false;
                                break;
                            }
                        }
                        if (expression.Str == "<=")
                        {
                            if (expressionDate <= cellDate)
                            {
                                flag = false;
                                break;
                            }
                        }
                        if (expression.Str == ">")
                        {
                            if (expressionDate > cellDate)
                            {
                                flag = true;
                                break;
                            }
                        }
                        if (expression.Str == "<")
                        {
                            if (expressionDate < cellDate)
                            {
                                flag = true;
                                break;
                            }
                        }
                        if (expression.Str == "<>")
                        {
                            if (expressionDate != cellDate)
                            {
                                flag = true;
                                break;
                            }
                        }
                    }
                    else if (expression.Name == "EndDate")
                    {
                        long     expressionDate = Convert.ToDateTime(expression.Content).ToFileTime();
                        DateTime colt7          = (DateTime)(rows[j].GetCell("colT17").Tag);
                        long     cellDate       = colt7.ToFileTime();
                        if (expression.Str == "=")
                        {
                            if (expressionDate == cellDate)
                            {
                                flag = false;
                                break;
                            }
                        }
                        if (expression.Str == ">=")
                        {
                            if (expressionDate >= cellDate)
                            {
                                flag = true;
                                break;
                            }
                        }
                        if (expression.Str == "<=")
                        {
                            if (expressionDate <= cellDate)
                            {
                                flag = false;
                                break;
                            }
                        }
                        if (expression.Str == ">")
                        {
                            if (expressionDate > cellDate)
                            {
                                flag = true;
                                break;
                            }
                        }
                        if (expression.Str == "<")
                        {
                            if (expressionDate < cellDate)
                            {
                                flag = false;
                                break;
                            }
                        }
                        if (expression.Str == "<>")
                        {
                            if (expressionDate != cellDate)
                            {
                                flag = false;
                                break;
                            }
                        }
                    }
                }
                if (flag)
                {
                    rows[j].Visible = true;//设置隐藏
                }
                else
                {
                    rows[j].Visible = false;
                }
            }
            m_gridDgvTable.Update();
            m_gridDgvTable.Invalidate();
        }
Exemplo n.º 7
0
        /// <summary>
        /// 依据ID判断更新或者插入
        /// </summary>
        /// <param name="jira">Jira对象</param>
        public void AddOrUpdate(Jira jira)
        {
            //设置样式
            GridCellStyle gridStyle = new GridCellStyle();

            gridStyle.BackColor = COLOR.DISABLEDCONTROL;

            List <GridRow> rows = m_gridDgvTable.m_rows;
            int            size = rows.Count;

            //没有数据
            if (size <= 0)
            {
                Addrows(jira);
                return;
            }
            bool isAddRow = true;

            for (int i = 0; i < size; i++)
            {
                //GridCellStyle gridStyle = new GridCellStyle();
                //gridStyle.BackColor = COLOR.DISABLEDCONTR;
                GridRow       row        = rows[i];
                String        id         = row.GetCell("colT1").Text;
                GridCellStyle gridStyle1 = new GridCellStyle();
                gridStyle1.BackColor       = COLOR.DISABLEDCONTROL;
                gridStyle1.ForeColor       = COLOR.ARGB(255, 97, 0);
                row.GetCell("colT1").Style = gridStyle1;

                //根据ID来决定是插入还是更新
                if (id == jira.JiraID)
                {
                    isAddRow = false;
                    GridCellStyle gridStyle2 = new GridCellStyle();
                    gridStyle2.BackColor       = COLOR.DISABLEDCONTROL;
                    gridStyle2.ForeColor       = COLOR.ARGB(0, 255, 0);
                    row.GetCell("colT2").Style = gridStyle2;
                    row.GetCell("colT2").Text  = jira.Title;
                    row.GetCell("colT3").Text  = jira.Creater;
                    row.GetCell("colT4").Text  = jira.Developer;
                    int count = XmlHandle.Groups.Count;
                    for (int m = 0; m < count; m++)
                    {
                        if (XmlHandle.Groups[m].Id == jira.GroupID)
                        {
                            GridCell cell5 = new GridCellExp(XmlHandle.Groups[m].Name);
                            row.AddCell("colT5", cell5);
                            GridCell cell6 = new GridCellExp(XmlHandle.Groups[m].Manager);
                            row.AddCell("colT6", cell6);
                            List <JCategory> categories = XmlHandle.Groups[m].Categories;
                            int cateCount = categories.Count;
                            for (int n = 0; n < cateCount; n++)
                            {
                                if (categories[n].Id == jira.CategoryID)
                                {
                                    GridCell cell7 = new GridCellExp(categories[n].Name);
                                    row.AddCell("colT7", cell7);
                                    break;
                                }
                            }
                            break;
                        }
                    }
                    row.GetCell("colT8").Text  = jira.DeveloperReceive ? "是" : "否";
                    row.GetCell("colT9").Text  = jira.DeveloperPass ? "是" : "否";
                    row.GetCell("colT10").Text = jira.TestPass ? "是" : "否";
                    row.GetCell("colT11").Text = jira.ProductPass ? "是" : "否";
                    row.GetCell("colT12").Text = jira.WaitPublish ? "是" : "否";
                    row.GetCell("colT13").Text = jira.Published ? "是" : "否";
                    row.GetCell("colT14").Text = jira.CloseTask ? "是" : "否";
                    row.GetCell("colT15").Text = jira.Hurry;
                    DateTime dt     = DateTime.Now;
                    String   status = jira.EndDate.ToFileTime() > dt.ToFileTime() ? "(超时)" : "(正常)";
                    GridCell cell16 = new GridCellExp(status + jira.StartDate.ToLongDateString().ToString());
                    row.GetCell("colT16").Text = cell16.Text;
                    GridCell cell17 = new GridCellExp(status + jira.StartDate.ToLongDateString().ToString());
                    row.GetCell("colT17").Text = cell17.Text;
                    m_gridDgvTable.Update();
                    return;
                }
            }

            //新增
            if (isAddRow)
            {
                Addrows(jira);
                return;
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// 插入行数据
        /// </summary>
        /// <param name="jira">Jira对象</param>
        public void Addrows(Jira jira)
        {
            m_gridDgvTable.BeginUpdate();
            //设置样式
            GridCellStyle gridStyle = new GridCellStyle();

            gridStyle.BackColor = COLOR.DISABLEDCONTROL;
            GridRow row = new GridRow();

            m_gridDgvTable.AddRow(row);
            //设置边框线的颜色
            m_gridDgvTable.GridLineColor = COLOR.EMPTY;
            m_gridDgvTable.HeaderHeight  = 35;
            m_gridDgvTable.BackColor     = COLOR.ARGB(31, 29, 40);
            row.Tag = jira;
            //设置行高
            row.Height = 35;
            GridCell cell1 = new GridCellExp(jira.JiraID);

            row.AddCell("colT1", cell1);
            GridCellStyle gridStyle1 = new GridCellStyle();

            gridStyle1.BackColor = COLOR.DISABLEDCONTROL;
            gridStyle1.ForeColor = COLOR.ARGB(255, 255, 255);
            cell1.Style          = gridStyle1;
            GridCell cell2 = new GridCellExp(jira.Title);

            row.AddCell("colT2", cell2);
            GridCellStyle gridStyle2 = new GridCellStyle();

            gridStyle2.BackColor = COLOR.DISABLEDCONTROL;
            gridStyle2.ForeColor = COLOR.ARGB(45, 142, 45);
            cell2.Style          = gridStyle2;
            GridCell cell3 = new GridCellExp(jira.Creater);

            row.AddCell("colT3", cell3);
            GridCell cell4 = new GridCellExp(jira.Developer);

            row.AddCell("colT4", cell4);
            GridCellStyle gridStyle3 = new GridCellStyle();

            gridStyle3.BackColor = COLOR.DISABLEDCONTROL;
            gridStyle3.ForeColor = COLOR.ARGB(47, 145, 145);
            cell3.Style          = gridStyle3;
            cell4.Style          = gridStyle3;
            int count = XmlHandle.Groups.Count;

            for (int j = 0; j < count; j++)
            {
                JGroup group = XmlHandle.Groups[j];
                if (group.Id == jira.GroupID)
                {
                    GridCell cell5 = new GridCellExp(group.Name);
                    row.AddCell("colT5", cell5);
                    GridCellStyle gridStyle5 = new GridCellStyle();
                    gridStyle5.BackColor = COLOR.DISABLEDCONTROL;
                    gridStyle5.ForeColor = COLOR.ARGB(47, 145, 145);
                    cell5.Style          = gridStyle5;
                    GridCell cell6 = new GridCellExp(group.Manager);
                    row.AddCell("colT6", cell6);
                    GridCellStyle gridStyle6 = new GridCellStyle();
                    gridStyle6.BackColor = COLOR.DISABLEDCONTROL;
                    gridStyle6.ForeColor = COLOR.ARGB(255, 153, 153);
                    cell6.Style          = gridStyle6;
                    List <JCategory> categories = group.Categories;
                    int categoriesCount         = categories.Count;
                    for (int n = 0; n < categoriesCount; n++)
                    {
                        if (categories[n].Id == jira.CategoryID)
                        {
                            GridCell cell7 = new GridCellExp(categories[n].Name);
                            row.AddCell("colT7", cell7);
                            GridCellStyle gridStyle7 = new GridCellStyle();
                            gridStyle7.BackColor = COLOR.DISABLEDCONTROL;
                            gridStyle7.ForeColor = COLOR.ARGB(45, 142, 45);
                            cell7.Style          = gridStyle7;
                            break;
                        }
                    }
                    break;
                }
            }
            String        str        = jira.DeveloperReceive ? "是" : "否";
            GridCell      cell8      = new GridCellExp(str);
            GridCellStyle gridStyle8 = new GridCellStyle();

            gridStyle8.ForeColor = COLOR.ARGB(255, 255, 255);
            if (str == "是")
            {
                gridStyle8.BackColor = COLOR.ARGB(93, 146, 202);
            }
            else
            {
                gridStyle8.BackColor = COLOR.ARGB(163, 5, 50);
            }
            cell8.Style = gridStyle8;
            row.AddCell("colT8", cell8);
            String        str1       = jira.DeveloperPass ? "是" : "否";
            GridCell      cell9      = new GridCellExp(str1);
            GridCellStyle gridStyle9 = new GridCellStyle();

            gridStyle9.ForeColor = COLOR.ARGB(255, 255, 255);
            if (str1 == "是")
            {
                gridStyle9.BackColor = COLOR.ARGB(93, 146, 202);
            }
            else
            {
                gridStyle9.BackColor = COLOR.ARGB(163, 5, 50);
            }
            cell9.Style = gridStyle9;
            row.AddCell("colT9", cell9);
            String        str2        = jira.TestPass ? "是" : "否";
            GridCell      cell10      = new GridCellExp(str2);
            GridCellStyle gridStyle10 = new GridCellStyle();

            gridStyle10.ForeColor = COLOR.ARGB(255, 255, 255);
            if (str2 == "是")
            {
                gridStyle10.BackColor = COLOR.ARGB(93, 146, 202);
            }
            else
            {
                gridStyle10.BackColor = COLOR.ARGB(163, 5, 50);
            }
            cell10.Style = gridStyle10;
            row.AddCell("colT10", cell10);
            String        str3        = jira.ProductPass ? "是" : "否";
            GridCell      cell11      = new GridCellExp(str3);
            GridCellStyle gridStyle11 = new GridCellStyle();

            gridStyle11.ForeColor = COLOR.ARGB(255, 255, 255);
            if (str3 == "是")
            {
                gridStyle11.BackColor = COLOR.ARGB(93, 146, 202);
            }
            else
            {
                gridStyle11.BackColor = COLOR.ARGB(163, 5, 50);
            }
            cell11.Style = gridStyle11;
            row.AddCell("colT11", cell11);
            String        str4        = jira.WaitPublish ? "是" : "否";
            GridCell      cell12      = new GridCellExp(str4);
            GridCellStyle gridStyle12 = new GridCellStyle();

            gridStyle12.ForeColor = COLOR.ARGB(255, 255, 255);
            if (str4 == "是")
            {
                gridStyle12.BackColor = COLOR.ARGB(93, 146, 202);
            }
            else
            {
                gridStyle12.BackColor = COLOR.ARGB(163, 5, 50);
            }
            cell12.Style = gridStyle12;
            row.AddCell("colT12", cell12);
            String        str5        = jira.Published ? "是" : "否";
            GridCell      cell13      = new GridCellExp(str5);
            GridCellStyle gridStyle13 = new GridCellStyle();

            gridStyle13.ForeColor = COLOR.ARGB(255, 255, 255);
            if (str5 == "是")
            {
                gridStyle13.BackColor = COLOR.ARGB(93, 146, 202);
            }
            else
            {
                gridStyle13.BackColor = COLOR.ARGB(163, 5, 50);
            }
            cell13.Style = gridStyle13;
            row.AddCell("colT13", cell13);

            String        str6        = jira.CloseTask ? "是" : "否";
            GridCell      cell14      = new GridCellExp(str6);
            GridCellStyle gridStyle14 = new GridCellStyle();

            gridStyle14.ForeColor = COLOR.ARGB(255, 255, 255);
            if (str6 == "是")
            {
                gridStyle14.BackColor = COLOR.ARGB(93, 146, 202);
            }
            else
            {
                gridStyle14.BackColor = COLOR.ARGB(163, 5, 50);
            }
            cell14.Style = gridStyle14;
            row.AddCell("colT14", cell14);

            GridCell      cell15      = new GridCellExp(jira.Hurry);
            GridCellStyle gridStyle15 = new GridCellStyle();

            gridStyle15.BackColor = COLOR.ARGB(0, 0, 0);
            if (jira.Hurry == "紧急")
            {
                gridStyle15.ForeColor = COLOR.ARGB(255, 0, 0);
            }
            else
            {
                gridStyle15.ForeColor = COLOR.ARGB(255, 255, 0);
            }
            cell15.Style = gridStyle15;
            row.AddCell("colT15", cell15);
            GridCellStyle gridStyle16 = new GridCellStyle();

            gridStyle16.BackColor = COLOR.DISABLEDCONTROL;
            gridStyle16.ForeColor = COLOR.ARGB(255, 255, 0);
            DateTime dt1     = DateTime.Now;
            String   status  = jira.EndDate.ToFileTime() > dt1.ToFileTime() ? "(超时)" : "(正常)";
            GridCell cells16 = new GridCellExp(status + jira.StartDate.ToLongDateString().ToString());

            row.AddCell("colT16", cells16);
            cells16.Tag = jira.StartDate;
            GridCell cells17 = new GridCellExp(status + jira.StartDate.ToLongDateString().ToString());

            row.AddCell("colT17", cells17);
            cells16.Style = gridStyle16;
            cells17.Style = gridStyle16;
            cells17.Tag   = jira.EndDate;
            m_gridDgvTable.EndUpdate();
        }
Exemplo n.º 9
0
        /// <summary>
        /// 刷新数据
        /// </summary>
        public void Renovate()
        {
            //从服务端拿取数据
            m_jiras = XmlHandle.GetJiras();
            int count = m_jiras.Count;
            //创建Dictionary存放ID和数据
            Dictionary <String, Jira> jiraIDs = new Dictionary <String, Jira>();

            //遍历服务器的数据
            for (int i = 0; i < count; i++)
            {
                Jira jira = m_jiras[i];
                jiraIDs.Add(jira.JiraID, jira);
            }
            //获取表格所有行
            List <GridRow> rows      = m_gridDgvTable.GetRows();
            int            rowsCount = rows.Count;
            Dictionary <String, GridRow> gridRows = new Dictionary <String, GridRow>();

            //遍历表格的数据
            for (int i = 0; i < rowsCount; i++)
            {
                GridRow row = rows[i];
                //取ID
                String id = row.GetCell("colT1").Text;
                //依据ID判断
                if (!jiraIDs.ContainsKey(id))
                {
                    //ID不匹配删除行
                    m_gridDgvTable.RemoveRow(row);
                    rowsCount--;
                    i--;
                }
                else
                {
                    //匹配则加到Dictionary
                    gridRows.Add(id, row);
                }
            }
            m_gridDgvTable.Update();
            m_gridDgvTable.BeginUpdate();
            for (int i = 0; i < count; i++)
            {
                //遍历服务器数据
                Jira    jira    = m_jiras[i];
                bool    newData = false;
                String  key     = jira.JiraID;
                GridRow row;
                if (gridRows.ContainsKey(key))
                {
                    row = gridRows[key];
                }
                else
                {
                    newData = true;
                    row     = new GridRow();
                    //row.Grid = m_gridDgvTable;
                    //m_gridDgvTable.m_rows.Add(row);
                    //row.OnAdd();
                    m_gridDgvTable.AddRow(row);
                }

                //遍历columns
                List <GridColumn> columns = m_gridDgvTable.GetColumns();
                int countColumn           = columns.Count;
                for (int j = 0; j < countColumn; j++)
                {
                    GridColumn column = columns[j];
                    GridCell   cell;
                    if (newData)
                    {
                        cell = new GridCellExp();
                        row.AddCell(column.Index, cell);
                        cell.Column = column;
                    }
                    else
                    {
                        cell = row.GetCell(column.Index);
                    }
                    DateTime dt         = DateTime.Now;
                    String   status     = jira.EndDate.ToFileTime() > dt.ToFileTime() ? "(超时)" : "(正常)";
                    int      countGroup = XmlHandle.Groups.Count;
                    switch (j)
                    {
                    case 0:
                        GridCellStyle gridStyle1 = new GridCellStyle();
                        gridStyle1.BackColor = COLOR.DISABLEDCONTROL;
                        gridStyle1.ForeColor = COLOR.ARGB(255, 255, 255);
                        cell.Text            = jira.JiraID;
                        cell.Style           = gridStyle1;
                        //colT1
                        break;

                    case 1:
                        GridCellStyle gridStyle2 = new GridCellStyle();
                        gridStyle2.BackColor = COLOR.DISABLEDCONTROL;
                        gridStyle2.ForeColor = COLOR.ARGB(45, 142, 45);
                        cell.Text            = jira.Title;
                        cell.Style           = gridStyle2;
                        break;

                    case 2:
                        GridCellStyle gridStyle3 = new GridCellStyle();
                        gridStyle3.BackColor = COLOR.DISABLEDCONTROL;
                        gridStyle3.ForeColor = COLOR.ARGB(47, 145, 145);
                        cell.Text            = jira.Creater;
                        cell.Style           = gridStyle3;
                        break;

                    case 3:
                        GridCellStyle gridStyle4 = new GridCellStyle();
                        gridStyle4.BackColor = COLOR.DISABLEDCONTROL;
                        gridStyle4.ForeColor = COLOR.ARGB(47, 145, 145);;
                        cell.Style           = gridStyle4;
                        cell.Text            = jira.Developer;
                        break;

                    case 4:
                    {
                        for (int m = 0; m < countGroup; m++)
                        {
                            if (XmlHandle.Groups[m].Id == jira.GroupID)
                            {
                                GridCellStyle gridStyle5 = new GridCellStyle();
                                gridStyle5.BackColor = COLOR.DISABLEDCONTROL;
                                gridStyle5.ForeColor = COLOR.ARGB(47, 145, 145);
                                cell.Style           = gridStyle5;
                                cell.Text            = XmlHandle.Groups[m].Name;
                                break;
                            }
                        }
                        break;
                    }

                    case 5:
                    {
                        for (int m = 0; m < countGroup; m++)
                        {
                            if (XmlHandle.Groups[m].Id == jira.GroupID)
                            {
                                GridCellStyle gridStyle6 = new GridCellStyle();
                                gridStyle6.BackColor = COLOR.DISABLEDCONTROL;
                                gridStyle6.ForeColor = COLOR.ARGB(255, 153, 153);
                                cell.Style           = gridStyle6;
                                cell.Text            = XmlHandle.Groups[m].Manager;
                                break;
                            }
                        }
                        break;
                    }

                    case 6:
                    {
                        for (int m = 0; m < countGroup; m++)
                        {
                            if (XmlHandle.Groups[m].Id == jira.GroupID)
                            {
                                List <JCategory> categories = XmlHandle.Groups[m].Categories;
                                int cateCount = categories.Count;
                                for (int n = 0; n < cateCount; n++)
                                {
                                    if (categories[n].Id == jira.CategoryID)
                                    {
                                        GridCellStyle gridStyle7 = new GridCellStyle();
                                        gridStyle7.BackColor = COLOR.DISABLEDCONTROL;
                                        gridStyle7.ForeColor = COLOR.ARGB(45, 142, 45);
                                        cell.Style           = gridStyle7;
                                        cell.Text            = categories[n].Name;
                                        break;
                                    }
                                }
                                break;
                            }
                        }
                        break;
                    }

                    case 7:
                        cell.Text = jira.DeveloperReceive ? "是" : "否";
                        GridCellStyle gridStyle8 = new GridCellStyle();
                        gridStyle8.ForeColor = COLOR.ARGB(255, 255, 255);
                        if (cell.Text == "是")
                        {
                            gridStyle8.BackColor = COLOR.ARGB(93, 146, 202);
                        }
                        else
                        {
                            gridStyle8.BackColor = COLOR.ARGB(163, 5, 50);
                        }
                        cell.Style = gridStyle8;
                        break;

                    case 8:
                        cell.Text = jira.DeveloperPass ? "是" : "否";
                        GridCellStyle gridStyle9 = new GridCellStyle();
                        gridStyle9.ForeColor = COLOR.ARGB(255, 255, 255);
                        if (cell.Text == "是")
                        {
                            gridStyle9.BackColor = COLOR.ARGB(93, 146, 202);
                        }
                        else
                        {
                            gridStyle9.BackColor = COLOR.ARGB(163, 5, 50);
                        }
                        cell.Style = gridStyle9;
                        break;

                    case 9:
                        cell.Text = jira.TestPass ? "是" : "否";
                        GridCellStyle gridStyle10 = new GridCellStyle();
                        gridStyle10.ForeColor = COLOR.ARGB(255, 255, 255);
                        if (cell.Text == "是")
                        {
                            gridStyle10.BackColor = COLOR.ARGB(93, 146, 202);
                        }
                        else
                        {
                            gridStyle10.BackColor = COLOR.ARGB(163, 5, 50);
                        }
                        cell.Style = gridStyle10;
                        break;

                    case 10:
                        cell.Text = jira.ProductPass ? "是" : "否";
                        GridCellStyle gridStyle11 = new GridCellStyle();
                        gridStyle11.ForeColor = COLOR.ARGB(255, 255, 255);
                        if (cell.Text == "是")
                        {
                            gridStyle11.BackColor = COLOR.ARGB(93, 146, 202);
                        }
                        else
                        {
                            gridStyle11.BackColor = COLOR.ARGB(163, 5, 50);
                        }
                        cell.Style = gridStyle11;
                        break;

                    case 11:
                        cell.Text = jira.WaitPublish ? "是" : "否";
                        GridCellStyle gridStyle12 = new GridCellStyle();
                        gridStyle12.ForeColor = COLOR.ARGB(255, 255, 255);
                        if (cell.Text == "是")
                        {
                            gridStyle12.BackColor = COLOR.ARGB(93, 146, 202);
                        }
                        else
                        {
                            gridStyle12.BackColor = COLOR.ARGB(163, 5, 50);
                        }
                        cell.Style = gridStyle12;
                        break;

                    case 12:
                        cell.Text = jira.Published ? "是" : "否";
                        GridCellStyle gridStyle13 = new GridCellStyle();
                        gridStyle13.ForeColor = COLOR.ARGB(255, 255, 255);
                        if (cell.Text == "是")
                        {
                            gridStyle13.BackColor = COLOR.ARGB(93, 146, 202);
                        }
                        else
                        {
                            gridStyle13.BackColor = COLOR.ARGB(163, 5, 50);
                        }
                        cell.Style = gridStyle13;
                        break;

                    case 13:
                        cell.Text = jira.CloseTask ? "是" : "否";
                        GridCellStyle gridStyle14 = new GridCellStyle();
                        gridStyle14.ForeColor = COLOR.ARGB(255, 255, 255);
                        if (cell.Text == "是")
                        {
                            gridStyle14.BackColor = COLOR.ARGB(93, 146, 202);
                        }
                        else
                        {
                            gridStyle14.BackColor = COLOR.ARGB(163, 5, 50);
                        }
                        cell.Style = gridStyle14;
                        break;

                    case 14:
                        cell.Text = jira.Hurry;
                        GridCellStyle gridStyle15 = new GridCellStyle();
                        gridStyle15.BackColor = COLOR.ARGB(0, 0, 0);
                        if (cell.Text == "紧急")
                        {
                            gridStyle15.ForeColor = COLOR.ARGB(163, 5, 50);
                        }
                        else
                        {
                            gridStyle15.ForeColor = COLOR.ARGB(227, 171, 26);
                        }
                        cell.Style = gridStyle15;
                        break;

                    case 15:
                        GridCellStyle gridStyle16 = new GridCellStyle();
                        GridCell      cell16      = new GridCellExp(status + jira.StartDate.ToLongDateString().ToString());
                        cell.Text             = cell16.Text;
                        gridStyle16.ForeColor = COLOR.ARGB(255, 255, 0);
                        cell.Style            = gridStyle16;
                        break;

                    case 16:
                        GridCellStyle gridStyle17 = new GridCellStyle();
                        GridCell      cell17      = new GridCellExp(status + jira.StartDate.ToLongDateString().ToString());
                        cell.Text             = cell17.Text;
                        gridStyle17.ForeColor = COLOR.ARGB(255, 255, 0);
                        cell.Style            = gridStyle17;
                        break;
                    }
                }
            }

            m_gridDgvTable.EndUpdate();
            m_gridDgvTable.Invalidate();
        }
Exemplo n.º 10
0
        /// <summary>
        /// 创建Jira
        /// </summary>
        /// <param name="date">日期</param>
        /// <param name="jira">Jira</param>
        /// <param name="jiras">Jira列表</param>
        public void Create(Jira jira)
        {
            //初始化分组
            int count = XmlHandle.Groups.Count;

            for (int i = 0; i < count; i++)
            {
                MenuItemA item = new MenuItemA();
                item.Text = XmlHandle.Groups[i].Name;
                item.Tag  = XmlHandle.Groups[i];
                this.m_cmbGroup.AddItem(item);
            }
            if (jira != null)
            {
                //初始化界面信息
                this.m_chbCloseTask.Checked        = jira.CloseTask;
                this.m_chbDeveloperPass.Checked    = jira.DeveloperPass;
                this.m_chbDeveloperReceive.Checked = jira.DeveloperReceive;
                this.m_cmbHurry.Text          = jira.Hurry;
                this.m_chbProductPass.Checked = jira.ProductPass;
                this.m_chbPublished.Checked   = jira.Published;
                this.m_chbTestPass.Checked    = jira.TestPass;
                this.m_chbWaitPublish.Checked = jira.WaitPublish;
                this.m_jira                  = jira;
                this.m_txtBranches.Text      = jira.Branches;
                this.m_rtbDescription.Text   = jira.Description;
                this.m_txtCreater.Text       = jira.Creater;
                this.m_txtDeveloper.Text     = jira.Developer;
                this.m_txtHttpPath.Text      = jira.HttpPath;
                this.m_txtJiraID.Text        = jira.JiraID;
                this.m_txtRelativeGroup.Text = jira.RelativeGroup;
                this.m_txtTitle.Text         = jira.Title;
                //日期格式化
                try
                {
                    this.m_dtpStart.Text = jira.StartDate.ToString("D");
                }
                catch (Exception ex)
                {
                    ErrorException.OnError(ex);
                }
                try
                {
                    this.m_dtpEnd.Text = jira.EndDate.ToString("D");
                }
                catch (Exception ex)
                {
                    ErrorException.OnError(ex);
                }
                //int groupCount = XmlHandle.Groups.Count;
                //选中下拉列表
                for (int i = 0; i < count; i++)
                {
                    if (XmlHandle.Groups[i].Id == jira.GroupID)
                    {
                        this.m_cmbGroup.SelectedIndex = i;
                        List <JCategory> categories = XmlHandle.Groups[i].Categories;
                        int categoriesCount         = categories.Count;
                        for (int j = 0; j < categoriesCount; j++)
                        {
                            if (categories[j].Id == jira.CategoryID)
                            {
                                this.m_cmbCategory.SelectedIndex = j;
                            }
                        }
                        break;
                    }
                }
            }
            else
            {
                m_isAdd = true;
                //创建Jira对象
                this.m_jira            = new Jira();
                this.m_jira.CreateDate = DateTime.Now;
                //默认显示当前日期
                m_dtpEnd.Text   = DateTime.Now.ToString("D");
                m_dtpStart.Text = DateTime.Now.ToString("D");
                try
                {
                    //根据缓存选中下拉列表
                    string cachePath = Path.Combine(XmlHandle.UserDir, "SetCache.txt");
                    string groupID   = File.Exists(cachePath) ? File.ReadAllText(cachePath, Encoding.UTF8) : "";
                    if (groupID != null && groupID.Length > 0)
                    {
                        //int count = XmlHandle.Groups.Count;
                        for (int i = 0; i < count; i++)
                        {
                            if (XmlHandle.Groups[i].Id == groupID)
                            {
                                this.m_cmbGroup.SelectedIndex = i;
                                return;
                            }
                        }
                    }
                    else
                    {
                        //默认选中
                        this.m_cmbGroup.SelectedIndex = 0;
                    }
                }
                catch (Exception ex)
                {
                    ErrorException.OnError(ex);
                }
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// 添加数据
 /// </summary>
 private void AddData()
 {
     if (m_txtJiraID.Text == null || m_txtJiraID.Text.Length == 0)
     {
         MessageBox.Show("ID不能为空,请填写ID!");
         return;
     }
     if (m_txtCreater.Text == null || m_txtCreater.Text.Length == 0)
     {
         MessageBox.Show("发布人不能为空,请填写发布人!");
         return;
     }
     if (m_txtTitle.Text == null || m_txtTitle.Text.Length == 0)
     {
         MessageBox.Show("标题栏不能为空,请填写标题!");
         return;
     }
     //设置配置
     m_jira                  = new Jira();
     m_jira.Branches         = this.m_txtBranches.Text;
     m_jira.CloseTask        = this.m_chbCloseTask.Checked;
     m_jira.Creater          = this.m_txtCreater.Text;
     m_jira.Description      = this.m_rtbDescription.Text;
     m_jira.Developer        = this.m_txtDeveloper.Text;
     m_jira.DeveloperPass    = this.m_chbDeveloperPass.Checked;
     m_jira.DeveloperReceive = this.m_chbDeveloperReceive.Checked;
     m_jira.EndDate          = Convert.ToDateTime(this.m_dtpEnd.Text);
     m_jira.HttpPath         = this.m_txtHttpPath.Text;
     m_jira.Hurry            = this.m_cmbHurry.Text;
     m_jira.JiraID           = this.m_txtJiraID.Text;
     m_jira.ModifyDate       = DateTime.Now;
     m_jira.ProductPass      = this.m_chbProductPass.Checked;
     m_jira.Published        = this.m_chbPublished.Checked;
     m_jira.RelativeGroup    = this.m_txtRelativeGroup.Text;
     m_jira.StartDate        = Convert.ToDateTime(this.m_dtpStart.Text);//c#字符串转datatime
     m_jira.Title            = this.m_txtTitle.Text;
     m_jira.TestPass         = this.m_chbTestPass.Checked;
     m_jira.WaitPublish      = this.m_chbWaitPublish.Checked;
     //分组ID
     try
     {
         m_jira.GroupID = (m_cmbGroup.GetItems()[this.m_cmbGroup.SelectedIndex].Tag as JGroup).Id;
         string cachePath = Path.Combine(XmlHandle.UserDir, "SetCache.txt");
         File.WriteAllText(cachePath, m_jira.GroupID, Encoding.UTF8);
     }
     catch (Exception ex)
     {
         ErrorException.OnError(ex);
     }
     //分类ID
     try
     {
         m_jira.CategoryID = (m_cmbCategory.GetItems()[this.m_cmbCategory.SelectedIndex].Tag as JCategory).Id;
     }
     catch (Exception ex)
     {
         ErrorException.OnError(ex);
     }
     //检查添加
     if (m_isAdd)
     {
         Jira   checkJira = XmlHandle.GetJira(m_jira.JiraID);
         String isOk      = HttpGetService.Get(DataCenter.ServerAddr + "/giraservice?func=checkid&gid=" + m_jira.JiraID);
         if (isOk != null && isOk == "0")
         {
             m_isOverride = false;
         }
         else
         {
             if (DialogResult.OK != MessageBox.Show("ID已存在,自动更换为最新的ID,请重新提交!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
             {
                 String strJiraID = HttpGetService.Get(DataCenter.ServerAddr + "giraservice?func=availablenum");
                 int    maxJiraID = 0;
                 int.TryParse(strJiraID, out maxJiraID);
                 this.m_txtJiraID.Text = maxJiraID.ToString();
                 return;
             }
         }
     }
     m_mainFrame.AddOrUpdate(m_jira);
     Close();
 }