//Helper Methods private bool GET_CURRENTLY_SELECTED_RECIPE_DATA(out RECIPE_DATA DATA) //Gets the record currently selected in the DGV. { EVENTS.LOG_MESSAGE(1, "ENTER"); DATA = new RECIPE_DATA(); try { int SELECTED_INDEX = DGV_RECIPE_TABLE.SelectedRows[0].Index; DATA.part_number = RECIPE_TABLE_LOCAL.Rows[SELECTED_INDEX]["part_number"].ToString(); DATA.checksheet_type = RECIPE_TABLE_LOCAL.Rows[SELECTED_INDEX]["checksheet_type"].ToString(); DATA.csv_location = RECIPE_TABLE_LOCAL.Rows[SELECTED_INDEX]["csv_location"].ToString(); DATA.key_sequence = RECIPE_TABLE_LOCAL.Rows[SELECTED_INDEX]["key_sequence"].ToString(); DATA.timestamp_col = int.Parse(RECIPE_TABLE_LOCAL.Rows[SELECTED_INDEX]["timestamp_col"].ToString()); DATA.a_col = int.Parse(RECIPE_TABLE_LOCAL.Rows[SELECTED_INDEX]["a_col"].ToString()); DATA.b_col = int.Parse(RECIPE_TABLE_LOCAL.Rows[SELECTED_INDEX]["b_col"].ToString()); DATA.c_col = int.Parse(RECIPE_TABLE_LOCAL.Rows[SELECTED_INDEX]["c_col"].ToString()); DATA.d_col = int.Parse(RECIPE_TABLE_LOCAL.Rows[SELECTED_INDEX]["d_col"].ToString()); DATA.e_col = int.Parse(RECIPE_TABLE_LOCAL.Rows[SELECTED_INDEX]["e_col"].ToString()); DATA.f_col = int.Parse(RECIPE_TABLE_LOCAL.Rows[SELECTED_INDEX]["f_col"].ToString()); DATA.g_col = int.Parse(RECIPE_TABLE_LOCAL.Rows[SELECTED_INDEX]["g_col"].ToString()); DATA.h_col = int.Parse(RECIPE_TABLE_LOCAL.Rows[SELECTED_INDEX]["h_col"].ToString()); DATA.i_col = int.Parse(RECIPE_TABLE_LOCAL.Rows[SELECTED_INDEX]["i_col"].ToString()); DATA.j_col = int.Parse(RECIPE_TABLE_LOCAL.Rows[SELECTED_INDEX]["j_col"].ToString()); DATA.k_col = int.Parse(RECIPE_TABLE_LOCAL.Rows[SELECTED_INDEX]["k_col"].ToString()); DATA.l_col = int.Parse(RECIPE_TABLE_LOCAL.Rows[SELECTED_INDEX]["l_col"].ToString()); DATA.m_col = int.Parse(RECIPE_TABLE_LOCAL.Rows[SELECTED_INDEX]["m_col"].ToString()); EVENTS.LOG_MESSAGE(1, "EXIT_SUCCESS"); return(true); } catch (Exception EX) { EVENTS.LOG_MESSAGE(2, "EXCEPTION", EX.Message); EVENTS.LOG_MESSAGE(1, "EXIT_FAIL"); return(false); } }
protected void Notify(GameObject actor, EVENTS e) { for (var i = 0; i < Observers.Count; i++) { Observers[i].OnNotify(actor, e); } }
private string CREATE_MODIFY_RECORD_STRING() //Creates the command string for modifying a record. { EVENTS.LOG_MESSAGE(1, "ENTER"); string PART1 = "UPDATE " + Properties.DB.Default.RECIPE_TABLE; string PART2 = " SET " + "part_number = ?part_number, " + "checksheet_type = ?checksheet_type, " + "key_sequence = ?key_sequence, " + "csv_location = ?csv_location, " + "timestamp_col = ?timestamp_col, " + "a_col = ?a_col, " + "b_col = ?b_col, " + "c_col = ?c_col, " + "d_col = ?d_col, " + "e_col = ?e_col, " + "f_col = ?f_col, " + "g_col = ?g_col, " + "h_col = ?h_col, " + "i_col = ?i_col, " + "j_col = ?j_col, " + "k_col = ?k_col, " + "l_col = ?l_col, " + "m_col = ?m_col"; string PART3 = " WHERE part_number = ?part_number AND checksheet_type = ?checksheet_type;"; string COMMAND_STRING = PART1 + PART2 + PART3; EVENTS.LOG_MESSAGE(1, "EXIT_SUCCESS"); return(COMMAND_STRING); }
/// <summary> /// Insert event /// </summary> /// <param name="oEventViewModel"></param> /// <returns>Response</returns> public Response oInsertEvent(EventViewModel oEventViewModel) { #region ": Insert :" Response oResponse = new Response(); try { if (oEventViewModel != null) { EVENTS oEvent = new EVENTS() { APPLICATION_ID = oEventViewModel.APPLICATION_ID, EVENT_NAME = oEventViewModel.EVENT_NAME, EVENT_DESCRIPTION = oEventViewModel.EVENT_DESCRIPTION, EVENT_DATE = oEventViewModel.EVENT_DATE, EVENT_LOCATION_NAME = oEventViewModel.EVENT_LOCATION_NAME, EVENT_LATITUDE = oEventViewModel.EVENT_LATITUDE, EVENT_LONGITUDE = oEventViewModel.EVENT_LONGITUDE, IS_ACTIVE = oEventViewModel.IS_ACTIVE, IS_NOTIFY_USER = oEventViewModel.IS_NOTIFY_USER, LANGUAGE_ID = oEventViewModel.LANGUAGE_ID, CREATED_BY = oEventViewModel.CREATED_BY, CREATED_DATE = DateTime.Now }; if (!oEventViewModel.EVENT_IMG_FILE_PATH.Equals(string.Empty)) { oEvent.EVENT_IMG_FILE_PATH = oEventViewModel.EVENT_IMG_FILE_PATH; } if (oEventViewModel.EVENT_CATEGORY_ID != -99) { oEvent.EVENT_CATEGORY_ID = oEventViewModel.EVENT_CATEGORY_ID; } this.oTakamulConnection.EVENTS.Add(oEvent); if (this.intCommit() > 0) { oResponse.OperationResult = enumOperationResult.Success; oResponse.ResponseCode = Convert.ToString(oEvent.ID); } else { oResponse.OperationResult = enumOperationResult.Faild; oResponse.ResponseCode = ""; } } } catch (Exception Ex) { oResponse.OperationResult = enumOperationResult.Faild; //TODO : Log Error Message oResponse.OperationResultMessage = Ex.Message.ToString(); } return(oResponse); #endregion }
public void eventDone(EVENTS ev) { if (_tutorial != null) { _tutorial.eventDone(ev); } }
//PsuedoConstructor private void DB_SETUP() //Called in the actual form constructor, broken off for organization. { EVENTS.LOG_MESSAGE(1, "ENTER"); DB.CONNECTION_CHANGED += new EventHandler(CONNECTION_CHANGED); //Add a form level event handler for connection state change. DGV_RECIPE_TABLE.SelectionChanged += new EventHandler(DGV_SELECTION_CHANGED); //Checks if a recipe is selected. CONNECTION_CHANGED(null, new MYSQL_COMS.CONNECTION_CHANGED_EVENT_ARGS(false)); //Call the connection state change function but force a disconnected state. EVENTS.LOG_MESSAGE(1, "EXIT_SUCCESS"); }
public void OnNotify(GameObject actor, EVENTS e) { switch (e) { case EVENTS.PLAYER_JUMPED: HandlePlayerJump(); break; case EVENTS.PLAYER_FIRED: HandlePlayerFire(); break; } }
private void SendCommand(EVENTS sendingEvent, uint data = 0) { try { simconnect?.TransmitClientEvent(SimConnect.SIMCONNECT_OBJECT_ID_USER, sendingEvent, data, GROUPID.MAX, SIMCONNECT_EVENT_FLAG.GROUPID_IS_PRIORITY); } catch (COMException ex) when(ex.Message == "0xC00000B0") { RecoverFromError(ex); } }
private void GENERATE_PARAMETERS(RECIPE_DATA DATA, out SQL_PARAMETER[] PARAMS) //Populates the parameters structure used in SQL commands. { EVENTS.LOG_MESSAGE(1, "ENTER"); //Create the parameter array we're going to pass to the EXECUTE_COMMAND function. PARAMS = new SQL_PARAMETER[18]; for (int i = 0; i < PARAMS.Length; i++) //Since this is an array of a custom type, loop through and initialize each element... { PARAMS[i] = new SQL_PARAMETER(); } //Define the escape strings. These are the strings that will subsitute in data in the COMMAND_STRING. PARAMS[0].ESCAPE_STRING = "?part_number"; PARAMS[1].ESCAPE_STRING = "?checksheet_type"; PARAMS[2].ESCAPE_STRING = "?key_sequence"; PARAMS[3].ESCAPE_STRING = "?csv_location"; PARAMS[4].ESCAPE_STRING = "?timestamp_col"; PARAMS[5].ESCAPE_STRING = "?a_col"; PARAMS[6].ESCAPE_STRING = "?b_col"; PARAMS[7].ESCAPE_STRING = "?c_col"; PARAMS[8].ESCAPE_STRING = "?d_col"; PARAMS[9].ESCAPE_STRING = "?e_col"; PARAMS[10].ESCAPE_STRING = "?f_col"; PARAMS[11].ESCAPE_STRING = "?g_col"; PARAMS[12].ESCAPE_STRING = "?h_col"; PARAMS[13].ESCAPE_STRING = "?i_col"; PARAMS[14].ESCAPE_STRING = "?j_col"; PARAMS[15].ESCAPE_STRING = "?k_col"; PARAMS[16].ESCAPE_STRING = "?l_col"; PARAMS[17].ESCAPE_STRING = "?m_col"; //Define all the data that ties to the escape strings. PARAMS[0].STRING_TO_INSERT = DATA.part_number; PARAMS[1].STRING_TO_INSERT = DATA.checksheet_type; PARAMS[2].STRING_TO_INSERT = DATA.key_sequence; PARAMS[3].STRING_TO_INSERT = DATA.csv_location; PARAMS[4].STRING_TO_INSERT = DATA.timestamp_col.ToString(); PARAMS[5].STRING_TO_INSERT = DATA.a_col.ToString(); PARAMS[6].STRING_TO_INSERT = DATA.b_col.ToString(); PARAMS[7].STRING_TO_INSERT = DATA.c_col.ToString(); PARAMS[8].STRING_TO_INSERT = DATA.d_col.ToString(); PARAMS[9].STRING_TO_INSERT = DATA.e_col.ToString(); PARAMS[10].STRING_TO_INSERT = DATA.f_col.ToString(); PARAMS[11].STRING_TO_INSERT = DATA.g_col.ToString(); PARAMS[12].STRING_TO_INSERT = DATA.h_col.ToString(); PARAMS[13].STRING_TO_INSERT = DATA.i_col.ToString(); PARAMS[14].STRING_TO_INSERT = DATA.j_col.ToString(); PARAMS[15].STRING_TO_INSERT = DATA.k_col.ToString(); PARAMS[16].STRING_TO_INSERT = DATA.l_col.ToString(); PARAMS[17].STRING_TO_INSERT = DATA.m_col.ToString(); EVENTS.LOG_MESSAGE(1, "EXIT_SUCCESS"); }
//Button Driven Methods private void CONNECT_TO_DB(object sender, EventArgs e) //Connect to the database. { EVENTS.LOG_MESSAGE(1, "ENTER"); int RESULT = DB.CONNECT_TO_DB(); //Attempt to connect to the db using the constructor parameters from initialization. if (RESULT == 0) //If the connection was successful... { UPDATE_TABLE(null, null); //Update the local table and the DGV. } else //If the connection was not successful... { EVENTS.LOG_MESSAGE(1, "EXIT_FAIL"); return; } EVENTS.LOG_MESSAGE(1, "EXIT_SUCCESS"); }
/// <summary> /// This function attempts to safely cast a DataGridViews source into a DataTable. /// </summary> /// <param name="DGV">The DGV to get the data from.</param> /// <param name="DATA_TABLE">A DataTable to bind to.</param> /// <returns>True on success, false on failure.</returns> public static bool EXTRACT_DATA_TABLE_FROM_DGV(ref DataGridView DGV, ref DataTable DATA_TABLE) { EVENTS.LOG_MESSAGE(1, "ENTER"); try { DATA_TABLE = (DataTable)DGV.DataSource; } catch (InvalidCastException EX) { EVENTS.LOG_MESSAGE(2, "EXCEPTION", EX.Message); EVENTS.LOG_MESSAGE(1, "EXIT_FAIL"); return(false); } EVENTS.LOG_MESSAGE(2, "EXIT_SUCCESS"); return(true); }
private void ADD_EDIT_RECIPE(object sender, EventArgs e) //Both the "Add Recipe" button and the "Edit Recipe" button call this. { EVENTS.LOG_MESSAGE(1, "ENTER"); //Check if form is open. FormCollection COLLECTION = Application.OpenForms; //Get a collection of all the open forms. foreach (Form FORM in COLLECTION) //Go through each open form... { if (FORM.Name == "FORM_ADD_RECIPE") //If the evaluated form has the same name as the form we're about to open... { FORM.BringToFront(); //Bring the form to the front. EVENTS.LOG_MESSAGE(2, "Form already open."); EVENTS.LOG_MESSAGE(1, "EXIT_FAIL"); return; //Exit. } } //Get the listings of checksheet types from the SQL DB, this will be used to populate a list box on the new form. DataTable CHECKSHEET_DATA = DB.GET_TABLE(Properties.DB.Default.CHECKSHEET_TABLE, Properties.DB.Default.CHECKSHEET_TABLE_COLUMN_SCHEMA); //Get the checksheet data listing to pass over to the form. //Determine if the edit button is what called this method. If it is, we have to get the currently selected recipe. if ((Button)sender == BTN_EDIT_RECIPE) //Cast the sender into a button type and check if it is BTN_EDIT. If it is... { RECIPE_DATA CURRENT_RECORD = new RECIPE_DATA(); //Create a blank RECIPE_DATA object. bool SUCCESS = GET_CURRENTLY_SELECTED_RECIPE_DATA(out CURRENT_RECORD); //Populate the object and store if it was a success. Function will return true on success. if (SUCCESS) { var ADD_FORM = new FORM_ADD_RECIPE(CHECKSHEET_DATA, CURRENT_RECORD); //Create a new form with optional CURRENT_RECORD attached. //FORM_ADD_RECIPE recognizes optional record attachment as a request to edit rather than add. ADD_FORM.Show(); //Show the form. ADD_FORM.DATA_READY += new EventHandler(PROCESS_ADD_RECIPE_DATA); //Add handler for when the form has its data all set. } else //If getting data was unsuccessful... { EVENTS.LOG_MESSAGE(1, "EXIT_FAIL"); return; } } else { var ADD_FORM = new FORM_ADD_RECIPE(CHECKSHEET_DATA); //Create a blank form. ADD_FORM.Show(); //Show the form. ADD_FORM.DATA_READY += new EventHandler(PROCESS_ADD_RECIPE_DATA); //Add handler for when the form has its data all set. } EVENTS.LOG_MESSAGE(1, "EXIT_SUCCESS"); }
//Simple string/structure generators, moved into own functions for readability. private string CREATE_ADD_RECORD_STRING(RECIPE_DATA DATA, SQL_PARAMETER[] PARAMS) //Creates the command string for adding a new record. { EVENTS.LOG_MESSAGE(1, "ENTER"); //Define where we're going to insert data. string INSERT_LOCATION = "INSERT INTO " + Properties.DB.Default.RECIPE_TABLE + " (" + "part_number," + "checksheet_type," + "key_sequence," + "csv_location," + "timestamp_col," + "a_col," + "b_col," + "c_col," + "d_col," + "e_col," + "f_col," + "g_col," + "h_col," + "i_col," + "j_col," + "k_col," + "l_col," + "m_col" + ") "; //Create the second part of the command string. string INSERT_DATA = "VALUES("; for (int i = 0; i < PARAMS.Length; i++) { INSERT_DATA += PARAMS[i].ESCAPE_STRING + ","; } INSERT_DATA = INSERT_DATA.TrimEnd(','); INSERT_DATA += ")"; //Construct the command. string COMMAND_STRING = INSERT_LOCATION + INSERT_DATA; //Combine the strings together. EVENTS.LOG_MESSAGE(1, "EXIT_SUCCESS"); return(COMMAND_STRING); }
private void UPDATE_TABLE(object sender, EventArgs e) //Updates local table and view. { EVENTS.LOG_MESSAGE(1, "ENTER"); RECIPE_TABLE_LOCAL = DB.GET_TABLE(Properties.DB.Default.RECIPE_TABLE, Properties.DB.Default.RECIPE_TABLE_COLUMN_SCHEMA); DGV_RECIPE_TABLE.DataSource = RECIPE_TABLE_LOCAL; DGV_RECIPE_TABLE.SelectionMode = DataGridViewSelectionMode.FullRowSelect; DGV_RECIPE_TABLE.MultiSelect = false; DGV_RECIPE_TABLE.RowHeadersVisible = false; DGV_RECIPE_TABLE.AllowUserToAddRows = false; DGV_RECIPE_TABLE.AllowUserToDeleteRows = false; DGV_RECIPE_TABLE.AllowUserToResizeRows = false; DGV_RECIPE_TABLE.AllowUserToOrderColumns = false; DGV_RECIPE_TABLE.AllowUserToResizeColumns = false; DGV_RECIPE_TABLE.ReadOnly = true; try { foreach (DataGridViewColumn COLUMN in DGV_RECIPE_TABLE.Columns) //Go through each column... { COLUMN.Visible = false; //Make the column invisible. } DGV_RECIPE_TABLE.Columns["part_number"].HeaderText = "Part Number"; DGV_RECIPE_TABLE.Columns["part_number"].Visible = true; //Turn the visibility of this column back on. DGV_RECIPE_TABLE.Columns["part_number"].Width = 70; DGV_RECIPE_TABLE.Columns["part_number"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.BottomCenter; DGV_RECIPE_TABLE.Columns["part_number"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; DGV_RECIPE_TABLE.Columns["checksheet_type"].HeaderText = "Check Type"; DGV_RECIPE_TABLE.Columns["checksheet_type"].Visible = true; //Turn the visibility of this column back on. DGV_RECIPE_TABLE.Columns["checksheet_type"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; DGV_RECIPE_TABLE.Columns["checksheet_type"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.BottomCenter; } catch (Exception EX) { EVENTS.LOG_MESSAGE(2, "EXCEPTION", EX.Message); EVENTS.LOG_MESSAGE(1, "EXIT_FAIL"); } EVENTS.LOG_MESSAGE(1, "EXIT_SUCCESS"); }
static void EventHandler(EVENTS myEvent) { Object thisLock = new Object(); lock (thisLock) { switch (myEvent) { case EVENTS.EVENT1: break; case EVENTS.EVENT2: break; case EVENTS.EVENT3: break; case EVENTS.EVENT4: break; } } }
private void DELETE_RECORD(object sender, EventArgs e) //Deletes the selected record. { EVENTS.LOG_MESSAGE(1, "ENTER"); DataGridViewRow ROW = new DataGridViewRow(); try { ROW = DGV_RECIPE_TABLE.SelectedRows[0]; } catch (Exception EX) { EVENTS.LOG_MESSAGE(2, "EXCEPTION", EX.Message); EVENTS.LOG_MESSAGE(1, "EXIT_FAIL"); return; } DialogResult WARNING = MessageBox.Show("Are you sure you wish to delete the selected record? This action cannot be undone.", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (WARNING == DialogResult.No) { EVENTS.LOG_MESSAGE(1, "EXIT_FAIL"); return; } int ROW_ID; bool SUCCESS = int.TryParse(ROW.Cells["id"].Value.ToString(), out ROW_ID); if (!SUCCESS) { EVENTS.LOG_MESSAGE(2, "Could not parse out row ID."); EVENTS.LOG_MESSAGE(1, "EXIT_FAIL"); return; } string COMMAND_STRING = "DELETE FROM " + Properties.DB.Default.RECIPE_TABLE + " WHERE id=" + ROW_ID + ";"; DB.EXECUTE_COMMAND(COMMAND_STRING); UPDATE_TABLE(null, null); }
public void SendEvent(EVENTS e) { m_oSimConnect.TransmitClientEvent(1, e, 0, NOTIFICATION_GROUPS.Group0, SIMCONNECT_EVENT_FLAG.GROUPID_IS_PRIORITY); Log("Sent " + EVENTS_TO_EVENTID[e]); }
public static IObservable <T> Get <T>() => EVENTS.OfType <T>().AsObservable().ObserveOn(Scheduler.Default);
public static IDisposable AddSource <T>(IObservable <T> source) => source.Subscribe(obj => EVENTS.OnNext(obj));
/// <summary> /// Update event /// </summary> /// <param name="oEventViewModel"></param> /// <returns>Response</returns> public Response oUpdateEvent(EventViewModel oEventViewModel) { Response oResponse = new Response(); #region Try Block try { // Start try #region Check oEventViewModel Value EVENTS oEvent = new EVENTS(); oEvent = this.oTakamulConnection.EVENTS.Find(oEventViewModel.ID); if (oEvent == null) { throw new ArgumentNullException("oEvent Entity Is Null"); } #endregion #region Update Default EVENTS oEvent.APPLICATION_ID = oEventViewModel.APPLICATION_ID; oEvent.EVENT_NAME = oEventViewModel.EVENT_NAME; oEvent.EVENT_DESCRIPTION = oEventViewModel.EVENT_DESCRIPTION; oEvent.EVENT_DATE = oEventViewModel.EVENT_DATE; oEvent.EVENT_LOCATION_NAME = oEventViewModel.EVENT_LOCATION_NAME; oEvent.EVENT_LATITUDE = oEventViewModel.EVENT_LATITUDE; oEvent.EVENT_LONGITUDE = oEventViewModel.EVENT_LONGITUDE; oEvent.IS_ACTIVE = oEventViewModel.IS_ACTIVE; oEvent.IS_NOTIFY_USER = oEventViewModel.IS_NOTIFY_USER; if (!oEventViewModel.EVENT_IMG_FILE_PATH.Equals(string.Empty)) { oEvent.EVENT_IMG_FILE_PATH = oEventViewModel.EVENT_IMG_FILE_PATH; } oEvent.MODIFIED_BY = oEventViewModel.CREATED_BY; oEvent.MODIFIED_DATE = DateTime.Now; if (oEventViewModel.EVENT_CATEGORY_ID != -99) { oEvent.EVENT_CATEGORY_ID = oEventViewModel.EVENT_CATEGORY_ID; } else { oEvent.EVENT_CATEGORY_ID = null; } this.EventsDBSet.Attach(oEvent); this.oTakamulConnection.Entry(oEvent).State = EntityState.Modified; if (this.intCommit() > 0) { oResponse.OperationResult = enumOperationResult.Success; } else { oResponse.OperationResult = enumOperationResult.Faild; } #endregion }// End try #endregion #region Catch Block catch (Exception Ex) {// Start Catch oResponse.OperationResult = enumOperationResult.Faild; //TODO : Log Error Message oResponse.OperationResultMessage = Ex.Message.ToString(); }//End Catch #endregion return(oResponse); }
public static IDisposable AddTransformation <T, U>(Func <T, U> func) => Get <T>().Subscribe(it => EVENTS.OnNext(func(it)));
public static void Publish <T>(T ev) => EVENTS.OnNext(ev);
public string Sync(string HCCU_ID, string HCCU_MAC_ID, string EXECORDER_EP_ID_PAKG, string EVENT_ID_Collection, string TRANS_PAKG, string REQLOGS_PAKG, string SK) { string[,] p = new string[2, 6]; p[0, 0] = "HCCU_ID"; p[1, 0] = HCCU_ID; p[0, 1] = "HCCU_MAC_ID"; p[1, 1] = HCCU_MAC_ID; p[0, 2] = "EXECORDER_EP_ID_PAKG"; p[1, 2] = EXECORDER_EP_ID_PAKG; p[0, 3] = "EVENT_ID_Collection"; p[1, 3] = EVENT_ID_Collection; p[0, 4] = "TRANS_PAKG"; p[1, 4] = TRANS_PAKG; p[0, 5] = "REQLOGS_PAKG"; p[1, 5] = REQLOGS_PAKG; if (!COS_SECURITY_TOOL.SECURITY_RequestDecrypt(p, SK)) { return(COS_SECURITY_TOOL.SECURITY_ContentEncrypt("-4")); } /* * SYNC_HCCU_EP_INFO * * */ #region output:return_sync_hccu_ep_info HCCU _HCCU = new HCCU(); string para = "HCCU_ID=" + HCCU_ID + "&HCCU_MAC=" + HCCU_MAC_ID; string sk = COS_SECURITY_TOOL.SECURITY_RequestEncrypt(para); string return_sync_hccu_ep_info = _HCCU.HCCU_EP_Get_Info(HCCU_ID, HCCU_MAC_ID, sk); return_sync_hccu_ep_info = "<SYNC_HCCU_EP_INFO>" + return_sync_hccu_ep_info + "</SYNC_HCCU_EP_INFO>"; #endregion /* * SYNC_EXECORDER * * */ #region output:return_sync_exec_order EXEC_ORDER _EXEC_ORDER = new EXEC_ORDER(); string return_sync_exec_order = ""; if (EXECORDER_EP_ID_PAKG != "") { string[] EXECORDER_EP_ID_PAKG_ARRAY = EXECORDER_EP_ID_PAKG.Split('|'); for (int x = 0; x < EXECORDER_EP_ID_PAKG_ARRAY.Length; x++) { if (EXECORDER_EP_ID_PAKG_ARRAY[x] != "") { string[] EXECORDER_EP_ID_PAKG_SINGLE_ARRAY = EXECORDER_EP_ID_PAKG_ARRAY[x].Split(','); return_sync_exec_order += _EXEC_ORDER.EXEC_ORDER_Get(EXECORDER_EP_ID_PAKG_SINGLE_ARRAY[0], EXECORDER_EP_ID_PAKG_SINGLE_ARRAY[1]) + "^"; } } return_sync_exec_order = "<SYNC_EXECORDER>" + return_sync_exec_order + "</SYNC_EXECORDER>"; } else { return_sync_exec_order = "<SYNC_EXECORDER></SYNC_EXECORDER>"; } #endregion /* * SYNC_EP_EVENTS * * */ #region output:return_sync_events EVENTS _EVENTS = new EVENTS(); string para3 = "HCCU_ID=" + HCCU_ID; string sk3 = COS_SECURITY_TOOL.SECURITY_RequestEncrypt(para3); string return_sync_events = _EVENTS.EVENTS_Sync(HCCU_ID, sk3); return_sync_events = "<SYNC_EVENTS>" + return_sync_events + "</SYNC_EVENTS>"; #endregion /* * UPLOAD: SYNC_NOTIFYEVENTUPDATE(1,-1,-2,-4) * * * */ #region output:return_sync_notifyeventupdate string para35 = "EVENT_ID_Collection=" + EVENT_ID_Collection; string sk35 = COS_SECURITY_TOOL.SECURITY_RequestEncrypt(para35); string return_sync_notifyeventupdate = _EVENTS.NotifyEventUpdate(EVENT_ID_Collection, sk35); return_sync_notifyeventupdate = "<SYNC_NOTIFYEVENTUPDATE>" + return_sync_notifyeventupdate + "</SYNC_NOTIFYEVENTUPDATE>"; #endregion /* * SYNC_PROP * * */ #region output:return_sync_prop PROP _PROP = new PROP(); string para4 = "HCCU_ID=" + HCCU_ID; string sk4 = COS_SECURITY_TOOL.SECURITY_RequestEncrypt(para4); string return_sync_prop = _PROP.EP_PROPERTYFACT_Sync(HCCU_ID, sk4); return_sync_prop = "<SYNC_PROP>" + return_sync_prop + "</SYNC_PROP>"; #endregion /* * UPLOAD: SYNC_TRANS(1,-1,-2,-4) * * */ #region output:return_sync_trans string return_sync_trans = ""; TRANS _TRANS = new TRANS(); if (TRANS_PAKG.Trim() != "") { string[] TRANS_PAKG_ARRAY = TRANS_PAKG.Split('|'); for (int x = 0; x < TRANS_PAKG_ARRAY.Length; x++) { if (TRANS_PAKG_ARRAY[x] != "") { string[] TRANS_PAKG_SINGLE_ARRAY = TRANS_PAKG_ARRAY[x].Split(','); return_sync_trans += _TRANS.TRANS_Add(TRANS_PAKG_SINGLE_ARRAY[0], TRANS_PAKG_SINGLE_ARRAY[1], TRANS_PAKG_SINGLE_ARRAY[2], TRANS_PAKG_SINGLE_ARRAY[3], TRANS_PAKG_SINGLE_ARRAY[4]) + ","; } } return_sync_trans = "<SYNC_TRANS>" + return_sync_trans + "</SYNC_TRANS>"; } else { return_sync_trans = "<SYNC_TRANS></SYNC_TRANS>"; } #endregion /* * UPLOAD: SYNC_REQLOGS(1,-1,-2,-4) * * */ #region output:return_sync_requestlogs string return_sync_requestlogs = ""; REQUESTLOGS _REQUESTLOGS = new REQUESTLOGS(); if (REQLOGS_PAKG.Trim() != "") { string[] REQLOGS_PAKG_ARRAY = REQLOGS_PAKG.Split('|'); for (int x = 0; x < REQLOGS_PAKG_ARRAY.Length; x++) { if (REQLOGS_PAKG_ARRAY[x] != "") { string[] REQLOGS_PAKG_SINGLE_ARRAY = REQLOGS_PAKG_ARRAY[x].Split(','); return_sync_requestlogs += _REQUESTLOGS.REQUESTLOGS_Add(REQLOGS_PAKG_SINGLE_ARRAY[0], REQLOGS_PAKG_SINGLE_ARRAY[1], REQLOGS_PAKG_SINGLE_ARRAY[2], REQLOGS_PAKG_SINGLE_ARRAY[3], REQLOGS_PAKG_SINGLE_ARRAY[4], REQLOGS_PAKG_SINGLE_ARRAY[5], REQLOGS_PAKG_SINGLE_ARRAY[6]) + ","; } } return_sync_requestlogs = "<SYNC_REQLOGS>" + return_sync_requestlogs + "</SYNC_REQLOGS>"; } else { return_sync_requestlogs = "<SYNC_REQLOGS></SYNC_REQLOGS>"; } #endregion return(return_sync_hccu_ep_info + return_sync_exec_order + return_sync_events + return_sync_notifyeventupdate + return_sync_prop + return_sync_trans + return_sync_requestlogs); }
private void DISCONNECT_FROM_DB(object sender, EventArgs e) //Disconnect from the database. { EVENTS.LOG_MESSAGE(1, "ENTER"); DB.DISCONNECT_FROM_DB(); //Disconnect from DB. There are no exceptions or errors thrown by this call. Kind of a blind shot. EVENTS.LOG_MESSAGE(1, "EXIT_SUCCESS"); }
private void button1_Click(object sender, EventArgs e) { EVENTS.LOG_MESSAGE(1, "ENTER"); //Get the currently selected recipe data. RECIPE_DATA DATA = new RECIPE_DATA(); GET_CURRENTLY_SELECTED_RECIPE_DATA(out DATA); //Process the key sequence from the recipe into a list and table. SEQUENCE_LIST.Clear(); SEQUENCE_DATATABLE.Clear(); BACKEND.LOAD_IN_KEY_SEQUENCE(DATA.key_sequence, ref SEQUENCE_LIST, ref SEQUENCE_DATATABLE); //Get data from file. TABLE_PROCESSOR KEYENCE_PROCESSOR = new TABLE_PROCESSOR(); DataTable TABLE = new DataTable(); DataTable INSTRUCTIONS = INSTRUCTION_SET.CREATE_INSTRUCTION_TABLE(); KEYENCE_PROCESSOR.PROCESS_INSTRUCTIONS(ref TABLE, ref INSTRUCTIONS, DATA.csv_location, ','); //Label the columns. BACKEND.LABEL_DATATABLE_COLUMNS(ref TABLE, DATA); //Check the timestamp. string TIME_STRING = null; for (int i = TABLE.Rows.Count - 1; i >= 0; i--) { TIME_STRING = TABLE.Rows[i][DATA.timestamp_col].ToString(); if (TIME_STRING != "" && TIME_STRING != null) { break; } } DateTime TIME = DateTime.Parse(TIME_STRING); TimeSpan TIME_AGO = DateTime.Now.Subtract(TIME); if (TIME_AGO.TotalHours > 1) { string MESSAGE = string.Format("The last entry detected is {0} Days, {1} Hours and {2} Minutes old. Are you sure this is correct?", TIME_AGO.Days, TIME_AGO.Hours, TIME_AGO.Minutes); if (MessageBox.Show(MESSAGE, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return; } } FORM_REPLAY NEW_FORM = new FORM_REPLAY(); NEW_FORM.Show(); NEW_FORM.TopMost = true; //Fill out the injection table. BACKEND.MOVE_CSV_DATA_INTO_INJECTION_TABLE(TABLE, INJECTION_TABLE); //Start the keylogger. REPLAY_SEQUENCE_START(null, null); EVENTS.LOG_MESSAGE(1, "EXIT_SUCCESS"); }
private void PROCESS_ADD_RECIPE_DATA(object sender, EventArgs e) //Called once the FORM_ADD_RECIPE is ready to submit. { EVENTS.LOG_MESSAGE(1, "ENTER"); //Extract data out of arguments and build query string. var DATA = (RECIPE_DATA)e; //Specify the exact type of EventArgs. //Create an array of SQL parameters. Since its a custom type we have to recurse through it to fully initialize. var PARAMS = new SQL_PARAMETER[18]; for (int i = 0; i < PARAMS.Length; i++) //Since this is an array of a custom type, loop through and initialize each element... { PARAMS[i] = new SQL_PARAMETER(); } GENERATE_PARAMETERS(DATA, out PARAMS); //Build the command string. string COMMAND_STRING = CREATE_ADD_RECORD_STRING(DATA, PARAMS); //Check to make sure there is no current entry that matches for part number and checksheet type. foreach (DataRow RECORD in RECIPE_TABLE_LOCAL.Rows) { if (RECORD["part_number"].ToString() == DATA.part_number && RECORD["checksheet_type"].ToString() == DATA.checksheet_type) //If there is a record with the same part number and checksheet... { string MESSAGE; MESSAGE = "A recipe for the part number and checksheet type already exists. Would you like to overwrite this recipe?"; DialogResult CHOICE = MessageBox.Show(MESSAGE, "Warning", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); EVENTS.LOG_MESSAGE(2, MESSAGE); if (CHOICE == DialogResult.No) { EVENTS.LOG_MESSAGE(2, "User selected NO."); OK_TO_CLOSE_ADD_RECIPE_FORM?.Invoke(null, null); EVENTS.LOG_MESSAGE(1, "EXIT_FAIL"); return; } if (CHOICE == DialogResult.Cancel) { EVENTS.LOG_MESSAGE(2, "User selected CANCEL."); EVENTS.LOG_MESSAGE(1, "EXIT_FAIL"); return; } EVENTS.LOG_MESSAGE(2, "User selected YES."); COMMAND_STRING = CREATE_MODIFY_RECORD_STRING(); } } OK_TO_CLOSE_ADD_RECIPE_FORM?.Invoke(null, null); //notify the form that its ok to close, we're past the point where a user can cancel. //Issue the command. int RESULT = DB.EXECUTE_COMMAND(COMMAND_STRING, PARAMS); //If a negative 1 is returned, this means failure. if (RESULT == -1) { string MESSAGE; MESSAGE = "EXECUTE_COMMAND method failed. Record was not added. See log for details."; MessageBox.Show(MESSAGE, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); EVENTS.LOG_MESSAGE(2, MESSAGE); EVENTS.LOG_MESSAGE(1, "EXIT_FAIL"); return; } UPDATE_TABLE(null, null); EVENTS.LOG_MESSAGE(1, "EXIT_SUCCESS"); }
public void SubscribeToEvent(EVENTS e) { m_oSimConnect.MapClientEventToSimEvent(e, EVENTS_TO_EVENTID[e]); m_oSimConnect.AddClientEventToNotificationGroup(NOTIFICATION_GROUPS.Group0, e, false); }