Пример #1
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            //se a função valida retornar True, então permite cadastrar ou alterar o registro
            if ( Valida() ) {
                local local = new local();
                local.numero_opm = txtOPM.Text;
                local.nome = txtNome.Text;
                local.descricao = txtDescricao.Value;
                local.CEP = txtCEP.Text;
                local.logradouro = txtLogradouro.Value;
                local.numero = txtNumero.Value;
                local.bairro = txtBairro.Value;
                local.id_cidade = Int32.Parse(ddCidade.SelectedValue);
                local.telefone = txtTelefone.Text;
                if (txtDataInicioAtividade.Value != "")
                {
                    local.data_inicio_atividade = DateTime.Parse(txtDataInicioAtividade.Value);
                }
                local.ativo = cbbAtivo.Checked;

                Local_Model model = new Local_Model();

                // se tiver ID preenche o parâmetro
                if (txtID.Text != "Novo")
                    local.id = int.Parse(txtID.Text);

                // faz a inserção ou atualização do cadastro da cidade
                if (model.InserirAtualizar(local))
                {
                    txtID.Text = local.id.ToString();
                    Master.Sucesso("Registro salvo com sucesso.");
                }else
                    Master.Alerta("Erro ao salvar o registro: "+model.message);
            }
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "id, parent_id, key_name, title, flag")] local local)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var parent     = db.locals.Find(local.parent_id);
             var parents_id = parent != null ? parent.parents_id + local.parent_id.ToString() + "," : ",";
             var key_name   = local.key_name.ToUpper();
             local                 = db.locals.Find(local.id);
             local.key_id          = Common.Objects.LocalType.hd;
             local.parents_id      = parents_id;
             local.total_item      = 0;
             local.updated_by      = Authentication.Auth.AuthUser.id.ToString();
             local.updated_at      = DateTime.Now;
             local.key_name        = key_name;
             db.Entry(local).State = EntityState.Modified;
             db.SaveChanges();
             this.success(TM.Common.Language.msgUpdateSucsess);
         }
     }
     catch (Exception)
     {
         this.danger(TM.Common.Language.msgUpdateError);
     }
     return(RedirectToAction("Index"));
 }
Пример #3
0
        public bool InserirAtualizar(local a)
        {
            // função para cadastrar ou atualizar local
            try
            {
                Table <local> tb = getTable();
                dbDataContext db = getDataContext();

                if (a.id == 0)
                {
                    tb.InsertOnSubmit(a);
                    tb.Context.SubmitChanges();
                }
                else
                {
                    db.alteraLocal(a.id, a.nome, a.descricao, a.id_cidade, a.bairro, a.logradouro,
                                   a.numero, a.CEP, a.data_inicio_atividade, a.telefone, a.ativo, a.numero_opm);
                    tb.Context.SubmitChanges();
                }

                return(true);
            }
            catch (Exception e)
            {
                message = e.Message;
                return(false);
            }
        }
Пример #4
0
        public void transportarParaOrigem(List <Pessoa> lista)
        {
            if (!validarTransporte(lista))
            {
                return;
            }

            List <Pessoa> OrigemAux  = new List <Pessoa>(Origem);
            List <Pessoa> DestinoAux = new List <Pessoa>(Destino);

            //realiza o transporte
            foreach (var pessoa in lista)
            {
                OrigemAux.Add(pessoa);
                DestinoAux.Remove(pessoa);
            }
            //valida se as restrições estão sendo obedecidas apos o transporte;
            if (validarRestricoes(OrigemAux, DestinoAux))
            {
                Origem     = OrigemAux;
                Destino    = DestinoAux;
                LocalAtual = local.Origem;
            }
            else
            {
                MessageBox.Show("Movimento não permitido");
            }
        }
Пример #5
0
        public bool InserirAtualizar(local a)
        {
            // função para cadastrar ou atualizar local
            try
            {
                Table<local> tb = getTable();
                dbDataContext db = getDataContext();

                if (a.id == 0)
                {
                    tb.InsertOnSubmit(a);
                    tb.Context.SubmitChanges();
                }
                else
                {
                    db.alteraLocal(a.id, a.nome, a.descricao, a.id_cidade, a.bairro, a.logradouro,
                                    a.numero, a.CEP, a.data_inicio_atividade, a.telefone, a.ativo, a.numero_opm);
                    tb.Context.SubmitChanges();
                }

                return true;
            }
            catch (Exception e)
            {
                message = e.Message;
                return false;
            }
        }
