public DASSTest() { Test_Id = 1; Test_QuestionsNo = 0; Test_Title = "آزمون افسردگي، اضطراب، استرس"; Test_Questions = new List <Question>(); Test_Description = ""; DKeys = new List <int>(); DKeys.Add(3); DKeys.Add(5); DKeys.Add(10); DKeys.Add(13); DKeys.Add(16); DKeys.Add(17); DKeys.Add(21); AKeys = new List <int>(); AKeys.Add(2); AKeys.Add(4); AKeys.Add(7); AKeys.Add(9); AKeys.Add(15); AKeys.Add(19); AKeys.Add(20); SKeys = new List <int>(); SKeys.Add(1); SKeys.Add(6); SKeys.Add(8); SKeys.Add(11); SKeys.Add(12); SKeys.Add(14); SKeys.Add(18); Connection.Connection con = new Connection.Connection(); //List<t> lmd = new List<UserActivationModel>(); DataSet ds = new DataSet(); ds = con.QuestionsData(Test_Id); foreach (DataRow dr in ds.Tables[0].Rows) { Test_QuestionsNo++; Test_Questions.Add(new Question { ID = Convert.ToInt32(dr["ID"]), Qu_Text = dr["Qu_Text"].ToString(), Qu_Row = Convert.ToInt32(dr["Qu_Row"]), Qu_Choice = 0 }); } }
private static async Task<IClient> ConnectInternal(ConnectionParams connectionParams, CancellationToken cancellationToken, Dispatcher dispatcher, CancellationTokenSource apiCancellationTokenSource) { try { var stream = await SetupConnection(connectionParams.HostName, connectionParams.Port); var fieldsStream = new FieldsStream(stream); var serializer = new IBSerializer(); await Handshake(connectionParams.ClientId, fieldsStream, serializer, cancellationToken); var connection = new Connection.Connection(fieldsStream, serializer); var factory = new ApiObjectsFactory(connection, new IdsDispenser(connection), dispatcher, apiCancellationTokenSource); var waitForMarketConnected = factory.CreateWaitForMarketConnectedOperation(cancellationToken); var waitForAccountsList = factory.CreateReceiveManagedAccountsListOperation(cancellationToken); connection.ReadMessagesAndDispatch(); await waitForMarketConnected; var accountStorage = await factory.CreateAccountStorageOperation(await waitForAccountsList, cancellationToken); return factory.CreateClient(accountStorage); } catch { apiCancellationTokenSource.Cancel(); throw; } }
public void cadastraProduto(Produto novoProduto) { con = new MySqlConnection(); connection = new Connection.Connection(); con.ConnectionString = connection.getConnectionString(); string dataVencimento = $"{novoProduto.DiaVencimento}-{novoProduto.MesVencimento}-{novoProduto.AnoVencimento}"; string query = "CALL cadastra_produto (?nome, ?empresa, ?categoria, ?preco_compra, ?preco_venda, ?estoque, ?dataVencimento)"; try { con.Open(); MySqlCommand command = new MySqlCommand(query, con); command.Parameters.AddWithValue("?nome", novoProduto.Nome); command.Parameters.AddWithValue("?empresa", novoProduto.Empresa); command.Parameters.AddWithValue("?categoria", novoProduto.Categoria); command.Parameters.AddWithValue("?preco_compra", novoProduto.PrecoCompra); command.Parameters.AddWithValue("?preco_venda", novoProduto.PrecoVenda); command.Parameters.AddWithValue("?estoque", novoProduto.Estoque); command.Parameters.AddWithValue("?dataVencimento", dataVencimento); command.ExecuteNonQuery(); } finally { con.Close(); MessageBox.Show("Produto cadastrado com sucesso.", "Sucesso!", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void ChalangeHandler(Message m, Connection.Connection c) { Console.WriteLine("auth response from {0}", c.EndPoint.ToString()); var login = DataStorage.CreateForRead(m.Body).ReadString(); Console.WriteLine("login: ", login); var user = _storage.Users.FirstOrDefault(u => u.Login == login); if (user == null || user.Online) { _host.Send(new Message((short)AuthMType.ChalangeFailed, Mode.Reliable), c); } else { var num = Host.Rnd.Next(1000000, int.MaxValue); lock (_sessions) { var session = new AuthSession(); session.User = user; session.Num = num; _sessions.Add(c.Token, session); } _host.Send( new Message((short)AuthMType.ChalangeSuccess, Mode.Reliable, DataStorage.CreateForWrite().Push(num).Serialize()), c); } }
public ActionResult TestListReport() { if (test1.Models.UserTest.IsValidUser == true && test1.Models.UserTest.UserType == true) { List <DASSResultModel> lmd = new List <DASSResultModel>(); Connection.Connection con = new Connection.Connection(); DataSet ds = new DataSet(); ds = con.TheResultListData("1"); foreach (DataRow dr in ds.Tables[0].Rows) { lmd.Add(new DASSResultModel { ID = Convert.ToInt64(dr["id"]), AnxResult = Convert.ToInt32(dr["AnxResult"]), AnxStatus = Convert.ToInt32(dr["AnxStatus"]), DepResult = Convert.ToInt32(dr["DepResult"]), DepStatus = Convert.ToInt32(dr["DepStatus"]), EndTime = dr["EndTime"].ToString(), LastName = dr["LastName"].ToString(), Name = dr["Name"].ToString(), StartTime = dr["StartTime"].ToString(), TestDate = dr["TestDate"].ToString(), StressResult = Convert.ToInt32(dr["StressResult"]), ClassNo = Convert.ToInt32(dr["ClassNo"]), StressStatus = Convert.ToInt32(dr["StressStatus"]) }); } return(View(lmd)); } else { return(RedirectToAction("Index", "Home")); } }
public ActionResult NewGallery(test1.Models.Gallery model) { bool TheResult = false; if (ModelState.IsValid) { Connection.Connection con = new Connection.Connection(); if (User.Identity.GetUserId() != null) { string[] words = model.Ga_Deleteable.Split(' '); foreach (string word in words) { model.Photoes.RemoveAt(Int32.Parse(word)); } TheResult = con.AddGallery(model); } } if (TheResult == true) { return(RedirectToAction("Index", "Manage", new { Message = Models.ManageMessageId.AddGallerySuccess })); } else { return(View()); } }
public void cadastraCurso(string nomeCurso, float valorCurso) { con = new MySqlConnection(); connection = new Connection.Connection(); con.ConnectionString = connection.getConnectionString(); string query = "INSERT INTO curso (Nome, Valor) VALUES (?nomeCurso, ?valorCurso); "; try { con.Open(); MySqlCommand command = new MySqlCommand(query, con); command.Parameters.AddWithValue("?nomeCurso", nomeCurso); command.Parameters.AddWithValue("?valorCurso", valorCurso); command.ExecuteNonQuery(); command.Dispose(); } catch (Exception ex) { MessageBox.Show($"Houve um erro com o banco de dados: {ex}", "Erro BD", MessageBoxButtons.OK, MessageBoxIcon.Warning); } finally { con.Close(); MessageBox.Show("Curso cadastrado com sucesso!", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void finalizaCadastroAluno(int alunoID, int instituicaoID, float valorDivida) { con = new MySqlConnection(); connection = new Connection.Connection(); con.ConnectionString = connection.getConnectionString(); string query = "INSERT INTO solicitacao_pagamento (Fk_aluno_ID, Fk_instituicao_ID, Valor_divida) VALUES (?Fk_aluno_ID, ?Fk_instituicao_ID, ?Valor_divida);"; try { con.Open(); MySqlCommand command = new MySqlCommand(query, con); command.Parameters.AddWithValue("?Fk_aluno_ID", alunoID); command.Parameters.AddWithValue("?Fk_instituicao_ID", instituicaoID); command.Parameters.AddWithValue("?Valor_divida", valorDivida); command.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show($"Houve um erro com o banco de dados: {ex}", "Erro BD", MessageBoxButtons.OK, MessageBoxIcon.Warning); } finally { con.Close(); } }
private void obterTotalPedidos() { this.totalPedidos = 0; connection = new Connection.Connection(); string connectionString = connection.getConnectionString(); string query = "SELECT * FROM pedidos;"; using (MySqlConnection con = new MySqlConnection(connectionString)) { using (MySqlDataAdapter adapter = new MySqlDataAdapter(query, con)) { try { DataTable dataTable = new DataTable(); adapter.Fill(dataTable); this.totalPedidos = Convert.ToInt32(dataTable.Rows.Count); } catch (Exception ex) { MessageBox.Show("Erro: " + ex); } } } }
private void obterTotalVendido() { this.totalVendido = 0; connection = new Connection.Connection(); string connectionString = connection.getConnectionString(); string query = "CALL relatorio_vendas();"; using (MySqlConnection con = new MySqlConnection(connectionString)) { using (MySqlDataAdapter adapter = new MySqlDataAdapter(query, con)) { try { DataTable dataTable = new DataTable(); adapter.Fill(dataTable); for (int index = 0; index < dataTable.Rows.Count; index++) { this.totalVendido += Convert.ToDouble(dataTable.Rows[index][2]) * Convert.ToDouble(dataTable.Rows[index][3]); } } catch (Exception ex) { MessageBox.Show("Erro: " + ex); } } } }
public void atualizaProduto(Produto produto) { con = new MySqlConnection(); connection = new Connection.Connection(); con.ConnectionString = connection.getConnectionString(); string dataVencimento = "" + produto.DiaVencimento + "-" + produto.MesVencimento + "-" + produto.AnoVencimento + ""; string query = "CALL edita_produto(?produtoID, ?produtoNome, ?produtoEmpresa, ?produtoCategoria, ?produtoPrecoCompra, ?produtoPrecoVenda, ?produtoEstoque, ?produtoDataVencimento);"; try { con.Open(); MySqlCommand command = new MySqlCommand(query, con); command.Parameters.AddWithValue("?produtoID", produto.Id); command.Parameters.AddWithValue("?produtoNome", produto.Nome); command.Parameters.AddWithValue("?produtoEmpresa", produto.Empresa); command.Parameters.AddWithValue("?produtoCategoria", produto.Categoria); command.Parameters.AddWithValue("?produtoPrecoCompra", produto.PrecoCompra); command.Parameters.AddWithValue("?produtoPrecoVenda", produto.PrecoVenda); command.Parameters.AddWithValue("?produtoEstoque", produto.Estoque); command.Parameters.AddWithValue("?produtoDataVencimento", dataVencimento); command.ExecuteNonQuery(); MessageBox.Show("Produto atualizado com sucesso.", "Sucesso!", MessageBoxButtons.OK, MessageBoxIcon.Information); } finally { con.Close(); } }
public ActionResult MyResult(DASSResultModel model) { if (test1.Models.UserTest.IsValidUser == false) { return(RedirectToAction("Index", "Home")); } if (model.Name == null) { Connection.Connection con = new Connection.Connection(); DataSet ds = new DataSet(); ds = con.MyResultData(test1.Models.UserTest.ValidUser, "1"); if (ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; model.ID = Convert.ToInt64(dr["id"]); model.AnxResult = Convert.ToInt32(dr["AnxResult"]); model.AnxStatus = Convert.ToInt32(dr["AnxStatus"]); model.DepResult = Convert.ToInt32(dr["DepResult"]); model.DepStatus = Convert.ToInt32(dr["DepStatus"]); model.EndTime = dr["EndTime"].ToString(); model.LastName = dr["LastName"].ToString(); model.Name = dr["Name"].ToString(); model.StartTime = dr["StartTime"].ToString(); model.TestDate = dr["TestDate"].ToString(); model.StressResult = Convert.ToInt32(dr["StressResult"]); model.StressStatus = Convert.ToInt32(dr["StressStatus"]); } } return(View(model)); }
public void removerMatricula(int alunoID) { con = new MySqlConnection(); connection = new Connection.Connection(); con.ConnectionString = connection.getConnectionString(); string query = "DELETE FROM solicitacao_pagamento WHERE Fk_aluno_ID = ?AlunoID2; " + "DELETE FROM parcelas WHERE Fk_aluno_ID = ?AlunoID3; " + "DELETE FROM aluno WHERE ID = ?AlunoID; "; try { con.Open(); MySqlCommand command = new MySqlCommand(query, con); command.Parameters.AddWithValue("?AlunoID", alunoID); command.Parameters.AddWithValue("?AlunoID2", alunoID); command.Parameters.AddWithValue("?AlunoID3", alunoID); command.ExecuteNonQuery(); command.Dispose(); } catch (Exception ex) { MessageBox.Show($"Houve um erro com o banco de dados: {ex}", "Erro BD", MessageBoxButtons.OK, MessageBoxIcon.Warning); } finally { con.Close(); MessageBox.Show("Matricula removida com sucesso!", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void CheckHash(Message m, Connection.Connection c) { var hash = DataStorage.CreateForRead(m.Body).ReadInt32(); lock (_sessions) { if (_sessions.ContainsKey(c.Token)) { var session = _sessions[c.Token]; if (!session.User.Online) { session.User.Online = true; _host.Send(new Message((short)AuthMType.AuthSuccess, Mode.Reliable), c); c.Disconnected += (con) => session.User.Online = false; if (OnAccountLogin != null) { OnAccountLogin.Invoke(c, session.User.AccountId); } } else { _host.Send(new Message((short)AuthMType.AuthFailed, Mode.Reliable), c); } _sessions.Remove(c.Token); } else { _host.Send(new Message((short)AuthMType.AuthFailed, Mode.Reliable), c); } } }
public void voltarParcela(int parcelaID) { con = new MySqlConnection(); connection = new Connection.Connection(); con.ConnectionString = connection.getConnectionString(); string query = "UPDATE parcelas SET Situacao = 'Pendente' WHERE parcelas.ID = ?parcelaID;"; try { con.Open(); MySqlCommand command = new MySqlCommand(query, con); command.Parameters.AddWithValue("?parcelaID", parcelaID); command.ExecuteNonQuery(); command.Dispose(); } catch (Exception ex) { MessageBox.Show($"Houve um erro com o banco de dados: {ex}", "Erro BD", MessageBoxButtons.OK, MessageBoxIcon.Warning); } finally { con.Close(); MessageBox.Show("Pagamento revertido com sucesso!", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void atualizaDadosAluno(Models.Aluno aluno) { con = new MySqlConnection(); connection = new Connection.Connection(); con.ConnectionString = connection.getConnectionString(); string query = "UPDATE aluno SET Nome = ?aluno.Nome, Idade = ?aluno.Idade, Email = ?aluno.Email, Telefone = ?aluno.Telefone, Endereco = ?aluno.Endereco WHERE aluno.ID = ?aluno.ID;"; try { con.Open(); MySqlCommand command = new MySqlCommand(query, con); command.Parameters.AddWithValue("?aluno.Nome", aluno.Nome); command.Parameters.AddWithValue("?aluno.Idade", aluno.Idade); command.Parameters.AddWithValue("?aluno.Email", aluno.Email); command.Parameters.AddWithValue("?aluno.Telefone", aluno.Telefone); command.Parameters.AddWithValue("?aluno.Endereco", aluno.Endereco); command.Parameters.AddWithValue("?aluno.ID", aluno.Id); command.ExecuteNonQuery(); command.Dispose(); } catch (Exception ex) { MessageBox.Show($"Houve um erro com o banco de dados: {ex}", "Erro BD", MessageBoxButtons.OK, MessageBoxIcon.Warning); } finally { con.Close(); MessageBox.Show("Aluno editado com sucesso!", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public ActionResult News(Int16 Nw_Type, Int16 SelectedNews = 0) { NewsListModel lmd = new NewsListModel(); lmd.SeletedNews = SelectedNews; lmd.Nw_Type = Nw_Type; DataSet ds = new DataSet(); Connection.Connection con = new Connection.Connection(); ds = con.NewsData(Nw_Type); foreach (DataRow dr in ds.Tables[0].Rows) { lmd.NewsItems.Add(new NewsModel { Nw_Id = Convert.ToInt32(dr["Nw_Id"]), Nw_Date = Convert.ToDateTime(dr["Nw_Date"]), Nw_ShortDescription = dr["Nw_ShortDescription"].ToString(), Nw_Description = dr["Nw_Description"].ToString(), Nw_Title = dr["Nw_Title"].ToString(), User_Name = dr["User_Name"].ToString(), Nw_Photo1 = dr["Nw_Photo1"].ToString(), Nw_Photo2 = dr["Nw_Photo1"].ToString(), Nw_Photo3 = dr["Nw_Photo1"].ToString(), Nw_Photo4 = dr["Nw_Photo1"].ToString() }); } return(View(lmd)); }
public ActionResult OnlinePayment(OnlinePaymentModel model) { bool TheError = false; if (ModelState.IsValid) { Connection.Connection con = new Connection.Connection(); if (User.Identity.GetUserId() == null) { TheError = con.AddUserAndPayment(model); } else { TheError = con.UpdateUserAndPayment(model, User.Identity.GetUserId()); } } if (TheError == false) { ViewBag.Message = ""; return(RedirectToAction("OnlinePayment2", "Home", model)); } else { ViewBag.Message = "خطا در ثبت اطلاعات"; Connection.Connection con = new Connection.Connection(); model.Countries = con.GetListOfCountries(); model.States = con.GetListOfStates(model.SelectedCountry); model.Cities = con.GetListOfCities(model.SelectedState); return(View(model)); } }
public ActionResult PeriodicPayment2(PeriodicPaymentModel model) { bool TheError = false; if (ModelState.IsValid) { Connection.Connection con = new Connection.Connection(); if (User.Identity.GetUserId() == null) { TheError = con.AddUserAndDonator(model); } else { TheError = con.UpdateUserAndDonator(model, User.Identity.GetUserId()); } } if (TheError == false) { return(RedirectToAction("Index", "Manage", new { Message = Models.ManageMessageId.PeriodicPaymentFormSuccess })); } else { return(View(model)); } }
private void SendPwdHash(Message m, Connection.Connection c) { var num = DataStorage.CreateForRead(m.Body).ReadInt32(); var hash = Password.GetHashCode(); _host.Send(new Message((short)AuthMType.PwdHash, Mode.Reliable, DataStorage.CreateForWrite().Push(num ^ hash).Serialize())); }
public ActionResult ChangeCity(int SelectedState) { List <MySelectListItem> Cities = new List <MySelectListItem>(); Connection.Connection con = new Connection.Connection(); Cities = con.GetListOfCities(SelectedState); return(Json(Cities)); }
public override bool executeCommand(string args = null, Connection.Connection conn = null, bool invokedByServer = false) { MainWindow.instance.Dispatcher.BeginInvoke(new Action(() => { ((ChatPage)PageManager.Instance.GetPage(PageType.ChatPage)).WriteLine(args); })); return(true); }
public ActionResult ChangeState(int SelectedCountry) { List <MySelectListItem> States = new List <MySelectListItem>(); Connection.Connection con = new Connection.Connection(); States = con.GetListOfStates(SelectedCountry); return(Json(States)); }
public void listaMatricuasEmAnalise(DataGridView dtgv, int instituicaoID) { connection = new Connection.Connection(); dtgv.DataSource = null; dtgv.Rows.Clear(); dtgv.Refresh(); string connectionString = connection.getConnectionString(); string query = "SELECT " + "solicitacao_pagamento.ID, " + "aluno.Nome, " + "instituicao.Nome, " + "solicitacao_pagamento.Quantidade_parcelas, " + "solicitacao_pagamento.Juros, " + "solicitacao_pagamento.Valor_divida, " + "solicitacao_pagamento.Situacao " + "FROM solicitacao_pagamento " + "INNER JOIN aluno ON aluno.ID = solicitacao_pagamento.Fk_aluno_ID " + "INNER JOIN instituicao ON instituicao.ID = solicitacao_pagamento.Fk_instituicao_ID " + "WHERE solicitacao_pagamento.Situacao = 'Aguardando análise' AND solicitacao_pagamento.Fk_instituicao_ID = ?instituicaoID ;"; using (MySqlConnection con = new MySqlConnection(connectionString)) { using (MySqlDataAdapter adapter = new MySqlDataAdapter(query, con)) { MySqlCommand command = new MySqlCommand(query, con); command.Parameters.Add("?instituicaoID", (MySqlDbType)SqlDbType.Int); command.Parameters["?instituicaoID"].Value = instituicaoID; adapter.SelectCommand = command; adapter.InsertCommand = command; try { DataTable dataTable = new DataTable(); adapter.Fill(dataTable); for (int index = 0; index < dataTable.Rows.Count; index++) { dtgv.Rows.Add ( dataTable.Rows[index][0], dataTable.Rows[index][1], dataTable.Rows[index][2], dataTable.Rows[index][3], dataTable.Rows[index][4], dataTable.Rows[index][5] ); } } catch (Exception ex) { MessageBox.Show("Erro: " + ex); } } } }
public void listarParcelasPagas(DataGridView dtgv, int alunoID) { connection = new Connection.Connection(); dtgv.DataSource = null; dtgv.Rows.Clear(); dtgv.Refresh(); string connectionString = connection.getConnectionString(); string query = "SELECT " + "parcelas.ID, " + "aluno.Nome, " + "parcelas.Numero_parcela, " + "parcelas.Valor_parcela, " + "parcelas.Forma_pagamento, " + "parcelas.Situacao " + "FROM parcelas " + "INNER JOIN aluno ON parcelas.Fk_aluno_ID = aluno.ID " + "WHERE parcelas.Situacao = 'Pago' AND parcelas.Fk_aluno_ID = ?AlunoID;"; using (MySqlConnection con = new MySqlConnection(connectionString)) { using (MySqlDataAdapter adapter = new MySqlDataAdapter(query, con)) { MySqlCommand command = new MySqlCommand(query, con); command.Parameters.Add("?AlunoID", (MySqlDbType)SqlDbType.Int); command.Parameters["?AlunoID"].Value = alunoID; adapter.SelectCommand = command; adapter.InsertCommand = command; try { DataTable dataTable = new DataTable(); adapter.Fill(dataTable); for (int index = 0; index < dataTable.Rows.Count; index++) { dtgv.Rows.Add ( dataTable.Rows[index][0], dataTable.Rows[index][1], dataTable.Rows[index][2], dataTable.Rows[index][3], dataTable.Rows[index][4], dataTable.Rows[index][5] ); } } catch (Exception ex) { MessageBox.Show("Erro: " + ex); } } } }
public void listarAlunosCadastrados(DataGridView dtgv, int responsavelID) { connection = new Connection.Connection(); dtgv.DataSource = null; dtgv.Rows.Clear(); dtgv.Refresh(); string connectionString = connection.getConnectionString(); string query = "SELECT " + "aluno.ID, " + "aluno.Nome, " + "instituicao.Nome, " + "responsavel.Nome, " + "curso.Nome " + "FROM aluno " + "INNER JOIN instituicao ON instituicao.ID = aluno.Fk_instituicao_ID " + "INNER JOIN responsavel ON responsavel.ID = aluno.Fk_responsavel_ID " + "INNER JOIN curso ON curso.ID = aluno.Fk_curso_ID " + "WHERE aluno.Fk_responsavel_ID = ?ResponsavelID;"; using (MySqlConnection con = new MySqlConnection(connectionString)) { using (MySqlDataAdapter adapter = new MySqlDataAdapter(query, con)) { MySqlCommand command = new MySqlCommand(query, con); command.Parameters.Add("?ResponsavelID", (MySqlDbType)SqlDbType.Int); command.Parameters["?ResponsavelID"].Value = responsavelID; adapter.SelectCommand = command; adapter.InsertCommand = command; try { DataTable dataTable = new DataTable(); adapter.Fill(dataTable); for (int index = 0; index < dataTable.Rows.Count; index++) { dtgv.Rows.Add ( dataTable.Rows[index][0], dataTable.Rows[index][1], dataTable.Rows[index][2], dataTable.Rows[index][3], dataTable.Rows[index][4] ); } } catch (Exception ex) { MessageBox.Show("Erro: " + ex); } } } }
public Boolean ExecuteCommand(Commands command, String args = null, Connection.Connection conn = null, bool invokedByServer = false) { Command comm = Command.GetCommand(command); if (comm.RequireConnection && (conn == null || !conn.Connected)) { return(false); } return(comm.executeCommand(args, conn, invokedByServer)); }
private void InfoResponseHandler(Message msg, Connection.Connection con) { var account = new TModel(); account.FillDeserialize(msg.Body); if (OnAccountInfoReceived != null) { OnAccountInfoReceived.Invoke(account); } }
public GetRelatedValues() { InitializeComponent(); Connection.Connection connection = new Connection.Connection(); connection.Connect(); INetworkModelGDAContract proxy = connection.Proxy; DataContext = new GetRelatedValuesViewModel(proxy); }
public ActionResult PeriodicPayment2() { PeriodicPaymentModel lmd = new PeriodicPaymentModel(); Connection.Connection con = new Connection.Connection(); DateTimeFormatInfo format = new DateTimeFormatInfo(); format.ShortDatePattern = "mm/dd/yyyy"; if (User.Identity.GetUserId() != null) { DataSet ds = new DataSet(); ds = con.DonatorData(User.Identity.GetUserId()); if (ds.Tables[0].Rows.Count == 1) { DataRow dr = ds.Tables[0].Rows[0]; lmd.Us_Name = dr["Us_Name"].ToString(); lmd.Us_LName = dr["Us_LName"].ToString(); lmd.Us_Phone = dr["Us_Phone"].ToString(); lmd.Us_Email = dr["Us_Email"].ToString(); lmd.Us_BirthDay = Convert.ToDateTime(dr["Us_BirthDay"], format); lmd.Us_HomeAddress = dr["Us_HomeAddress"].ToString(); lmd.Us_WorkAddress = dr["Us_WorkAddress"].ToString(); lmd.City_Ct_Id = Convert.ToInt16(dr["City_Ct_Id"]); lmd.SelectedState = con.StateData(lmd.City_Ct_Id); lmd.SelectedCountry = con.CountryData(lmd.SelectedState); lmd.Countries = con.GetListOfCountries(); lmd.States = con.GetListOfStates(lmd.SelectedCountry); lmd.Cities = con.GetListOfCities(lmd.SelectedState); if (dr["Dr_Us_ID"].ToString() != "") { lmd.Dr_AccTransaction = Convert.ToBoolean(dr["Dr_AccTransaction"]); lmd.Dr_Amount = Convert.ToInt32(dr["Dr_Amount"]); lmd.Dr_CardTranscation = Convert.ToBoolean(dr["Dr_CardTranscation"]); lmd.Dr_Cleaner = Convert.ToBoolean(dr["Dr_Cleaner"]); lmd.Dr_Clothes = Convert.ToBoolean(dr["Dr_Clothes"]); lmd.Dr_CT_Code = Convert.ToByte(dr["Dr_CT_Code"]); lmd.Dr_Endowment = Convert.ToBoolean(dr["Dr_Endowment"]); lmd.Dr_Food = Convert.ToBoolean(dr["Dr_Food"]); lmd.Dr_HelpDay = Convert.ToByte(dr["Dr_HelpDay"]); lmd.Dr_Inperson = Convert.ToBoolean(dr["Dr_Inperson"]); lmd.Dr_Medical = Convert.ToBoolean(dr["Dr_Medical"]); lmd.Dr_Month_Duration = Convert.ToByte(dr["Dr_Month_Duration"]); lmd.Dr_Representative = Convert.ToBoolean(dr["Dr_Representative"]); lmd.Dr_Stationery = Convert.ToBoolean(dr["Dr_Stationery"]); } return(View(lmd)); } } lmd.Us_BirthDay = Convert.ToDateTime(DateTime.Now, format); lmd.Countries = con.GetListOfCountries(); lmd.States = con.GetListOfStates(1); lmd.Cities = con.GetListOfCities(1); //lmd.City_Ct_Id-=Convert.ToInt16(lmd.Cities[0].value; return(View(lmd)); }
public Models.Usuario logaUsuario(string usuario, string senha) { con = new MySqlConnection(); connection = new Connection.Connection(); con.ConnectionString = connection.getConnectionString(); string query = "SELECT * FROM responsavel WHERE Login = ?usuario"; try { con.Open(); MySqlCommand command = new MySqlCommand(query, con); command.Parameters.AddWithValue("?usuario", usuario); command.Dispose(); MySqlDataReader MySqlDR = command.ExecuteReader(); if (MySqlDR.Read()) { string senhaHash = Utils.Seguranca.generateHash(senha); string senhaSalt = MySqlDR.GetString(9); string senhaSalted = Utils.Seguranca.generateHash($"{senhaHash}{senhaSalt}"); if (senhaSalted == MySqlDR.GetString(8)) { this.usuario = new Models.Usuario( Convert.ToInt32(MySqlDR.GetString(0)), MySqlDR.GetString(1), MySqlDR.GetString(2), Convert.ToInt32(MySqlDR.GetString(3)), MySqlDR.GetString(4), MySqlDR.GetString(5), MySqlDR.GetString(6), usuario ); } } } catch (Exception ex) { MessageBox.Show($"Houve um erro com o banco de dados: {ex}", "Erro BD", MessageBoxButtons.OK, MessageBoxIcon.Warning); } finally { con.Close(); } return(this.usuario); }
public override void PostValidate(Action andThen) { var connection = new Connection.Connection( m_View.GetInstance(), m_View.GetSecurityType(), m_View.GetUserName(), m_View.GetPassword()); var status = m_TestConnection.Test(connection); if(status.Connected) { andThen(); } else { m_View.ShowWarning(status.ErrorMessage); } }
public ServerClient(string identity, IExtensionRegistry extensionRegistry, BufferManager bufferManager) { ServerName = identity; _bufferManager = bufferManager; _extensionService = new ExtensionService(extensionRegistry, DeliverMessage); _connection = new Connection.Connection(ServerName, _extensionService, true, _bufferManager) { ExtensionFrameReceived = OnExtensionFrame, MessageFrameReceived = OnMessageFrame, WriteCompleted = OnWriteCompleted, }; _connection.HandshakeReceived += OnHandshakeFrame; _connection.Disconnected += HandleRemoteDisconnect; _state = ServerState.WaitingOnInitialHandshake; ServerName = "FastSocket v" + Major + "." + Minor; }
public void Connect() { try { var remoteEp = new IPEndPoint(_host, _port); var socket = new Socket(_host.AddressFamily, SocketType.Stream, ProtocolType.Tcp); socket.Connect(remoteEp); _connection = new Connection.Connection(socket, settings); _connection.NewASdu = NewASdu ?? null; _connection.ConnectionClosed = ConnectionClosed ?? null; _connection.StartDataTransfer(); } catch (Exception e) { throw new IOException(e.Message); } }
public override void Run() { Connection.Connection serverConnection = new Connection.Connection(_socket, _settings); serverConnection.WaitForStartDT(); }