public IActionResult Edit(int id) { string connectionString = @"Data Source=DESKTOP-B3VTHPB\SQLEXPRESS;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False";//Configuration["ConnectionStrings:DefaultConnection"]; cAccount clsAccount = new cAccount(); using (SqlConnection connection = new SqlConnection(connectionString)) { string sql = $"Select * From [DB1].[dbo].[Account] Where ID='{id}'"; SqlCommand command = new SqlCommand(sql, connection); connection.Open(); using (SqlDataReader dataReader = command.ExecuteReader()) { while (dataReader.Read()) { clsAccount.ID = Convert.ToInt32(dataReader["ID"]); clsAccount.Description = Convert.ToString(dataReader["Description"]); } } connection.Close(); } return(View(clsAccount)); }
public void Display() { mUCs p_mucs = mUCs.s_mUCs; p_mucs.HideAll(); p_mucs.m_ucLoggedIn.Left = p_mucs.m_ucLogin.Left; p_mucs.m_ucLoggedIn.Top = p_mucs.m_ucLogin.Top; p_mucs.m_ucLoggedIn.Show(); acc = new mAccount(); Guid?mAccount = acc.accountLoggedIn(); if (mAccount == null || mAccount == Guid.Empty) { } else { cAcc = new cAccount().readById((Guid)mAccount); //Check if should log out TimeSpan ts = DateTime.Now - cAcc.accDT; if (ts.Minutes >= 5) { p_mucs.m_ucLogin.Display(); } mCash mCash = new mCash(); LINuser.Text = cAcc.accUserName; LINbalance.Text = mCash.getBalance(); } }
public IActionResult Create(cAccount clsAccount) { if (ModelState.IsValid) { string connectionString = @"Data Source=DESKTOP-B3VTHPB\SQLEXPRESS;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False";//Configuration["ConnectionStrings:DefaultConnection"]; using (SqlConnection connection = new SqlConnection(connectionString)) { string sql = $"Insert Into [DB1].[dbo].[Account](ID, Description) Values('{clsAccount.ID}', '{clsAccount.Description}')"; using (SqlCommand command = new SqlCommand(sql, connection)) { command.CommandType = CommandType.Text; connection.Open(); command.ExecuteNonQuery(); connection.Close(); } return(RedirectToAction("Index")); } } else { return(View()); } }
public void Init() { m_UCs.SetMessageBox(pan_MessageBox); cAcc = new mAccount().getAccount(); if (cAcc == null) { m_UCs.ShowScreen_Login(); } m_cash = new mCash(); ButtonPCSpendEnable(false); var dict = new Dictionary <string, string>(); var lCat = m_cash.getCategoryList(); dict.Add(pcc_select, "Select Category"); for (int i = 0; i < lCat.Count; i++) { string key = lCat[i].pccKey; string value = lCat[i].pccName; if (String.Compare(key, CashCategory.PCC_CashAdd.ToString(), true) != 0) { dict.Add(key, value); } } PCScombo.DataSource = new BindingSource(dict, null); PCScombo.DisplayMember = "Value"; PCScombo.ValueMember = "Key"; }
public static void TestAccount() { sTick tick = new sTick(); cAccount acct = new cAccount("M:1000.02; L:50; A:0.30;"); // trailstop test tick.Bid = 1.1940; tick.Ask = 1.19415; acct.ReceiveTick(tick); acct.EnterTrade(1); acct.SetStop(0.0005); // 5 pip stop acct.SetTakeProfit(0.0015); // 15 pip take profit acct.SetTrailingStop(0.0003); // 3 pip trailing stop tick.Bid = 1.1945; tick.Ask = 1.19465; acct.ReceiveTick(tick); // tighten trailstop tick.Bid = 1.1943; tick.Ask = 1.19445; acct.ReceiveTick(tick); // this should trigger trailstop // stop test tick.Bid = 1.1940; tick.Ask = 1.19415; acct.ReceiveTick(tick); acct.EnterTrade(1); acct.SetStop(0.0005); // 5 pip stop acct.SetTakeProfit(0.0015); // 15 pip take profit acct.SetTrailingStop(0.0003); // 3 pip trailing stop tick.Bid = 1.1935; tick.Ask = 1.19365; acct.ReceiveTick(tick); // this should trigger stop // take profit test tick.Bid = 1.1940; tick.Ask = 1.19415; acct.ReceiveTick(tick); acct.EnterTrade(1); acct.SetStop(0.0005); // 5 pip stop acct.SetTakeProfit(0.0015); // 15 pip take profit acct.SetTrailingStop(0.0003); // 3 pip trailing stop tick.Bid = 1.19565; tick.Ask = 1.1957; acct.ReceiveTick(tick); // this should trigger take profit }
private void doMainMenuClick(object sender, EventArgs e) { cAcc = new mAccount().getAccount(); if (cAcc == null) { m_UCs.ShowScreen_Login(); } else { m_UCs.ShowScreen_Main(); } }
public void Display() { mUCs p_mucs = mUCs.s_mUCs; p_mucs.HideAll(); p_mucs.m_ucCashAdd.Left = p_mucs.m_ucLogin.Left; p_mucs.m_ucCashAdd.Top = p_mucs.m_ucLogin.Top; p_mucs.m_ucCashAdd.Show(); cAcc = new cAccount().checkLoggedIn(); }
private void đăngXuấtToolStripMenuItem_Click(object sender, EventArgs e) { DialogResult dl = MessageBox.Show("Đăng xuất khỏi ứng dụng?", "Thông báo!", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dl == DialogResult.Yes) { Account = null; isLogin = false; isAdmin = false; Load(); } }
public void Init() { cAcc = new mAccount().getAccount(); if (cAcc == null) { m_UCs.ShowScreen_Login(); } else { mCash mCash = new mCash(); LINuser.Text = cAcc.accUserName; } }
public void Init() { m_UCs.SetMessageBox(pan_MessageBox); cAcc = new mAccount().getAccount(); if (cAcc == null) { m_UCs.ShowScreen_Login(); } else { m_cash = new mCash(); } }
public void Display() { mUCs p_mucs = mUCs.s_mUCs; p_mucs.HideAll(); p_mucs.m_ucCashSpend.Left = p_mucs.m_ucLogin.Left; p_mucs.m_ucCashSpend.Top = p_mucs.m_ucLogin.Top; p_mucs.m_ucCashSpend.Show(); cAcc = new cAccount().checkLoggedIn(); PCScombo.DataSource = spCashSpendCategoryTableAdapter.GetData(); }
public cAccount GetAccount(string username, string pass) { string query = "EXEC GetAccount @UserName , @PassWord"; DataSet ds = db.ExecuteQueryDS(query, CommandType.Text, new object[] { username, pass }); if (ds.Tables[0].Rows.Count == 0) { return(null); } cAccount account = new cAccount(ds.Tables[0].Rows[0]); return(account); }
private void butLogout_Click(object sender, EventArgs e) { mAccount m_account = new mAccount(); cAcc = m_account.getAccount(); if (cAcc != null) { var lr = m_account.doLogout(cAcc.accUserName); if (lr != null) { m_UCs.ShowScreen_Login(); } } }
public List <cAccount> GetListAccount() { List <cAccount> lstAccount = new List <cAccount>(); string query = "EXEC GetListAccount"; DataSet ds = db.ExecuteQueryDS(query, CommandType.Text); DataTable dt = new DataTable(); dt = ds.Tables[0]; foreach (DataRow item in dt.Rows) { cAccount acc = new cAccount(item); lstAccount.Add(acc); } return(lstAccount); }
public IActionResult Edit_Post(cAccount clsAccount) { string connectionString = @"Data Source=DESKTOP-B3VTHPB\SQLEXPRESS;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False";//Configuration["ConnectionStrings:DefaultConnection"]; using (SqlConnection connection = new SqlConnection(connectionString)) { string sql = $"Update [DB1].[dbo].[Account] SET ID='{clsAccount.ID}', Description='{clsAccount.Description}'"; using (SqlCommand command = new SqlCommand(sql, connection)) { connection.Open(); command.ExecuteNonQuery(); connection.Close(); } } return(RedirectToAction("Index")); }
public void Init() { cAcc = new mAccount().getAccount(); if (cAcc == null) { m_UCs.ShowScreen_Login(); } else { m_cash = new mCash(); var lCash = m_cash.doReadList(); for (int i = 0; i < lCash.Count; i++) { dgTransactions.Rows.Add(); dgTransactions.Rows[i].Cells["DateTime"].Value = lCash[i].pcaDT.ToString("dd/MM/yyyy HH:mm"); dgTransactions.Rows[i].Cells["Person"].Value = lCash[i].accUserName; dgTransactions.Rows[i].Cells["Category"].Value = lCash[i].pccName; dgTransactions.Rows[i].Cells["Amount"].Value = lCash[i].pcaAmount.ToString("C2"); } } }
public void Display() { //Simlar to the other display methods ---------------------- mUCs p_mucs = mUCs.s_mUCs; p_mucs.HideAll(); p_mucs.m_ucUserProfile.Left = p_mucs.m_ucLogin.Left; p_mucs.m_ucUserProfile.Top = p_mucs.m_ucLogin.Top; p_mucs.m_ucUserProfile.Show(); acc = new mAccount(); Guid?mAccount = acc.accountLoggedIn(); if (acc == null || mAccount == Guid.Empty) { } else { cAcc = new cAccount().readById((Guid)mAccount); //Check if should log out TimeSpan ts = DateTime.Now - cAcc.accDT; if (ts.Minutes >= 5) { p_mucs.m_ucLogin.Display(); } } //------------------------------------------------------------- p_mucs.m_ucUserProfile.lblFName.Text = cAcc.accFirstName; p_mucs.m_ucUserProfile.lblSName.Text = cAcc.accLastName; p_mucs.m_ucUserProfile.lblUsername.Text = cAcc.accUserName; p_mucs.m_ucUserProfile.lblRoles.Text = string.Empty; if (cAcc.accAccountTypeList != null && cAcc.accAccountTypeList.Count > 0) { p_mucs.m_ucUserProfile.lblRoles.Text = string.Join(", ", cAcc.accAccountTypeList.Select(x => x.actName)); //p_mucs.m_ucUserProfile.lblFName.Text.TrimEnd(new char[] { ' ', ',' }); } //Apologies, without spending a fair amount of time looking into your SQL adapter/connection pattern I don't fully understand how it works. //Normally I use dapper, however rather than start trying to implement that i'm resulting to a very simplistic way of querying. try { var dt = new DataTable(); dt.Columns.Add("EventTime"); dt.Columns.Add("EventType"); using (var connection = new SqlConnection(global::NetTest.Properties.Settings.Default.sitedbConnectionString)) { if (connection.State != ConnectionState.Open) { connection.Open(); } var cmd = new SqlCommand("spGetLoginTimesByAccountId", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@AccountId", cAcc.accId.ToString()); using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { dt.Rows.Add(dr[0], dr[1]); } } p_mucs.m_ucUserProfile.dgLoginAudit.DataSource = dt; } } catch (Exception ex) { //Log error } }