Пример #6
0
        public async Task <IHttpActionResult> Putlocal(int id, local local)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != local.id)
            {
                return(BadRequest());
            }

            db.Entry(local).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!localExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #7
0
 public static localDto FromModel(local model)
 {
     return(new localDto()
     {
         id = model.id,
         nombre = model.nombre,
     });
 }
Пример #8
0
        private static void getSprites()
        {
            var sprites = { };

            for (var slot = 0; slot < 12; slot++)
            {
                local status = memory.readbyte(0x14C8 + slot);
                if status ~                     = 0 then
                                        spritex = memory.readbyte(0xE4 + slot) + memory.readbyte(0x14E0 + slot) * 256;
                spritey = memory.readbyte(0xD8 + slot) + memory.readbyte(0x14D4 + slot) * 256;
                sprites[#sprites + 1] = { ["x"] = spritex, ["y"] = spritey };
Пример #9
0
        public async Task <IHttpActionResult> Getlocal(int id)
        {
            local local = await db.local.FindAsync(id);

            if (local == null)
            {
                return(NotFound());
            }

            return(Ok(localDto.FromModel(local)));
        }
Пример #10
0
        static void   Delete()
        {
            int i = 0;

            while (i < _listcomand.Count)
            {
                local cal = new local();
                //    Images mig =new Images ()
                cal.remove(_listcomand[i]);
                i++;
            }
        }
Пример #11
0
        public async Task <IHttpActionResult> Postlocal(local local)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.local.Add(local);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = local.id }, local));
        }
Пример #12
0
        // GET: Local/Details/5
        public ActionResult Details(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            local local = db.locals.Find(id);

            if (local == null)
            {
                return(HttpNotFound());
            }
            return(View(local));
        }
Пример #13
0
        public async Task <IHttpActionResult> Deletelocal(int id)
        {
            local local = await db.local.FindAsync(id);

            if (local == null)
            {
                return(NotFound());
            }

            db.local.Remove(local);
            await db.SaveChangesAsync();

            return(Ok(local));
        }
Пример #14
0
        /// <summary>
        /// Método para buscar un Local en la BD
        /// </summary>
        /// <param name="id_local">atributo del obj para buscar en la BD</param>
        /// <returns>retorna el obj, que buscas el la BD según el id_local</returns>
        public Entidad.LocalEnt BuscarLocal(int id_local)
        {
            db_Entities db = new db_Entities();

            Entidad.LocalEnt localEnt;
            local            local = db.Local.FirstOrDefault(l => l.id_local == id_local);

            localEnt = new Entidad.LocalEnt
            {
                id_local   = local.id_local,
                dir_local  = local.dir_local,
                id_comuna  = local.id_comuna,
                id_empresa = local.id_empresa
            };
            return(localEnt);
        }
Пример #15
0
        private void reload()
        {
            try
            {
                int i = 0;
                //  foreach (var n in viewcoll.Subviews) { viewcoll.Delete(n); }
            }
            catch { }
            local cal = new local();

            DataSql = new DataSql();



            //foreach (var view in scoll.Subviews)
            //{
            //    view.RemoveFromSuperview();
            //}

            UIbutton = cal.retUIbutton();

            bool isEmpty = UIbutton.Any();

            if (isEmpty)
            {
                Nettab.bar.Change(isEmpty);
            }

            else
            {
                Nettab.bar.Change(false);
            }


            // viewcoll.RegisterClassForSupplementaryView(typeof(CollectionViewCell1), CollectionViewCell1.Key);

            CollectionView.RegisterClassForCell(typeof(CollectionViewCell1), CollectionViewCell1.Key);

            CollectionView.RegisterClassForSupplementaryView(typeof(CollectionViewCell1), UICollectionElementKindSection.Header, CollectionViewCell1.Key);
            CollectionView.Source = new sourcecollection(UIbutton);

            //   scoll.ContentSize = new CGSize(uiv.Frame.Width - 20, ImageView.Count * 15);



            //}
        }
Пример #16
0
        // GET: Local/Edit/5
        public ActionResult Edit(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            local local = db.locals.Find(id);

            if (local == null)
            {
                return(HttpNotFound());
            }

            ViewBag.local = db.locals.Where(d => d.flag > 0).ToList();
            return(View(local));
        }
