Beispiel #1
0
        private void btnDeletePriority_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Você têm certeza, que deseja deletar esta prioridade", "Deletar Prioridade",
                                MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
            {
                try {
                    int id = Convert.ToInt32(((PictureBox)sender).Tag);

                    PriorityVO item = _priorityBLL.GetById(id);
                    _priorityBLL.Delete(item);
                    MessageBox.Show("Prioridade deletada com sucesso.");

                    loadPriorities();
                } catch (Exception) {
                    MessageBox.Show("Não é possível deletar uma prioridade que já está sendo utilizada.");
                }
            }
        }
Beispiel #2
0
        public NewPriority(object[] args)
        {
            this.Font          = new System.Drawing.Font(Font.Name, 8.25f * 96f / CreateGraphics().DpiX, Font.Style, Font.Unit, Font.GdiCharSet, Font.GdiVerticalFont);
            this.AutoScaleMode = AutoScaleMode.None;
            InitializeComponent();

            cbbLevel.Items.AddRange(new ComboboxItem[] {
                new ComboboxItem {
                    Value = 1, Text = "1 - Sem Prioridade"
                },
                new ComboboxItem {
                    Value = 2, Text = "2 - Prioridade Baixa"
                },
                new ComboboxItem {
                    Value = 3, Text = "3 - Prioridade Média"
                },
                new ComboboxItem {
                    Value = 4, Text = "4 - Prioridade Alta"
                },
                new ComboboxItem {
                    Value = 5, Text = "5 - Prioridade Altissima"
                },
                new ComboboxItem {
                    Value = 6, Text = "6 - Prioridade Máxima"
                }
            });

            priority = new PriorityVO();
            if (args != null && args.Length == 1)
            {
                priority = _priorityBLL.GetById((int)args[0]);
                UpdatePriority();
            }
            else
            {
                btnReset.Visible = false;
            }
        }
Beispiel #3
0
        private Panel CreatePriorityPanel(PriorityVO priority, int nSize)
        {
            Panel newPanel = new Panel {
                AutoScroll  = true,
                BorderStyle = BorderStyle.FixedSingle,
                Location    = new Point(6, 45 + (186 * nSize)),
                Size        = new Size(1060, 145) // 177
            };

            Label title = new Label {
                AutoSize = true,
                Font     = new Font("Microsoft Sans Serif", 14F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0))),
                Location = new Point(15, 12),
                Size     = new Size(165, 29),
                Text     = priority.Name
            };

            Label level = new Label {
                AutoSize = true,
                Font     = new Font("Microsoft Sans Serif", 7.8F, FontStyle.Italic, GraphicsUnit.Point, ((byte)(0))),
                Location = new Point(17, 40),
                Size     = new Size(239, 17),
                Text     = "Nível de Prioridade: " + priority.PriorityLevel
            };

            Label description = new Label {
                Location = new Point(17, 70),
                Size     = new Size(977, 82),
                Text     = priority.Description
            };

            PictureBox delete = new PictureBox {
                Anchor   = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Right))),
                Cursor   = Cursors.Hand,
                Image    = global::Tasklist.Properties.Resources.closeButton,
                Location = new Point(1013, 3),
                Size     = new Size(40, 40),
                TabStop  = false,
                Tag      = priority.PriorityID
            };

            delete.Click += new EventHandler(btnDeletePriority_Click);

            PictureBox edit = new PictureBox {
                Anchor   = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Right))),
                Cursor   = Cursors.Hand,
                Image    = global::Tasklist.Properties.Resources.editButton,
                Location = new Point(1013, 49),
                Size     = new Size(40, 40),
                TabStop  = false,
                Tag      = priority.PriorityID
            };

            edit.Click += new EventHandler(btnEditPriority_Click);

            newPanel.Controls.Add(title);
            newPanel.Controls.Add(level);
            newPanel.Controls.Add(description);
            newPanel.Controls.Add(delete);
            newPanel.Controls.Add(edit);

            /*Resize Description*/
            Size sz = new Size(description.Width, Int32.MaxValue);

            sz = TextRenderer.MeasureText(description.Text, description.Font, sz, TextFormatFlags.WordBreak);
            description.Height = sz.Height;

            return(newPanel);
        }