public override void Execute(object parameter)
        {
            var viewModelOS = (OSViewModel)parameter;
            var os          = new ModelConcertosEntity.OS();
            var c           = new ModelConcertosEntity.Cliente();

            var ow = new TelaAddOS();

            ow.DataContext = os;
            ow.ShowDialog();

            if (ow.DialogResult.HasValue && ow.DialogResult.Value)
            {
                OSController osController = new OSController();
                osController.InserirOs(os);
                if (os.PranchaId_Prancha == 0)
                {
                    TelaAddOS telaAddOS = new TelaAddOS();
                    telaAddOS.btnSalvarOS.DataContext = null;
                }
                if (os.ClienteId_Cliente == 0)
                {
                    TelaAddOS telaAddOS = new TelaAddOS();
                    telaAddOS.btnSalvarOS.DataContext = null;
                }

                viewModelOS.OSs = osController.GetOS();
            }
        }
Beispiel #2
0
        private void btn_Gerar_Click(object sender, EventArgs e)
        {
            OSController osc = new OSController();

            osc.MontaOS(Convert.ToInt32(cmbOS.SelectedValue));
            this.Close();
        }
Beispiel #3
0
        public override void Execute(object parameter)
        {
            var          viewModelOs  = parameter as OSViewModel;
            var          os           = new ModelConcertosEntity.OS();
            OSController osController = new OSController();

            osController.ExcluirOs(viewModelOs.OSSelecionada.Id_OS);
            viewModelOs.OSs = osController.GetOS();
        }
Beispiel #4
0
 public void UpdateUIOtherSettings()
 {
     OSController.SetInitialActionTime(initialActionTime);
     OSController.SetNextActionsTime(nextActionsTime);
     OSController.SetPopulationSize(populationSize);
     OSController.SetMutationRate(mutationRate);
     OSController.SetPieceLimit(pieceLimitTraining);
     OSController.SetInitialCalculationTime(initialCalculationTime);
     OSController.SetDecreasingCalculationFactor(decreasingCalculationTimeFactor);
 }
Beispiel #5
0
    public void StartGame()
    {
        TBController.playMode   = (PlayMode)modeDropdown.value;
        TBController.botVersion = (BotVersion)botDropdown.value;

        EnableBotSettings(false);
        EnableWeightFields(TBController.playMode == PlayMode.ShowOff);

        OSController.SendValuesToBoard();
        TBController.InitializeGame();

        playButton.interactable  = false;
        pauseButton.interactable = true;
        stopButton.interactable  = true;
    }
Beispiel #6
0
        public override void Execute(object parameter)
        {
            var viewModelOS = (OSViewModel)parameter;
            var cloneOS     = (ModelConcertosEntity.OS)viewModelOS.OSSelecionada.Clone();
            var cw          = new TelaAddOS();

            cw.DataContext = cloneOS;
            cw.ShowDialog();

            if (cw.DialogResult.HasValue && cw.DialogResult.Value)
            {
                TelaAddOS    telaAddOS    = new TelaAddOS();
                OSController osController = new OSController();

                viewModelOS.OSSelecionada.Descricao         = cloneOS.Descricao;
                viewModelOS.OSSelecionada.Valor             = cloneOS.Valor;
                viewModelOS.OSSelecionada.Data_Entrada      = cloneOS.Data_Entrada;
                viewModelOS.OSSelecionada.Data_Saida        = cloneOS.Data_Saida;
                viewModelOS.OSSelecionada.Status            = cloneOS.Status;
                viewModelOS.OSSelecionada.Situacao          = cloneOS.Situacao;
                viewModelOS.OSSelecionada.ClienteId_Cliente = cloneOS.ClienteId_Cliente;
                viewModelOS.OSSelecionada.PranchaId_Prancha = cloneOS.PranchaId_Prancha;
                osController.EditarOS(viewModelOS.OSSelecionada.Id_OS, viewModelOS.OSSelecionada);

                if (viewModelOS.OSSelecionada.PranchaId_Prancha == 0)
                {
                    telaAddOS.btnSalvarOS.DataContext = null;
                }
                if (viewModelOS.OSSelecionada.ClienteId_Cliente == 0)
                {
                    telaAddOS.btnSalvarOS.DataContext = null;
                }


                viewModelOS.OSs = osController.GetOS();
            }
        }
