Ejemplo n.º 1
0
	public void TestLoad () {
		Vistoria v = new VistoriaDAO().LoadLast();
			print (v.vistoriador);

		foreach (Indicador indicador in new IndicadorDAO ().LoadByVistoriaAndAmbienteAndServico (v, "Cozinha", "REVESTIMENTO_PISO"))
			print (indicador);

		//foreach (Indicador indicador in new IndicadorDAO ().LoadByVistoria (v))
		//	print (indicador);

		/*foreach (Indicador i in new IndicadorDAO ().LoadAll ()) 
			print (i);*/
	}
Ejemplo n.º 2
0
	void Awake ()
	{
		initialized = false;
		System.DateTime time = System.DateTime.Now;
		instance = this;

		server = ServerHandler.server;

		if (!StaticData.OnlineVistoria) {
			vistoriaDAO = ServerHandler.vistoriaDAO;
			servicoDAO = ServerHandler.servicoDAO;
			ambienteDAO = ServerHandler.ambienteDAO;
			indicadorDAO = ServerHandler.indicadorDAO;
			imagemIndicadorDAO = ServerHandler.imagemIndicadorDAO;
			LoadOfflineData ();
		} else {
			LoadOnlineData ();
		}
	
	}
Ejemplo n.º 3
0
	public void OnNewClick ()
	{
		Vistoria vistoria = new Vistoria ();

		vistoria.id = 0;
		vistoria.proprietario = "";
		vistoria.empreendimento = "";
		vistoria.valor = 0d;
		vistoria.endereco = "";
		vistoria.unidade = "";
		vistoria.bloco = "";
		vistoria.dataCompra = DateTime.Now;
		vistoria.metragem = 0.0f;
		vistoria.padrao = "";
		vistoria.dataVistoria = DateTime.Now;
		vistoria.horarioAgendado = DateTime.Now;
		vistoria.inicioVistoria = DateTime.Now;
		vistoria.incorporadora = "";
		vistoria.terminoVistoria = DateTime.Now;
		vistoria.construtora = "";
		vistoria.clima = "";
		vistoria.imagemPredioUrl = null;
		vistoria.vistoriador = vistoriador;
		vistoria.imagem = null;

		VistoriaDAO vistoriaDAO = new VistoriaDAO ();
		StaticData.vistoriaAtual = vistoria;
		StaticData.OnlineVistoria = false;
		Application.LoadLevel ("RelatorioVistoria");
	}
Ejemplo n.º 4
0
	public void OnLoginClick ()
	{
		username = lblUser.text;
		senha = lblSenha.text;
		string json = "";

		isConnected = ConnectionManager.IsConnected (false) && !offlineMode;

		if (isConnected) {
			json = server.login (username + "_" + senha);

			if (json != null && json.StartsWith ("Exception")) {
				carregando.SetActive(false);
				PopupsManager.Instance.ShowPopupMessage ("Erro do Servidor", "Não foi possível fazer login. Tente novamente mais tarde.");
				return;
			}

			if (!string.IsNullOrEmpty (json)) {
				vistoriador = new Vistoriador (json);
				json = server.findVistoriaByVistoriador (vistoriador.id);
				vistorias = JsonBehaviour.GetList<Vistoria> (json);
				vistoriador = ServerHandler.vistoriadorDAO.LoadById(vistoriador.id);
				carregando.SetActive(true);
			} else {
				carregando.SetActive(false);
				PopupsManager.Instance.ShowPopupMessage ("Erro no Login", "Usuário ou senha incorretos.");
				return;
			}

		} else {
			vistoriador = ServerHandler.vistoriadorDAO.login (username, senha);
		}

		if (vistoriador != null) {
			carregando.SetActive(true);

			ServerHandler.user = username;
			ServerHandler.pass = senha;

			StaticData.vistoriadorAtual = vistoriador;

			List<Vistoria> ultimaVistoria = new VistoriaDAO ().LoadByVistoriador (vistoriador);
			for(int i = 0; i < vistoriasTable.transform.childCount; i++)
			{
				Destroy (vistoriasTable.transform.GetChild(i).gameObject);
			}

			if (ultimaVistoria != null && ultimaVistoria.Count > 0) {
				GameObject row = NGUITools.AddChild (vistoriasTable.gameObject, vistoriasPrefab);
				row.GetComponent <VistoriaRow> ().vistoria = ultimaVistoria[0];
				row.GetComponent <VistoriaRow> ().online = false;
				newButton.enabled = false;
				deleteButton.enabled = true;
//				sendButton.enabled = true;
			} else {
				newButton.enabled = true;
				deleteButton.enabled = false;
				//sendButton.enabled = false;
			}
		

			if (vistorias != null && vistorias.Count > 0) {
				foreach (var item in vistorias) {
					GameObject row = NGUITools.AddChild (vistoriasTable.gameObject, vistoriasPrefab);
					row.GetComponent <VistoriaRow> ().vistoria = item;
					row.GetComponent <VistoriaRow> ().online = true;
				}


			}

			ShowVistoriasScreen ();
			carregando.SetActive(false);
		}
		else
		{
			PopupsManager.Instance.ShowPopupMessage ("Erro no Login", "Usuário ou senha incorretos.");
		}

	}