public static void UpdateCompletedTransView() { int iIndex; string sQuery; OleDbCommand dbCmd; OleDbDataReader drRecordSet; /* SqlCommand dbCmd; * SqlDataReader drRecordSet;*/ DB.TransStruct myTransStruct; Debug.WriteLine("UPDATE COMPLETE TRANSACTIONS VIEW"); SQL_SERVER.Set_Sql_Server_Conn(); SQL_SERVER.Open_Sql_Server_Conn(); //sQuery = "SELECT COMPLETED_TIME, PIC, PUMP, DEPOSIT, PURCHASE, PRICE, CHANGE, GRADE, VOLUME, SHOW_TIME, TRAN_ID FROM TRANSACTIONS ORDER BY COMPLETED_TIME DESC"; sQuery = "SELECT COMPLETED_TIME, PIC, PUMP, DEPOSIT, PURCHASE, PRICE, GRADE, VOLUME, SHOW_TIME, TRAN_ID,CHANGE FROM TRANSACTIONS ORDER BY COMPLETED_TIME DESC;"; dbCmd = SQL_SERVER.Set_Sql_Server_Cmd(sQuery); drRecordSet = dbCmd.ExecuteReader(); Debug.WriteLine(sQuery); Debug.WriteLine(drRecordSet.HasRows); iCount = 0; DB.lCompletedTrans.Clear(); while (drRecordSet.Read()) { myTransStruct.sPIC = drRecordSet["PIC"].ToString(); myTransStruct.sPump = drRecordSet["PUMP"].ToString(); myTransStruct.sDeposit = drRecordSet["DEPOSIT"].ToString(); myTransStruct.sPurchase = drRecordSet["PURCHASE"].ToString(); myTransStruct.sPrice = drRecordSet["PRICE"].ToString(); myTransStruct.sChange = drRecordSet["CHANGE"].ToString(); myTransStruct.sGrade = drRecordSet["GRADE"].ToString(); myTransStruct.sVolume = drRecordSet["VOLUME"].ToString(); myTransStruct.sShowTime = drRecordSet["SHOW_TIME"].ToString(); myTransStruct.sTranId = drRecordSet["TRAN_ID"].ToString(); DB.lCompletedTrans.Add(myTransStruct); iCount++; } for (iIndex = 0; iIndex < 6; iIndex++) { if (iIndex < iCount) { tv.pump_no.Text = DB.lCompletedTrans[iIndex].sPump.ToString(); Transactions_View.Update_Transactions_ButtonText(iIndex + 1, "PUMP: " + DB.lCompletedTrans[iIndex].sPump + " @ " + DB.lCompletedTrans[iIndex].sShowTime + " PAID: $" + DB.lCompletedTrans[iIndex].sDeposit + " \nCHANGE: $" + DB.lCompletedTrans[iIndex].sChange); } } dbCmd.Dispose(); drRecordSet.Dispose(); SQL_SERVER.Close_Sql_Sever_Conn(); }
private void next_btn_Click(object sender, EventArgs e) { ClearButtonTexts(); ClearSelection(); ClearTransactionsDetails(); int iButtonIndex; int iTranIndex; iPage++; iButtonIndex = 0; for (iTranIndex = (6 * (iPage - 1)); iTranIndex < (6 * iPage); iTranIndex++) { if (iTranIndex < DB.lCompletedTrans.Count) { iButtonIndex++; Transactions_View.Update_Transactions_ButtonText(iButtonIndex, "PUMP: " + DB.lCompletedTrans[iTranIndex].sPump + " @ " + DB.lCompletedTrans[iTranIndex].sShowTime + "\nPAID: $" + DB.lCompletedTrans[iTranIndex].sDeposit + " CHANGE: $" + DB.lCompletedTrans[iTranIndex].sChange); } } if (DB.lCompletedTrans.Count <= 6 * iPage) { ButtonVisibility(next_btn, false); } if (iPage == 2) { ButtonVisibility(previous_btn, true); } }
public static void Update_Transactions_ButtonText(int index, string lbl) { if (index == 1) { Transactions_View.SetButtonText(tv.One, lbl); } if (index == 2) { Transactions_View.SetButtonText(tv.Two, lbl); } if (index == 3) { Transactions_View.SetButtonText(tv.Three, lbl); } if (index == 4) { Transactions_View.SetButtonText(tv.Four, lbl); } if (index == 5) { Transactions_View.SetButtonText(tv.Five, lbl); } if (index == 6) { Transactions_View.SetButtonText(tv.Six, lbl); } }
public Transactions_View() { tv = this; InitializeComponent(); process.Interval = 10000; process.Elapsed += new System.Timers.ElapsedEventHandler(UpdateTrans); process.Start(); create_tran.Visible = false; Authorize.Visible = false; complet.Visible = false; }
public Transactions_View() { tv = this; InitializeComponent(); /*process.Interval = 10000; * process.Elapsed += new System.Timers.ElapsedEventHandler(UpdateTrans); * process.Start();*/ create_tran.Visible = false; Authorize.Visible = false; complet.Visible = false; lbl_arr = new Label[] { tv.btnId1, tv.btnId2, tv.btnId3, tv.btnId4, tv.btnId5, tv.btnId6 }; }
public void SetButton(int index) { Button[] btnarr = new Button[] { One, Two, Three, Four, Five, Six }; foreach (Button btn in btnarr) { if (btn.InvokeRequired) { SetButtonIndex d = new SetButtonIndex(SetButton); tv.Invoke(d, new object[] { }); } else { btn.BackColor = Color.White; } } if (index == 1) { Transactions_View.SetButtonColor(One, Color.Yellow); } if (index == 2) { Transactions_View.SetButtonColor(Two, Color.Yellow); } if (index == 3) { Transactions_View.SetButtonColor(Three, Color.Yellow); } if (index == 4) { Transactions_View.SetButtonColor(Four, Color.Yellow); } if (index == 5) { Transactions_View.SetButtonColor(Five, Color.Yellow); } if (index == 6) { Transactions_View.SetButtonColor(Six, Color.Yellow); } }
public void SetButton(int index) { Button[] btnarr = new Button[] { One, Two, Three, Four, Five, Six }; foreach (Button btn in btnarr) { btn.BackColor = Color.White; } if (index == 1) { Transactions_View.SetButtonColor(One, Color.Yellow); } if (index == 2) { Transactions_View.SetButtonColor(Two, Color.Yellow); } if (index == 3) { Transactions_View.SetButtonColor(Three, Color.Yellow); } if (index == 4) { Transactions_View.SetButtonColor(Four, Color.Yellow); } if (index == 5) { Transactions_View.SetButtonColor(Five, Color.Yellow); } if (index == 6) { Transactions_View.SetButtonColor(Six, Color.Yellow); } }
public Transactions_View() { tv = this; InitializeComponent(); }
private void Refresh_btn_Click(object sender, EventArgs e) { Display.ShowMessageBox("Updated Transactions Data", 3); Transactions_View.UpdateCompletedTransView(); }
private void GetChooseTransations(string datetimeformate) { int iIndex; string sQuery; OleDbCommand dbCmd; OleDbDataReader drRecordSet; /* SqlCommand dbCmd; * SqlDataReader drRecordSet;*/ DB.TransStruct myTransStruct; Debug.WriteLine("UPDATE COMPLETE TRANSACTIONS VIEW"); SQL_SERVER.Set_Sql_Server_Conn(); SQL_SERVER.Open_Sql_Server_Conn(); //sQuery = "SELECT COMPLETED_TIME, PIC, PUMP, DEPOSIT, PURCHASE, PRICE, CHANGE, GRADE, VOLUME, SHOW_TIME, TRAN_ID FROM TRANSACTIONS ORDER BY COMPLETED_TIME DESC"; sQuery = "SELECT COMPLETED_TIME, PIC, PUMP, DEPOSIT, PURCHASE, PRICE, GRADE, VOLUME, SHOW_TIME, TRAN_ID,CHANGE FROM TRANSACTIONS WHERE SHOW_TIME LIKE '%" + datetimeformate + "%' ORDER BY COMPLETED_TIME DESC;"; dbCmd = SQL_SERVER.Set_Sql_Server_Cmd(sQuery); drRecordSet = dbCmd.ExecuteReader(); Debug.WriteLine(sQuery); Debug.WriteLine(drRecordSet.HasRows); if (drRecordSet.HasRows) { iCount = 0; DB.lCompletedTrans.Clear(); ClearButtonTexts(); ClearSelection(); ClearTransactionsDetails(); while (drRecordSet.Read()) { myTransStruct.sPIC = drRecordSet["PIC"].ToString(); myTransStruct.sPump = drRecordSet["PUMP"].ToString(); myTransStruct.sDeposit = drRecordSet["DEPOSIT"].ToString(); myTransStruct.sPurchase = drRecordSet["PURCHASE"].ToString(); myTransStruct.sPrice = drRecordSet["PRICE"].ToString(); myTransStruct.sChange = drRecordSet["CHANGE"].ToString(); myTransStruct.sGrade = drRecordSet["GRADE"].ToString(); myTransStruct.sVolume = drRecordSet["VOLUME"].ToString(); myTransStruct.sShowTime = drRecordSet["SHOW_TIME"].ToString(); myTransStruct.sTranId = drRecordSet["TRAN_ID"].ToString(); DB.lCompletedTrans.Add(myTransStruct); iCount++; } for (iIndex = 0; iIndex < 6; iIndex++) { if (iIndex < iCount) { Transactions_View.Update_Transactions_ButtonText(iIndex + 1, "PUMP: " + DB.lCompletedTrans[iIndex].sPump + " @ " + DB.lCompletedTrans[iIndex].sShowTime + " PAID: $" + DB.lCompletedTrans[iIndex].sDeposit + "\nCHANGE: $" + DB.lCompletedTrans[iIndex].sChange); } } iPage = 1; if (DB.lCompletedTrans.Count <= 6 * iPage) { ButtonVisibility(next_btn, false); } if (DB.lCompletedTrans.Count >= 6 * iPage) { ButtonVisibility(next_btn, true); } if (iPage == 1) { ButtonVisibility(previous_btn, true); } } else { Display.ShowMessageBox("Not Available Selected date Transations \n Showing All Available Transactions", 6); } dbCmd.Dispose(); drRecordSet.Dispose(); SQL_SERVER.Close_Sql_Sever_Conn(); }