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); } }
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(); }