Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            acao = "Feriado";
            frmCadEvento frm = new frmCadEvento(data, codLog, acao);

            frm.ShowDialog();
            this.Close();
        }
Example #2
0
        void btnDayzClick(object sender, EventArgs e)
        {
            Button currentbutton = (Button)sender;

            if (currentbutton.Text.Length == 1 && comboBox1.Text.Length == 1)
            {
                dtEv = "0" + currentbutton.Text + "/" + "0" + comboBox1.Text + "/" + textBox1.Text;
            }
            else if (currentbutton.Text.Length == 1 && comboBox1.Text.Length > 1)
            {
                dtEv = "0" + currentbutton.Text + "/" + comboBox1.Text + "/" + textBox1.Text;
            }
            else if (currentbutton.Text.Length > 1 && comboBox1.Text.Length == 1)
            {
                dtEv = currentbutton.Text + "/" + "0" + comboBox1.Text + "/" + textBox1.Text;
            }
            else if (currentbutton.Text.Length > 1 && comboBox1.Text.Length > 1)
            {
                dtEv = currentbutton.Text + "/" + comboBox1.Text + "/" + textBox1.Text;
            }

            string   inicial = co.BuscaDataServidor();
            string   aux     = dtEv;
            DateTime final   = DateTime.ParseExact(aux.ToString(), "dd/MM/yyyy", CultureInfo.CurrentCulture);
            TimeSpan dif     = final - Convert.ToDateTime(inicial);
            int      dias    = dif.Days;

            if (dias < 0)
            {
                string      msg = "Você só poderá cadastrar um evento a partir da data de hoje!!";
                frmMensagem mg  = new frmMensagem(msg);
                mg.ShowDialog();
            }
            else
            {
                if (currentbutton.BackColor == Color.Red)
                {
                    aviso = dtEv + " É FERIADO NACIONAL, DESEJA CONTINUAR?";
                    frmDecisao dec = new frmDecisao(aviso, dtEv, codUs);
                    dec.ShowDialog();
                }
                else if (currentbutton.BackColor == Color.Blue)
                {
                    aviso = dtEv + " É FERIADO ESTADUAL, DESEJA CONTINUAR?";
                    frmDecisao dec = new frmDecisao(aviso, dtEv, codUs);
                    dec.ShowDialog();
                }
                else if (currentbutton.BackColor == Color.Magenta)
                {
                    aviso = dtEv + " É FERIADO MUNICIPAL, DESEJA CONTINUAR?";
                    frmDecisao dec = new frmDecisao(aviso, dtEv, codUs);
                    dec.ShowDialog();
                }
                else if (currentbutton.BackColor == Color.Yellow)
                {
                    aviso = dtEv + " PROVAVELMENTE SERÁ FACULTATIVO, DESEJA CONTINUAR?";
                    frmDecisao dec = new frmDecisao(aviso, dtEv, codUs);
                    dec.ShowDialog();
                }
                else
                {
                    frmCadEvento frm = new frmCadEvento(dtEv, codUs, "");
                    frm.Owner = this;
                    frm.ShowDialog();
                }
            }
        }