Пример #17
0
        private void DeleteSection() // delete all bordercolor red
        {
            local _local = new local();
            int   row    = 0;

            for (row = 0; row < UIbutton.Count; row++)
            {
                if (UIbutton[row].BackboolSlect())
                {
                    _local.remove(UIbutton[row].setText());
                }
            }



            reload();
        }
Пример #18
0
        /// <summary>
        /// Método para eliminar un local
        /// </summary>
        /// <param name="id_local">por medio del id se buscará y eliminará el local</param>
        /// <returns>si se elimina un local enviara un verdadero, si no mandará un falso</returns>
        public bool EliminarLocal(int id_local)
        {
            db_Entities db = new db_Entities();

            try
            {
                local local = db.Local.FirstOrDefault(l => l.id_local == id_local);

                db.Local.Remove(local);
                db.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #19
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            //se a função valida retornar True, então permite cadastrar ou alterar o registro
            if (Valida())
            {
                local local = new local();
                local.numero_opm = txtOPM.Text;
                local.nome       = txtNome.Text;
                local.descricao  = txtDescricao.Value;
                local.CEP        = txtCEP.Text;
                local.logradouro = txtLogradouro.Value;
                local.numero     = txtNumero.Value;
                local.bairro     = txtBairro.Value;
                local.id_cidade  = Int32.Parse(ddCidade.SelectedValue);
                local.telefone   = txtTelefone.Text;
                if (txtDataInicioAtividade.Value != "")
                {
                    local.data_inicio_atividade = DateTime.Parse(txtDataInicioAtividade.Value);
                }
                local.ativo = cbbAtivo.Checked;

                Local_Model model = new Local_Model();

                // se tiver ID preenche o parâmetro
                if (txtID.Text != "Novo")
                {
                    local.id = int.Parse(txtID.Text);
                }

                // faz a inserção ou atualização do cadastro da cidade
                if (model.InserirAtualizar(local))
                {
                    txtID.Text = local.id.ToString();
                    Master.Sucesso("Registro salvo com sucesso.");
                }
                else
                {
                    Master.Alerta("Erro ao salvar o registro: " + model.message);
                }
            }
        }
Пример #20
0
        /// <summary>
        /// Método para modificar un objeto de tipo local
        /// </summary>
        /// <param name="localEnt">obj que trae de la BD</param>
        /// <returns>retorna un obj de tipo local o un nulo en caso de exception</returns>
        public Entidad.LocalEnt ModificarLocal(Entidad.LocalEnt localEnt)
        {
            db_Entities db = new db_Entities();

            try
            {
                local local = db.Local.FirstOrDefault(l => l.id_local == localEnt.id_local);

                local.id_local   = localEnt.id_local;
                local.dir_local  = localEnt.dir_local;
                local.id_comuna  = localEnt.id_comuna;
                local.id_empresa = localEnt.id_empresa;

                db.SaveChanges();

                return(BuscarLocal(local.id_local));
            }
            catch (Exception)
            {
                return(null);
            }
        }
Пример #21
0
        /// <summary>
        /// Método para agregar una Local en la BD
        /// </summary>
        /// <param name="localEnt">Objeto de la clase LocalEnt</param>
        /// <returns>retorna un verdadero o un falso en caso de exception para guardar el obj en la BD</returns>
        public bool AgregarLocal(Entidad.LocalEnt localEnt)
        {
            db_Entities db = new db_Entities();

            try
            {
                local local = new local
                {
                    id_local   = localEnt.id_local,
                    dir_local  = localEnt.dir_local,
                    id_comuna  = localEnt.id_comuna,
                    id_empresa = localEnt.id_empresa
                };
                db.Local.Add(local);
                db.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #22
0
        public List <agendamento> ListarDia(DateTime Dia, local nucleo)
        {
            List <agendamento> lista = new List <agendamento>();

            try
            {
                dbDataContext db = getDataContext();
                string        sSql;
                sSql = " select * from agendamentos " +
                       " where data_inicial between '" + Dia.ToShortDateString() + "' and '" + (Dia.AddDays(1)).ToShortDateString() + "' " +
                       " and ( id_local = {0} ) and ( ativo = 1 )" +
                       " order by data_inicial";
                var query = db.ExecuteQuery <agendamento>(sSql, nucleo.id);
                lista = query.ToList();
                return(lista);
            }
            catch (Exception e)
            {
                message = e.Message;
                return(lista);
            }
        }
Пример #23
0
        public bool VerificarDisponibilidade(agendamento a, local nucleo)
        {// verifica se a próxima hora a partir do horário do agendamento está livre. Retorna TRUE se o horário estiver livre
            // retorna FALSE se o horário estiver já ocupado
            // e retorna FALSE + MESSAGE se houver erro na busca
            try
            {
                String sql = "select * from agendamentos where ( id_local = {0} ) and ( ativo = 1 ) and " +
                             "( ( data_inicial between {1} and {2} ) or ( data_final between {1} and {2} ) " +
                             "or ( data_inicial = {3} ) or ( data_final = {4} ) )";
                dbDataContext db  = getDataContext();
                var           qry = db.ExecuteQuery <agendamento>(sql, nucleo.id, a.data_inicial.AddMinutes(1), a.data_final.AddMinutes(-1)
                                                                  , a.data_inicial, a.data_final);
                message = "";

                return(qry.Count() < 1);
            }
            catch (Exception e)
            {
                message = e.Message;
                return(false);
            }
        }
Пример #24
0
        // string localPath;
        private static void   ConverToJson()
        {
            json_list.Clear();

            local _local = new local();

            _ListSQL.NameFile = _local.retDataString(0, 1);
            _ListSQL.Type     = _local.retDataString(3, 1);

            //  _ListSQL.ImageToBytes



            _ListSQL.ImageToBytes = _local.retDataByet(1, 1);
            // throw new NotImplementedException();
            //string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            //string localFilename = _ListSQL.NameFile[0]; //same if I save the file as .mp4
            //localPath = Path.Combine(documentsPath, localFilename);

            //File.WriteAllBytes(localPath, _ListSQL.ImageToBytes[0]);



            int i = 0;


            while (i < _ListSQL.NameFile.Count)
            {
                js _js = new js {
                    NameFile = _ListSQL.NameFile[i], Type = _ListSQL.Type[i], Auto = save.Savegerlly
                };

                json_list.Add(_js);

                i++;
            }
        }
Пример #25
0
        public bool VerificarDisponibilidade(agendamento a, local nucleo)
        {
            // verifica se a próxima hora a partir do horário do agendamento está livre. Retorna TRUE se o horário estiver livre
            // retorna FALSE se o horário estiver já ocupado
            // e retorna FALSE + MESSAGE se houver erro na busca
            try
            {
                String sql = "select * from agendamentos where ( id_local = {0} ) and ( ativo = 1 ) and " +
                             "( ( data_inicial between {1} and {2} ) or ( data_final between {1} and {2} ) " +
                             "or ( data_inicial = {3} ) or ( data_final = {4} ) )";
                dbDataContext db = getDataContext();
                var qry = db.ExecuteQuery<agendamento>(sql, nucleo.id, a.data_inicial.AddMinutes(1),a.data_final.AddMinutes(-1)
                                            ,a.data_inicial,a.data_final);
                message = "";

                return (qry.Count() < 1);
            }
            catch (Exception e)
            {
                message = e.Message;
                return false;
            }
        }
Пример #26
0
 public List<agendamento> ListarDia(DateTime Dia, local nucleo)
 {
     List<agendamento> lista = new List<agendamento>();
     try
     {
         dbDataContext db = getDataContext();
         string sSql;
         sSql = " select * from agendamentos " +
                 " where data_inicial between '" + Dia.ToShortDateString() + "' and '" + (Dia.AddDays(1)).ToShortDateString() + "' " +
                 " and ( id_local = {0} ) and ( ativo = 1 )" +
                 " order by data_inicial";
         var query = db.ExecuteQuery<agendamento>(sSql, nucleo.id);
         lista = query.ToList();
         return lista;
     }
     catch (Exception e)
     {
         message = e.Message;
         return lista;
     }
 }
Пример #27
0
        private void localToolStripMenuItem_Click(object sender, EventArgs e)
        {
            local localForm = new local();

            localForm.Show();
        }
Пример #28
0
        public void IncrementalParsing_DoesNotBreak_WithInvalidCastException()
        {
            SyntaxNode  firstIdent, secondIdent;
            SyntaxToken firstIdentToken, secondIdentToken;
            var         initial = ParseWithRoundTripCheck("" "
                local a = b
                local b = c
                " "");

            UsingNode((LuaSyntaxNode)initial.GetRoot());
            N(SyntaxKind.CompilationUnit);
            {
                N(SyntaxKind.StatementList);
                {
                    N(SyntaxKind.LocalVariableDeclarationStatement);
                    {
                        N(SyntaxKind.LocalKeyword);
                        N(SyntaxKind.LocalDeclarationName);
                        {
                            firstIdent = N(SyntaxKind.IdentifierName).AsNode() !;
                            {
                                firstIdentToken = N(SyntaxKind.IdentifierToken, "a").AsToken();
                            }
                        }
                        N(SyntaxKind.EqualsValuesClause);
                        {
                            N(SyntaxKind.EqualsToken);
                            N(SyntaxKind.IdentifierName);
                            {
                                N(SyntaxKind.IdentifierToken, "b");
                            }
                        }
                    }
                    N(SyntaxKind.LocalVariableDeclarationStatement);
                    {
                        N(SyntaxKind.LocalKeyword);
                        N(SyntaxKind.LocalDeclarationName);
                        {
                            N(SyntaxKind.IdentifierName);
                            {
                                N(SyntaxKind.IdentifierToken, "b");
                            }
                        }
                        N(SyntaxKind.EqualsValuesClause);
                        {
                            N(SyntaxKind.EqualsToken);
                            N(SyntaxKind.IdentifierName);
                            {
                                N(SyntaxKind.IdentifierToken, "c");
                            }
                        }
                    }
                }
                N(SyntaxKind.EndOfFileToken);
            }
            EOF();

            var newText = initial.GetText()
                          .WithChanges(new TextChange(new TextSpan(11, 0), " :: T"));

            var newTree = initial.WithChangedText(newText);

            UsingNode((LuaSyntaxNode)newTree.GetRoot());
            N(SyntaxKind.CompilationUnit);
            {
                N(SyntaxKind.StatementList);
                {
                    N(SyntaxKind.LocalVariableDeclarationStatement);
                    {
                        N(SyntaxKind.LocalKeyword);
                        N(SyntaxKind.LocalDeclarationName);
                        {
                            secondIdent = N(SyntaxKind.IdentifierName).AsNode() !;
                            {
                                secondIdentToken = N(SyntaxKind.IdentifierToken, "a").AsToken();
                            }
                        }
                        N(SyntaxKind.EqualsValuesClause);
                        {
                            N(SyntaxKind.EqualsToken);
                            N(SyntaxKind.TypeCastExpression);
                            {
                                N(SyntaxKind.IdentifierName);
                                {
                                    N(SyntaxKind.IdentifierToken, "b");
                                }
                                N(SyntaxKind.ColonColonToken);
                                N(SyntaxKind.SimpleTypeName);
                                {
                                    N(SyntaxKind.IdentifierToken, "T");
                                }
                            }
                        }
                    }
                    N(SyntaxKind.LocalVariableDeclarationStatement);
                    {
                        N(SyntaxKind.LocalKeyword);
                        N(SyntaxKind.LocalDeclarationName);
                        {
                            N(SyntaxKind.IdentifierName);
                            {
                                N(SyntaxKind.IdentifierToken, "b");
                            }
                        }
                        N(SyntaxKind.EqualsValuesClause);
                        {
                            N(SyntaxKind.EqualsToken);
                            N(SyntaxKind.IdentifierName);
                            {
                                N(SyntaxKind.IdentifierToken, "c");
                            }
                        }
                    }
                }
                N(SyntaxKind.EndOfFileToken);
            }
            EOF();

            Assert.Same(firstIdent.Green, secondIdent.Green);
            Assert.Same(firstIdentToken.Node, secondIdentToken.Node);
        }
Пример #29
0
        protected void Finalizar()
        {
            try
            {
                Solicitacao_Model model = new Solicitacao_Model();
                BackEnd.Controllers.solicitacao sl = new BackEnd.Controllers.solicitacao();

                sl.data = DateTime.Now;

                // passo 1
                sl.solicitante_nome = txtNome.Value;
                sl.solicitante_endereco = txtEndereco.Value;
                sl.solicitante_telefone = txtTelefone.Value;
                sl.solicitante_email = txtEmail.Value;

                // passo 2
                sl.descricao_caso = txtDescCaso.Text;
                sl.detalhes_partes = txtDadosPartes.Text;

                // passo 3
                String sPeriodo = "";
                String sDia = "";
                foreach ( ListItem item in cbgPeriodo.Items )
                {
                    if ( item.Selected )
                    {
                        sPeriodo = sPeriodo + item.Text + "; ";
                    }
                }
                foreach (ListItem item in cbgDia.Items)
                {
                    if (item.Selected)
                    {
                        sDia = sDia + item.Text + "; ";
                    }
                }

                sl.solicitante_periodo_atendimento = sPeriodo;
                sl.solicitante_dia_atendimento = sDia;
                sl.id_local = int.Parse(ddLocal.SelectedValue);

                //PEGAR O ID SELECIONADO NO DDLOCAL E BUSCAR A CIDADE PARA ATRIBUIR NO CAMPO SL.CIDADE_ABERTURA
                local l = new local();
                Local_Model lmodel = new Local_Model();
                l = lmodel.Obter(int.Parse(ddLocal.SelectedValue));

                // ATRIBUI O ID DA CIDADE VINCULADA AO LOCAL
                sl.id_cidade_abertura = l.id_cidade;

                // insere a solicitação
                if ( ! model.Inserir(sl) )
                {
                    Master.Alerta(model.message);
                }
                else
                {
                    Response.Redirect("solicitacao_concluido.aspx");
                }

            } catch ( Exception E )
            {
                Master.Alerta(E.Message);
            }
        }
Пример #30
0
 public UdpClient(IPEndPoint remote, IPEndPoint local, AddressFamily family = AddressFamily.InterNetwork, string name = null, int id = 0) => OnConstructing(new UdpClientOptions(local, remote, family) { Id = id, Name = name });
Пример #31
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Master.GetNivelPermissao() < Mediador_Model.PERM_ADMIN)
            {
                Response.Redirect("index.aspx");
            }

            if (!IsPostBack)
            {
                // tamanho dos campos de acordo com o banco de dados
                txtNome.MaxLength       = 100;
                txtDescricao.MaxLength  = 50;
                txtBairro.MaxLength     = 50;
                txtLogradouro.MaxLength = 100;
                txtNumero.MaxLength     = 10;
                txtCEP.MaxLength        = 9;
                txtOPM.MaxLength        = 9;
                //txtDataInicioAtividade.MaxLength = 10;
                txtTelefone.MaxLength = 20;

                // carrega cidades
                Cidade_Model c = new Cidade_Model();
                ddCidade.DataSource     = c.Listar();
                ddCidade.DataValueField = "id";
                ddCidade.DataTextField  = "nome";
                ddCidade.DataBind();
                ddCidade.SelectedIndex = 0;

                cbbAtivo.Checked = true;

                // declara ID e verifica se existe ID no txtID ou no endereço
                int id = 0;

                if (txtID.Text != "Novo")
                {
                    // recupera o id
                    try
                    {
                        id = int.Parse(txtID.Text);
                    }
                    catch (Exception)
                    {
                        Master.Alerta("Erro ao carregar o cadastro.");
                    }
                }

                if (Request.QueryString["ID"] != null)
                {
                    //recupera o id
                    id         = int.Parse(Request.QueryString["ID"]);
                    txtID.Text = id.ToString();
                }

                // se houver ID informado, então carrega o registro do ID informado
                if (id != 0)
                {
                    try
                    {
                        // declara o objeto model
                        Local_Model model = new Local_Model();
                        //recupera o produto do id informado
                        local local = model.Obter(id);

                        // verifica se tem permissão de editar o local acessado
                        if (!Master.VerificarAlcance(local.numero_opm))
                        {
                            Response.Redirect("index.aspx");
                        }

                        //preencher caixas de texto com valores de produto
                        txtID.Text                   = local.id.ToString();
                        txtOPM.Text                  = local.numero_opm;
                        txtNome.Text                 = local.nome;
                        txtDescricao.Value           = local.descricao;
                        txtNumero.Value              = local.numero;
                        txtLogradouro.Value          = local.logradouro;
                        txtBairro.Value              = local.bairro;
                        txtDataInicioAtividade.Value = DateTime.Parse(local.data_inicio_atividade.ToString()).ToString("yyyy-MM-dd");
                        txtCEP.Text                  = local.CEP;
                        txtTelefone.Text             = local.telefone;
                        cbbAtivo.Checked             = local.ativo;
                        ddCidade.SelectedValue       = local.id_cidade.ToString();
                    }
                    catch (Exception)
                    {
                        Master.Alerta("Registro não encontrado.");
                    }
                }
                else
                {
                    txtID.Text = "Novo";
                }
            }
        }
Пример #32
0
        static void Delete_all()
        {
            local _local = new local();

            _local.Delete_all();
        }
Пример #33
0
        public string IncluirAlterarLocalCivil()
        {
            var auto2 = HttpContext.Current.Request.Form["autonumero"].ToString();

            if (string.IsNullOrEmpty(auto2))
            {
                auto2 = "0";
            }
            var autonumero = Convert.ToInt32(auto2);


            var nome = HttpContext.Current.Request.Form["nome"].ToString().Trim();
            var autonumeroCliente    = Convert.ToInt32(HttpContext.Current.Request.Form["autonumeroCliente"].ToString());
            var nomeCliente          = HttpContext.Current.Request.Form["nomeCliente"].ToString().Trim();
            var autonumeroPredio     = Convert.ToInt32(HttpContext.Current.Request.Form["autonumeroPredio"].ToString());
            var nomePredio           = HttpContext.Current.Request.Form["nomePredio"].ToString().Trim();
            var autonumeroSetor      = Convert.ToInt32(HttpContext.Current.Request.Form["autonumeroSetor"].ToString());
            var nomeSetor            = HttpContext.Current.Request.Form["nomeSetor"].ToString().Trim();
            var autonumeroSistema    = Convert.ToInt32(HttpContext.Current.Request.Form["autonumeroSistema"].ToString());
            var nomeSistema          = HttpContext.Current.Request.Form["nomeSistema"].ToString().Trim();
            var autonumeroSubSistema = Convert.ToInt32(HttpContext.Current.Request.Form["autonumeroSubSistema"].ToString());
            var nomeSubSistema       = HttpContext.Current.Request.Form["nomeSubSistema"].ToString().Trim();

            if (autonumero == 0)
            {
                using (var dc = new manutEntities())
                {
                    var k = new local
                    {
                        nome = nome,
                        autonumeroCliente    = autonumeroCliente,
                        nomeCliente          = nomeCliente,
                        autonumeroPredio     = autonumeroPredio,
                        nomePredio           = nomePredio,
                        autonumeroSetor      = autonumeroSetor,
                        nomeSetor            = nomeSetor,
                        autonumeroSistema    = autonumeroSistema,
                        nomeSistema          = nomeSistema,
                        autonumeroSubSistema = autonumeroSubSistema,
                        nomeSubSistema       = nomeSubSistema,
                        cancelado            = "N"
                    };

                    dc.local.Add(k);
                    dc.SaveChanges();
                    var auto = Convert.ToInt32(k.autonumero);

                    return(auto.ToString("#######0"));
                }
            }
            else
            {
                using (var dc = new manutEntities())
                {
                    var linha = dc.local.Find(autonumero); // sempre irá procurar pela chave primaria
                    if (linha != null && linha.cancelado != "S")
                    {
                        //var autonumeroSetor = linha.autonumero;
                        linha.nomeSistema          = nomeSistema;
                        linha.autonumeroSistema    = autonumeroSistema;
                        linha.nomeSubSistema       = nomeSubSistema;
                        linha.autonumeroSubSistema = autonumeroSubSistema;
                        linha.nome = nome;
                        dc.local.AddOrUpdate(linha);
                        dc.SaveChanges();

                        //dc.os.Where(x => x.autonumeroSetor == autonumeroSetor && x.cancelado != "S" && x.nomeSetor != nome).ToList().ForEach(x =>
                        //{
                        //    x.nomeSetor = nome;
                        //});
                        //dc.SaveChanges();


                        return("0");
                    }
                }
            }
            return("0");
        }
Пример #34
0
        private void Actionbutton_Clicked(object sender, EventArgs e)
        {
            this.Player.Pause();
            var alert = UIAlertController.Create("", "", UIAlertControllerStyle.ActionSheet);

            alert.AddAction((UIAlertAction.Create("Save Video", UIAlertActionStyle.Default, async(UIAlertAction obj) =>
            {
                SaveToAlbum(local, "nidal", namefile);
            })));
            alert.AddAction((UIAlertAction.Create("Share", UIAlertActionStyle.Default, (UIAlertAction obj) =>
            {
                var ii = NSUrl.FromFilename(local);

                var imageToShare = ii.Copy();
                var activityItems = new NSObject[] { imageToShare };

                var controller = new UIActivityViewController(activityItems, null);



                this.PresentViewController(controller, true, null);
            })));
            alert.AddAction((UIAlertAction.Create("Delete", UIAlertActionStyle.Destructive, (UIAlertAction obj) => {
                try
                {
                    local cal = new local();
                    //    Images mig =new Images ()
                    cal.remove(this.Title);
                    img.imG.ViewDidLoad();
                }
                catch
                {
                    var armAlert = UIAlertController.Create("database dot open", string.Empty, UIAlertControllerStyle.Alert);
                    var cancelAction1 = UIAlertAction.Create("ok", UIAlertActionStyle.Cancel, alertAction1 => { });

                    armAlert.AddAction(cancelAction1);


                    PresentViewController(armAlert, true, null);
                }

                NavigationController.PopViewController(true);
            })));
            alert.AddAction((UIAlertAction.Create("Rename", UIAlertActionStyle.Default, (UIAlertAction obj) => {
                UITextField field = new UITextField();

                //field.Text = this.Title;
                var frame = new CGRect(40, 40, 300, 60);
                var messbox = UIAlertController.Create("Change a Name", string.Empty, UIAlertControllerStyle.Alert);
                messbox.View.BackgroundColor = UIColor.DarkGray;
                //   UITextField field = null;
                // UITextField field2 = null;
                messbox.AddTextField((textField) =>
                {
                    // field = textField;

                    // Initialize field
                    //  field.Placeholder = placeholder;
                    //  field.Placeholder = library.Messages(0);

                    // field.BackgroundColor = UIColor.Yellow;
                    //    field.Layer.BorderColor = UIColor.Gray.CGColor;

                    //  field.Font = library.Font();
                    field = textField;
                    field.Frame = frame;
                    field.Layer.BorderWidth = 0;
                    //   field.Layer.CornerRadius = 20;
                    //  field = new UITextField(new CoreGraphics.CGRect(10, 60, 300, 60));
                    //  field.SecureTextEntry = true;
                });
                var cancelAction = UIAlertAction.Create(library.StrForm(4), UIAlertActionStyle.Cancel, alertAction => { });
                var okayAction = UIAlertAction.Create(library.StrForm(3), UIAlertActionStyle.Default, alertAction => {
                    string[] data = new string[] { field.Text + ".mp4", this.Title };
                    this.Title = field.Text + ".mp4";
                    local cal = new local();

                    //    Images mig =new Images ()
                    cal.Uplod(data);

                    img.imG.ViewDidLoad();

                    cal.retUIbutton();
                });

                messbox.AddAction(cancelAction);
                messbox.AddAction(okayAction);

                //Present Alert
                PresentViewController(messbox, true, null);
            })));
            alert.AddAction((UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, (UIAlertAction obj) => { })));

            this.PresentViewController(alert, true, null);
        }
Пример #35
0
        protected void Finalizar()
        {
            try
            {
                Solicitacao_Model model            = new Solicitacao_Model();
                BackEnd.Controllers.solicitacao sl = new BackEnd.Controllers.solicitacao();

                sl.data = DateTime.Now;

                // passo 1
                sl.solicitante_nome     = txtNome.Value;
                sl.solicitante_endereco = txtEndereco.Value;
                sl.solicitante_telefone = txtTelefone.Value;
                sl.solicitante_email    = txtEmail.Value;

                // passo 2
                sl.descricao_caso  = txtDescCaso.Text;
                sl.detalhes_partes = txtDadosPartes.Text;

                // passo 3
                String sPeriodo = "";
                String sDia     = "";
                foreach (ListItem item in cbgPeriodo.Items)
                {
                    if (item.Selected)
                    {
                        sPeriodo = sPeriodo + item.Text + "; ";
                    }
                }
                foreach (ListItem item in cbgDia.Items)
                {
                    if (item.Selected)
                    {
                        sDia = sDia + item.Text + "; ";
                    }
                }

                sl.solicitante_periodo_atendimento = sPeriodo;
                sl.solicitante_dia_atendimento     = sDia;
                sl.id_local = int.Parse(ddLocal.SelectedValue);

                //PEGAR O ID SELECIONADO NO DDLOCAL E BUSCAR A CIDADE PARA ATRIBUIR NO CAMPO SL.CIDADE_ABERTURA
                local       l      = new local();
                Local_Model lmodel = new Local_Model();
                l = lmodel.Obter(int.Parse(ddLocal.SelectedValue));

                // ATRIBUI O ID DA CIDADE VINCULADA AO LOCAL
                sl.id_cidade_abertura = l.id_cidade;

                // insere a solicitação
                if (!model.Inserir(sl))
                {
                    Master.Alerta(model.message);
                }
                else
                {
                    Response.Redirect("solicitacao_concluido.aspx");
                }
            } catch (Exception E)
            {
                Master.Alerta(E.Message);
            }
        }