Beispiel #7
0
        public FrmInicial()
        {
            InitializeComponent();

            TimeSpan diff = DateTime.Now - DateTime.Now;
            int      conta = 0; int index = 0;
            var      item  = consulta_UltimoStatusTableAdapter.GetDataBy().ToList();
            int      aux   = 60;
            var      label = new Label();

            label.Text     = "Ordens de Serviços Atrasadas";
            label.Size     = new Size(196, 13);
            label.Location = new Point(0, 0);
            label.Font     = new Font(label.Font, FontStyle.Underline);
            pnlOS.Controls.Add(label);

            label          = new Label();
            label.Text     = "OS em Aberto";
            label.Size     = new Size(196, 13);
            label.Location = new Point(0, 22);
            pnlOS.Controls.Add(label);

            if (item.Count > 0)
            {
                for (index = 0; index < item.Count; index++)
                {
                    label              = new Label();
                    label.Text         = item.ElementAt(index).OSN;
                    label.Location     = new Point(23, aux);
                    label.DoubleClick += new EventHandler(redirect);
                    label.MouseUp     += new MouseEventHandler(nohover);
                    label.MouseDown   += new MouseEventHandler(nohover);
                    label.MouseMove   += new MouseEventHandler(hover);
                    label.ForeColor    = Color.DarkBlue;
                    aux += 22;
                    pnlOS.Controls.Add(label);
                }
            }
            else
            {
                label           = new Label();
                label.Text      = "Nenhuma OS pendente";
                label.Location  = new Point(30, aux);
                label.Size      = new Size(140, 13);
                label.ForeColor = Color.Red;
                pnlOS.Controls.Add(label);
                aux += 50;
            }

            label          = new Label();
            label.Text     = "OS com estimativa pendente";
            label.Size     = new Size(196, 13);
            label.Location = new Point(0, aux);
            aux           += 22;
            pnlOS.Controls.Add(label);
            OSController osc        = new OSController();
            var          estimativa = consulta_UltimoStatusTableAdapter.GetEstimativa().ToList();

            if (estimativa.Count() > 0)
            {
                foreach (var obj in estimativa)
                {
                    diff  = osc.GetDataAtt(obj.ID);
                    conta = osc.ContaOS(obj.ID);
                    if (conta > 0)
                    {
                        if (conta > 1)
                        {
                            if (!DateTime.Now.DayOfWeek.Equals("Friday"))
                            {
                                if (diff.Days > 2)
                                {
                                    label              = new Label();
                                    label.Text         = osc.getDados(obj.ID).OSN;
                                    label.Location     = new Point(23, aux);
                                    label.DoubleClick += new EventHandler(redirect);
                                    label.MouseUp     += new MouseEventHandler(nohover);
                                    label.MouseDown   += new MouseEventHandler(nohover);
                                    label.MouseMove   += new MouseEventHandler(hover);
                                    label.ForeColor    = Color.DarkBlue;
                                    aux += 22;
                                    pnlOS.Controls.Add(label);
                                }
                            }
                            else
                            {
                                if (diff.Days > 4)
                                {
                                    label              = new Label();
                                    label.Text         = osc.getDados(obj.ID).OSN;
                                    label.Location     = new Point(23, aux);
                                    label.DoubleClick += new EventHandler(redirect);
                                    label.MouseUp     += new MouseEventHandler(nohover);
                                    label.MouseDown   += new MouseEventHandler(nohover);
                                    label.MouseMove   += new MouseEventHandler(hover);
                                    label.ForeColor    = Color.DarkBlue;
                                    aux += 22;
                                    pnlOS.Controls.Add(label);
                                }
                            }
                        }
                        else
                        {
                            if (DateTime.Now.DayOfWeek.Equals("Monday") || DateTime.Now.DayOfWeek.Equals("Tuesday"))
                            {
                                if (diff.Days > 4)
                                {
                                    label              = new Label();
                                    label.Text         = osc.getDados(obj.ID).OSN;
                                    label.Location     = new Point(23, aux);
                                    label.DoubleClick += new EventHandler(redirect);
                                    label.MouseUp     += new MouseEventHandler(nohover);
                                    label.MouseDown   += new MouseEventHandler(nohover);
                                    label.MouseMove   += new MouseEventHandler(hover);
                                    label.ForeColor    = Color.DarkBlue;
                                    aux += 22;
                                    pnlOS.Controls.Add(label);
                                }
                            }
                            else
                            {
                                if (diff.Days > 6)
                                {
                                    label              = new Label();
                                    label.Text         = osc.getDados(obj.ID).OSN;
                                    label.Location     = new Point(23, aux);
                                    label.DoubleClick += new EventHandler(redirect);
                                    label.MouseUp     += new MouseEventHandler(nohover);
                                    label.MouseDown   += new MouseEventHandler(nohover);
                                    label.MouseMove   += new MouseEventHandler(hover);
                                    label.ForeColor    = Color.DarkBlue;
                                    aux += 22;
                                    pnlOS.Controls.Add(label);
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                label           = new Label();
                label.Text      = "Nenhuma OS pendente";
                label.Location  = new Point(30, aux);
                label.Size      = new Size(140, 13);
                label.ForeColor = Color.Red;
                pnlOS.Controls.Add(label);
                aux += 50;
            }
            label          = new Label();
            label.Text     = "OS com data Limite atrasada";
            label.Size     = new Size(196, 13);
            label.Location = new Point(0, aux);
            aux           += 22;
            pnlOS.Controls.Add(label);
            var desenvolvimento = consulta_UltimoStatusTableAdapter.GetEstimativa().ToList();

            if (desenvolvimento.Count() > 0)
            {
                foreach (var obj in desenvolvimento)
                {
                    label              = new Label();
                    label.Text         = osc.getDados(obj.ID).OSN;
                    label.Location     = new Point(23, aux);
                    label.DoubleClick += new EventHandler(redirect);
                    label.MouseUp     += new MouseEventHandler(nohover);
                    label.MouseDown   += new MouseEventHandler(nohover);
                    label.MouseMove   += new MouseEventHandler(hover);
                    label.ForeColor    = Color.DarkBlue;
                    aux += 22;
                    pnlOS.Controls.Add(label);
                }
            }
            else
            {
                label           = new Label();
                label.Text      = "Nenhuma OS pendente";
                label.Location  = new Point(30, aux);
                label.Size      = new Size(140, 13);
                label.ForeColor = Color.Red;
                pnlOS.Controls.Add(label);
                aux += 50;
            }
        }
        private void btnGerar_Click(object sender, EventArgs e)
        {
            OSController osc = new OSController();

            osc.MontaOS(Convert.ToInt32(Convert.ToInt32(dgvOS.SelectedRows[0].Cells[0].Value.ToString())));
        }
Beispiel #9
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            int aux = 0;

            if (mtxtPrev.Text.Replace("/", "").Trim().Length == 8 && mtxtDataEmissao.Text.Replace("/", "").Trim().Length == 8 && txtSolicitacao.Text != "" && Convert.ToDateTime(mtxtDataEmissao.Text) <= Convert.ToDateTime(mtxtPrev.Text))
            {
                if (mtxtEntregue.Text.Replace("/", "").Trim().Length == 8)
                {
                    if (Convert.ToDateTime(mtxtEntregue.Text) >= Convert.ToDateTime(mtxtDataEmissao.Text))
                    {
                        aux = 1;
                    }
                    else
                    {
                        aux = 0;
                        MessageBox.Show("Data de Emissao maior que data Entregue ou data Prevista...");
                    }
                }
                else
                {
                    aux = 1;
                }
                if (aux == 1)
                {
                    OS osm = new OS();
                    // MessageBox.Show(mtxtEntregue.Text);
                    OSController osc = new OSController();
                    try
                    {
                        osm.OSN             = mtxtOS.Text;
                        osm.Sistema_Id      = Convert.ToInt32(cmbSistema.SelectedValue);
                        osm.PA              = mtxtPA.Text;
                        osm.TC              = mtxtTC.Text;
                        osm.DataEmissao     = Convert.ToDateTime(mtxtDataEmissao.Text);
                        osm.Funcionario_Id  = Convert.ToInt32(cmbResp.SelectedValue);
                        osm.Prioridade_Id   = Convert.ToInt32(cmbPrioridade.SelectedValue);
                        osm.TipoServico_Id  = Convert.ToInt32(cmbTipo.SelectedValue);
                        osm.ItemContratual  = txtItem.Text;
                        osm.Servico         = cmbServico.Text;
                        osm.DataPrevista    = Convert.ToDateTime(mtxtPrev.Text);
                        osm.Departamento_Id = dfc.LastDepartamento(osm.Funcionario_Id).Departamento_Id;
                        if (mtxtEntregue.Text.Replace("/", "").Trim().Length == 8)
                        {
                            osm.DataEntregue = Convert.ToDateTime(mtxtEntregue.Text);
                        }
                        else
                        {
                            osm.DataEntregue = DateTime.MinValue;
                        }
                    }
                    catch (Exception exception)
                    {
                        MessageBox.Show("Erro: " + exception);
                    }
                    osm.Solicitacao = txtSolicitacao.Text;
                    osc.trataRequisicao(btnSalvar.Text, osm);

                    staOS.Descricao     = "Ordem de Serviço Gerada";
                    staOS.OS_Id         = oscon.getUltimaOS(Convert.ToInt32(cmbSistema.SelectedValue), osm);
                    staOS.Status_Id     = 1;
                    staOS.dataAlteracao = DateTime.Now;
                    statCon.trataRequisicao(btnSalvar.Text, staOS);


                    if (mtxtEntregue.Text.Replace("/", "").Trim().Length == 8)
                    {
                        if (Convert.ToDateTime(mtxtEntregue.Text) >= Convert.ToDateTime(mtxtDataEmissao.Text))
                        {
                            staOS.Descricao     = "Ordem de Serviço Encerrada";
                            staOS.OS_Id         = oscon.getUltimaOS(Convert.ToInt32(cmbSistema.SelectedValue), osm);
                            staOS.Status_Id     = 7;
                            staOS.dataAlteracao = DateTime.Now;
                            statCon.trataRequisicao(btnSalvar.Text, staOS);
                        }
                    }

                    if (Convert.ToInt32(cmbPrioridade.SelectedValue) == 1)
                    {
                        if (DateTime.Now.DayOfWeek.ToString().Equals("Monday") || DateTime.Now.DayOfWeek.ToString().Equals("Tuesday"))
                        {
                            totServ.DataLimite = DateTime.Now.AddDays(3);
                        }
                        else
                        {
                            totServ.DataLimite = DateTime.Now.AddDays(5);
                        }
                    }
                    else
                    {
                        totServ.DataLimite = DateTime.MinValue;
                        MessageBox.Show("Preencher data limite na tela de Entrega Prodam", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    totServ.totalHoras = 0;
                    totServ.OS_id      = oscon.getUltimaOS(Convert.ToInt32(cmbSistema.SelectedValue), osm);
                    totServCon.trataRequisicao("Cadastrar", totServ);
                }
            }
            else
            {
                MessageBox.Show("Verifique a data de Emissão e a data de Previsão", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            this.Close();
        }
        public OSViewModel()
        {
            OSController osController = new OSController();

            OSs = osController.GetOS();
        }