public virtual int UpdateProductionProjectCableFootage(global::System.Nullable <int> TransactionID, global::System.Nullable <int> Footage) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0])); if ((TransactionID.HasValue == true)) { command.Parameters[1].Value = ((int)(TransactionID.Value)); } else { command.Parameters[1].Value = global::System.DBNull.Value; } if ((Footage.HasValue == true)) { command.Parameters[2].Value = ((int)(Footage.Value)); } else { command.Parameters[2].Value = global::System.DBNull.Value; } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } int returnValue; try { returnValue = command.ExecuteNonQuery(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } return(returnValue); }
public virtual int InsertDepartment(string strDepartment, global::System.Nullable <bool> CustomerLines) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0])); if ((strDepartment == null)) { command.Parameters[1].Value = global::System.DBNull.Value; } else { command.Parameters[1].Value = ((string)(strDepartment)); } if ((CustomerLines.HasValue == true)) { command.Parameters[2].Value = ((bool)(CustomerLines.Value)); } else { command.Parameters[2].Value = global::System.DBNull.Value; } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } int returnValue; try { returnValue = command.ExecuteNonQuery(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } return(returnValue); }
public virtual int InsertProductivityToTechPay(global::System.Nullable <int> ProductivityID, global::System.Nullable <int> TechPayID) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0])); if ((ProductivityID.HasValue == true)) { command.Parameters[1].Value = ((int)(ProductivityID.Value)); } else { command.Parameters[1].Value = global::System.DBNull.Value; } if ((TechPayID.HasValue == true)) { command.Parameters[2].Value = ((int)(TechPayID.Value)); } else { command.Parameters[2].Value = global::System.DBNull.Value; } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } int returnValue; try { returnValue = command.ExecuteNonQuery(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } return(returnValue); }
public virtual int spr_AccessgroupMenu_Insert(global::System.Nullable <int> FK_AccessGroupID, global::System.Nullable <int> FK_MenuID) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0])); if ((FK_AccessGroupID.HasValue == true)) { command.Parameters[1].Value = ((int)(FK_AccessGroupID.Value)); } else { command.Parameters[1].Value = global::System.DBNull.Value; } if ((FK_MenuID.HasValue == true)) { command.Parameters[2].Value = ((int)(FK_MenuID.Value)); } else { command.Parameters[2].Value = global::System.DBNull.Value; } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } int returnValue; try { returnValue = command.ExecuteNonQuery(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } return(returnValue); }
public virtual object DEPT(string DEPT1) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0])); if ((DEPT1 == null)) { command.Parameters[1].Value = global::System.DBNull.Value; } else { command.Parameters[1].Value = ((string)(DEPT1)); } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } object returnValue; try { returnValue = command.ExecuteScalar(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } if (((returnValue == null) || (returnValue.GetType() == typeof(global::System.DBNull)))) { return(null); } else { return((object)(returnValue)); } }
public virtual int rptIdCardPrint(string ComId, string Id) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0])); if ((ComId == null)) { command.Parameters[1].Value = global::System.DBNull.Value; } else { command.Parameters[1].Value = ((string)(ComId)); } if ((Id == null)) { command.Parameters[2].Value = global::System.DBNull.Value; } else { command.Parameters[2].Value = ((string)(Id)); } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } int returnValue; try { returnValue = command.ExecuteNonQuery(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } return(returnValue); }
public virtual int ChangeProjectIDEmployeeCrewAssignment(global::System.Nullable <int> OldProjectID, global::System.Nullable <int> NewProjectID) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0])); if ((OldProjectID.HasValue == true)) { command.Parameters[1].Value = ((int)(OldProjectID.Value)); } else { command.Parameters[1].Value = global::System.DBNull.Value; } if ((NewProjectID.HasValue == true)) { command.Parameters[2].Value = ((int)(NewProjectID.Value)); } else { command.Parameters[2].Value = global::System.DBNull.Value; } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } int returnValue; try { returnValue = command.ExecuteNonQuery(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } return(returnValue); }
public virtual int InsertEventLogEntry(global::System.Nullable <global::System.DateTime> datEventDate, string strLogEntry) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0])); if ((datEventDate.HasValue == true)) { command.Parameters[1].Value = ((System.DateTime)(datEventDate.Value)); } else { command.Parameters[1].Value = global::System.DBNull.Value; } if ((strLogEntry == null)) { command.Parameters[2].Value = global::System.DBNull.Value; } else { command.Parameters[2].Value = ((string)(strLogEntry)); } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } int returnValue; try { returnValue = command.ExecuteNonQuery(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } return(returnValue); }
public virtual int UpdateAccountingAssetCurrentValue(global::System.Nullable <int> AssetID, global::System.Nullable <decimal> CurrentValue) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0])); if ((AssetID.HasValue == true)) { command.Parameters[1].Value = ((int)(AssetID.Value)); } else { command.Parameters[1].Value = global::System.DBNull.Value; } if ((CurrentValue.HasValue == true)) { command.Parameters[2].Value = ((decimal)(CurrentValue.Value)); } else { command.Parameters[2].Value = global::System.DBNull.Value; } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } int returnValue; try { returnValue = command.ExecuteNonQuery(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } return(returnValue); }
public virtual int UpdateManagerPosition(global::System.Nullable <int> EmployeeID, global::System.Nullable <bool> IsManager) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0])); if ((EmployeeID.HasValue == true)) { command.Parameters[1].Value = ((int)(EmployeeID.Value)); } else { command.Parameters[1].Value = global::System.DBNull.Value; } if ((IsManager.HasValue == true)) { command.Parameters[2].Value = ((bool)(IsManager.Value)); } else { command.Parameters[2].Value = global::System.DBNull.Value; } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } int returnValue; try { returnValue = command.ExecuteNonQuery(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } return(returnValue); }
public virtual int uspRptInvoice(string LineBLNo, global::System.Nullable <long> InvoiceId) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0])); if ((LineBLNo == null)) { command.Parameters[1].Value = global::System.DBNull.Value; } else { command.Parameters[1].Value = ((string)(LineBLNo)); } if ((InvoiceId.HasValue == true)) { command.Parameters[2].Value = ((long)(InvoiceId.Value)); } else { command.Parameters[2].Value = global::System.DBNull.Value; } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } int returnValue; try { returnValue = command.ExecuteNonQuery(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } return(returnValue); }
public virtual int UpdateVehicleProblemSolved(global::System.Nullable <int> intProblemID, global::System.Nullable <bool> blnProblemSolved) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0])); if ((intProblemID.HasValue == true)) { command.Parameters[1].Value = ((int)(intProblemID.Value)); } else { command.Parameters[1].Value = global::System.DBNull.Value; } if ((blnProblemSolved.HasValue == true)) { command.Parameters[2].Value = ((bool)(blnProblemSolved.Value)); } else { command.Parameters[2].Value = global::System.DBNull.Value; } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } int returnValue; try { returnValue = command.ExecuteNonQuery(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } return(returnValue); }
public virtual int UpdateEmployeeEmailAddress(global::System.Nullable <int> intEmployeeID, string strEmailAddress) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0])); if ((intEmployeeID.HasValue == true)) { command.Parameters[1].Value = ((int)(intEmployeeID.Value)); } else { command.Parameters[1].Value = global::System.DBNull.Value; } if ((strEmailAddress == null)) { command.Parameters[2].Value = global::System.DBNull.Value; } else { command.Parameters[2].Value = ((string)(strEmailAddress)); } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } int returnValue; try { returnValue = command.ExecuteNonQuery(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } return(returnValue); }
public virtual int UpdateHelpDeskTicketCurrentAssignment(global::System.Nullable <int> TransactionID, global::System.Nullable <bool> CurrentAssignment) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0])); if ((TransactionID.HasValue == true)) { command.Parameters[1].Value = ((int)(TransactionID.Value)); } else { command.Parameters[1].Value = global::System.DBNull.Value; } if ((CurrentAssignment.HasValue == true)) { command.Parameters[2].Value = ((bool)(CurrentAssignment.Value)); } else { command.Parameters[2].Value = global::System.DBNull.Value; } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } int returnValue; try { returnValue = command.ExecuteNonQuery(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } return(returnValue); }
public virtual int UpdateToolCost(global::System.Nullable <int> intToolKey, global::System.Nullable <decimal> decToolCost) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0])); if ((intToolKey.HasValue == true)) { command.Parameters[1].Value = ((int)(intToolKey.Value)); } else { command.Parameters[1].Value = global::System.DBNull.Value; } if ((decToolCost.HasValue == true)) { command.Parameters[2].Value = ((decimal)(decToolCost.Value)); } else { command.Parameters[2].Value = global::System.DBNull.Value; } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } int returnValue; try { returnValue = command.ExecuteNonQuery(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } return(returnValue); }
public virtual int spr_User_Password_Update(global::System.Nullable <int> ID, string Password) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[4])); if ((ID.HasValue == true)) { command.Parameters[1].Value = ((int)(ID.Value)); } else { command.Parameters[1].Value = global::System.DBNull.Value; } if ((Password == null)) { command.Parameters[2].Value = global::System.DBNull.Value; } else { command.Parameters[2].Value = ((string)(Password)); } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } int returnValue; try { returnValue = command.ExecuteNonQuery(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } return(returnValue); }
public virtual int UpdateDesignPermitImportNotes(global::System.Nullable <int> TransactionID, string PermitComment) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0])); if ((TransactionID.HasValue == true)) { command.Parameters[1].Value = ((int)(TransactionID.Value)); } else { command.Parameters[1].Value = global::System.DBNull.Value; } if ((PermitComment == null)) { command.Parameters[2].Value = global::System.DBNull.Value; } else { command.Parameters[2].Value = ((string)(PermitComment)); } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } int returnValue; try { returnValue = command.ExecuteNonQuery(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } return(returnValue); }
public virtual int DeleteQuery(int created_by) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0])); command.Parameters[0].Value = ((int)(created_by)); global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } int returnValue; try { returnValue = command.ExecuteNonQuery(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } return(returnValue); }
public virtual int Insert(int INV_NUM, System.DateTime INV_DATE, decimal INV_AMOUNT, int ORD_ID) { this.Adapter.InsertCommand.Parameters[0].Value = ((int)(INV_NUM)); this.Adapter.InsertCommand.Parameters[1].Value = ((System.DateTime)(INV_DATE)); this.Adapter.InsertCommand.Parameters[2].Value = ((decimal)(INV_AMOUNT)); this.Adapter.InsertCommand.Parameters[3].Value = ((int)(ORD_ID)); global::System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State; if (((this.Adapter.InsertCommand.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { this.Adapter.InsertCommand.Connection.Open(); } try { int returnValue = this.Adapter.InsertCommand.ExecuteNonQuery(); return(returnValue); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { this.Adapter.InsertCommand.Connection.Close(); } } }
//Run when select devices from the list private void cmbBoxThresholdTypes_SelectedIndexChanged(object sender, EventArgs e) { SqlDataReader measurementsReader = null; DataRowView dataRow = (DataRowView)cmbBoxThresholdTypes.SelectedItem; LinqExample.SLA_RT_monitoringDataSetThreshold.ThresholdsRow selectedRow = (LinqExample.SLA_RT_monitoringDataSetThreshold.ThresholdsRow)dataRow.Row; measurmentsSqlCommand.Parameters[0].Value = selectedRow.id; global::System.Data.ConnectionState previousConnectionState = measurmentsSqlCommand.Connection.State; if (((measurmentsSqlCommand.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { measurmentsSqlCommand.Connection.Open(); } try { measurementsReader = measurmentsSqlCommand.ExecuteReader(); } catch (Exception e123) { MessageBox.Show(e123.ToString()); } listDevices.Items.Clear(); while (measurementsReader.Read()) { listDevices.Items.Add(measurementsReader.GetString(0)); listDevices.SelectedItems.Add(measurementsReader.GetString(0)); } measurementsReader.Close();//Close the reader since we are opening it every time when selected item CreateGraph(zg1); }
public virtual int Delete(string Original_strClassCode, string Original_strDescription) { if ((Original_strClassCode == null)) { throw new global::System.ArgumentNullException("Original_strClassCode"); } else { this.Adapter.DeleteCommand.Parameters[0].Value = ((string)(Original_strClassCode)); } if ((Original_strDescription == null)) { this.Adapter.DeleteCommand.Parameters[1].Value = ((object)(1)); this.Adapter.DeleteCommand.Parameters[2].Value = global::System.DBNull.Value; } else { this.Adapter.DeleteCommand.Parameters[1].Value = ((object)(0)); this.Adapter.DeleteCommand.Parameters[2].Value = ((string)(Original_strDescription)); } global::System.Data.ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State; if (((this.Adapter.DeleteCommand.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { this.Adapter.DeleteCommand.Connection.Open(); } try { int returnValue = this.Adapter.DeleteCommand.ExecuteNonQuery(); return(returnValue); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { this.Adapter.DeleteCommand.Connection.Close(); } } }
public virtual int Update(int p1, global::System.Nullable <global::System.DateTime> p2, string p3, int p4) { this.Adapter.UpdateCommand.Parameters[0].Value = ((int)(p1)); if ((p2.HasValue == true)) { this.Adapter.UpdateCommand.Parameters[1].Value = ((System.DateTime)(p2.Value)); } else { this.Adapter.UpdateCommand.Parameters[1].Value = global::System.DBNull.Value; } if ((p3 == null)) { this.Adapter.UpdateCommand.Parameters[2].Value = global::System.DBNull.Value; } else { this.Adapter.UpdateCommand.Parameters[2].Value = ((string)(p3)); } this.Adapter.UpdateCommand.Parameters[3].Value = ((int)(p4)); global::System.Data.ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State; if (((this.Adapter.UpdateCommand.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { this.Adapter.UpdateCommand.Connection.Open(); } try { int returnValue = this.Adapter.UpdateCommand.ExecuteNonQuery(); return(returnValue); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { this.Adapter.UpdateCommand.Connection.Close(); } } }
public virtual global::System.Nullable <int> FU_TINHTONKHO(string MAHH) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0])); if ((MAHH == null)) { command.Parameters[1].Value = global::System.DBNull.Value; } else { command.Parameters[1].Value = ((string)(MAHH)); } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } try { command.ExecuteNonQuery(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } if (((command.Parameters[0].Value == null) || (command.Parameters[0].Value.GetType() == typeof(global::System.DBNull)))) { return(new global::System.Nullable <int>()); } else { return(new global::System.Nullable <int>(((int)(command.Parameters[0].Value)))); } }
public virtual int Insert(string login, string password, int status) { if ((login == null)) { throw new global::System.ArgumentNullException("login"); } else { this.Adapter.InsertCommand.Parameters[0].Value = ((string)(login)); } if ((password == null)) { throw new global::System.ArgumentNullException("password"); } else { this.Adapter.InsertCommand.Parameters[1].Value = ((string)(password)); } this.Adapter.InsertCommand.Parameters[2].Value = ((int)(status)); global::System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State; if (((this.Adapter.InsertCommand.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { this.Adapter.InsertCommand.Connection.Open(); } try { int returnValue = this.Adapter.InsertCommand.ExecuteNonQuery(); return(returnValue); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { this.Adapter.InsertCommand.Connection.Close(); } } }
public void Start() { //Init thread object. t1 = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(Generator)); { dbConnectionDevices = new SqlConnection(global::LinqExample.Properties.Settings.Default.SLA_RT_monitoringConnectionString); //Get All devices currently in the system allDevices = new SqlCommand("SELECT id, type FROM [dbo].[Devices]", dbConnectionDevices); if (((allDevices.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { allDevices.Connection.Open(); } //run the quary to get the devices from database SqlDataReader devicesReader = allDevices.ExecuteReader(); //Init device data vector with ID and TYPE devicesData = new List <DeviceData>(); while (devicesReader.Read()) { // id, //type devicesData.Add(new DeviceData(devicesReader.GetInt32(0), devicesReader.GetString(1).ToLower())); } } { dbConnectionThresholdTypes = new SqlConnection(global::LinqExample.Properties.Settings.Default.SLA_RT_monitoringConnectionString); // fetch all threshold ids with min/max values allThresholdTypes = new SqlCommand("SELECT id, threshold_type_id, minValue, maxValue FROM [dbo].[Thresholds]", dbConnectionThresholdTypes); if (((allThresholdTypes.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { allThresholdTypes.Connection.Open(); } //run the quary to get the threshold information from database SqlDataReader thresholdTypesReader = allThresholdTypes.ExecuteReader(); thresholds = new Dictionary <int, ThresholdData>(); while (thresholdTypesReader.Read()) { //id, //threshold_type_id,1 = isAbove //minValue, //maxValue thresholds[thresholdTypesReader.GetInt32(0)] = new ThresholdData(thresholdTypesReader.GetInt32(1) == 1, thresholdTypesReader.GetInt32(2), thresholdTypesReader.GetInt32(3)); } } { // Read all contract and map contract to device type. dbConnectionContracts = new SqlConnection(global::LinqExample.Properties.Settings.Default.SLA_RT_monitoringConnectionString); allContracts = new SqlCommand("SELECT device_type, threshold_id, value FROM [dbo].[SLAContracts]", dbConnectionContracts); if (((allContracts.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { allContracts.Connection.Open(); } //run the quary to get the contract information from database SqlDataReader contractsReader = allContracts.ExecuteReader(); thresholdForDeviceType = new Dictionary <string, ContractData>(); while (contractsReader.Read()) { //device_type , trim space if the value in database is nchar string currDeviceType = contractsReader.GetString(0).ToLower().TrimEnd(trailingSpace); //checking if devicetype is found in thresholdForDeviceType if (thresholdForDeviceType.ContainsKey(currDeviceType)) { //threshold_id if (!thresholdForDeviceType[currDeviceType].listThresholdIds.Exists(x => x.Key == contractsReader.GetInt32(1))) { //add threshold_id and value if thresholdForDeviceType if not found thresholdForDeviceType[currDeviceType].listThresholdIds.Add( new KeyValuePair <int, float>( //threshold_id, //value contractsReader.GetInt32(1), (float)contractsReader.GetInt32(2))); } } // if devicetype not found in thresholdForDeviceType else { ContractData newContractData = new ContractData(); newContractData.deviceType = currDeviceType; newContractData.listThresholdIds = new List <KeyValuePair <int, float> >(); //threshold_id, value newContractData.listThresholdIds.Add(new KeyValuePair <int, float>(contractsReader.GetInt32(1), (float)contractsReader.GetInt32(2))); thresholdForDeviceType.Add(currDeviceType, newContractData); } } } { dbConnection = new global::System.Data.SqlClient.SqlConnection(); dbConnection.ConnectionString = global::LinqExample.Properties.Settings.Default.SLA_RT_monitoringConnectionString; //The strem data need to be insert into SimulatedMeasurements insertSimulatedMeasurementCmd = new SqlCommand( @"INSERT INTO [SLA_RT_monitoring].[dbo].[SimulatedMeasurements] " + @"([device_id] " + @",[threshold_id] " + @",[value] " + @",[timestamp]) " + @"VALUES (@device_id, @threshold_id, @value, @timestamp)", dbConnection); if (((insertSimulatedMeasurementCmd.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { insertSimulatedMeasurementCmd.Connection.Open(); } insertSimulatedMeasurementCmd.CommandType = global::System.Data.CommandType.Text; //device_id insertSimulatedMeasurementCmd.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@device_id", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "device_id", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); //threshold_id insertSimulatedMeasurementCmd.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@threshold_id", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "threshold_id", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); //value insertSimulatedMeasurementCmd.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@value", global::System.Data.SqlDbType.Float, 0, global::System.Data.ParameterDirection.Input, 0, 0, "value", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); //timestamp insertSimulatedMeasurementCmd.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@timestamp", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "timestamp", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); global::System.Data.ConnectionState previousConnectionState = insertSimulatedMeasurementCmd.Connection.State; if (((insertSimulatedMeasurementCmd.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { insertSimulatedMeasurementCmd.Connection.Open(); } } {// Read past measurements of device & threshold pair. dbConnectionPastMeasurements = new SqlConnection(global::LinqExample.Properties.Settings.Default.SLA_RT_monitoringConnectionString); //Get the AVG value from the past 2 results pastMeasurements = new SqlCommand( "SELECT AVG(a.value) " + "FROM ( " + " SELECT TOP 2 timestamp, value FROM [SLA_RT_monitoring].[dbo].[SimulatedMeasurements] " + " WHERE device_id=@device_id " + " AND threshold_id=@threshold_id " + " AND timestamp>@timestamp " + " ORDER BY timestamp DESC " + " ) a ", dbConnectionPastMeasurements); if (((pastMeasurements.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { pastMeasurements.Connection.Open(); } pastMeasurements.CommandType = global::System.Data.CommandType.Text; //device_id pastMeasurements.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@device_id", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "device_id", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); //threshold_id pastMeasurements.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@threshold_id", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "threshold_id", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); //timestamp pastMeasurements.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@timestamp", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "timestamp", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); } shouldContinue = true; t1.Start(this); }//end of Start
public virtual int InsertWorkTaskSavedSheetTask(global::System.Nullable <int> WorkSheetID, global::System.Nullable <int> WorkTaskID, global::System.Nullable <int> BusinessLineID, global::System.Nullable <int> DepartmentID, global::System.Nullable <global::System.DateTime> TransactionDate) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0])); if ((WorkSheetID.HasValue == true)) { command.Parameters[1].Value = ((int)(WorkSheetID.Value)); } else { command.Parameters[1].Value = global::System.DBNull.Value; } if ((WorkTaskID.HasValue == true)) { command.Parameters[2].Value = ((int)(WorkTaskID.Value)); } else { command.Parameters[2].Value = global::System.DBNull.Value; } if ((BusinessLineID.HasValue == true)) { command.Parameters[3].Value = ((int)(BusinessLineID.Value)); } else { command.Parameters[3].Value = global::System.DBNull.Value; } if ((DepartmentID.HasValue == true)) { command.Parameters[4].Value = ((int)(DepartmentID.Value)); } else { command.Parameters[4].Value = global::System.DBNull.Value; } if ((TransactionDate.HasValue == true)) { command.Parameters[5].Value = ((System.DateTime)(TransactionDate.Value)); } else { command.Parameters[5].Value = global::System.DBNull.Value; } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } int returnValue; try { returnValue = command.ExecuteNonQuery(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } return(returnValue); }
public virtual int Insert(global::System.Nullable <int> id_gasto, global::System.Nullable <int> id_personal, global::System.Nullable <int> id_caja, global::System.Nullable <decimal> monto, string concepto, string observacion) { if ((id_gasto.HasValue == true)) { this.Adapter.InsertCommand.Parameters[0].Value = ((int)(id_gasto.Value)); } else { this.Adapter.InsertCommand.Parameters[0].Value = global::System.DBNull.Value; } if ((id_personal.HasValue == true)) { this.Adapter.InsertCommand.Parameters[1].Value = ((int)(id_personal.Value)); } else { this.Adapter.InsertCommand.Parameters[1].Value = global::System.DBNull.Value; } if ((id_caja.HasValue == true)) { this.Adapter.InsertCommand.Parameters[2].Value = ((int)(id_caja.Value)); } else { this.Adapter.InsertCommand.Parameters[2].Value = global::System.DBNull.Value; } if ((monto.HasValue == true)) { this.Adapter.InsertCommand.Parameters[3].Value = ((decimal)(monto.Value)); } else { this.Adapter.InsertCommand.Parameters[3].Value = global::System.DBNull.Value; } if ((concepto == null)) { this.Adapter.InsertCommand.Parameters[4].Value = global::System.DBNull.Value; } else { this.Adapter.InsertCommand.Parameters[4].Value = ((string)(concepto)); } if ((observacion == null)) { this.Adapter.InsertCommand.Parameters[5].Value = global::System.DBNull.Value; } else { this.Adapter.InsertCommand.Parameters[5].Value = ((string)(observacion)); } global::System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State; if (((this.Adapter.InsertCommand.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { this.Adapter.InsertCommand.Connection.Open(); } try { int returnValue = this.Adapter.InsertCommand.ExecuteNonQuery(); return(returnValue); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { this.Adapter.InsertCommand.Connection.Close(); } } }
public virtual int InsertTowMotorInspection(global::System.Nullable <int> TowMotorID, global::System.Nullable <int> EmployeeID, global::System.Nullable <int> WarehouseID, string InspectionType, global::System.Nullable <decimal> HourReading, global::System.Nullable <global::System.DateTime> InspectionDate) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0])); if ((TowMotorID.HasValue == true)) { command.Parameters[1].Value = ((int)(TowMotorID.Value)); } else { command.Parameters[1].Value = global::System.DBNull.Value; } if ((EmployeeID.HasValue == true)) { command.Parameters[2].Value = ((int)(EmployeeID.Value)); } else { command.Parameters[2].Value = global::System.DBNull.Value; } if ((WarehouseID.HasValue == true)) { command.Parameters[3].Value = ((int)(WarehouseID.Value)); } else { command.Parameters[3].Value = global::System.DBNull.Value; } if ((InspectionType == null)) { command.Parameters[4].Value = global::System.DBNull.Value; } else { command.Parameters[4].Value = ((string)(InspectionType)); } if ((HourReading.HasValue == true)) { command.Parameters[5].Value = ((decimal)(HourReading.Value)); } else { command.Parameters[5].Value = global::System.DBNull.Value; } if ((InspectionDate.HasValue == true)) { command.Parameters[6].Value = ((System.DateTime)(InspectionDate.Value)); } else { command.Parameters[6].Value = global::System.DBNull.Value; } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } int returnValue; try { returnValue = command.ExecuteNonQuery(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } return(returnValue); }
public virtual int InsertPartNumberReference(global::System.Nullable <int> PartID, string PartNumber, string JDEPartNumber, global::System.Nullable <int> EmployeeID, global::System.Nullable <global::System.DateTime> TransactionDate, global::System.Nullable <bool> PartActive) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0])); if ((PartID.HasValue == true)) { command.Parameters[1].Value = ((int)(PartID.Value)); } else { command.Parameters[1].Value = global::System.DBNull.Value; } if ((PartNumber == null)) { command.Parameters[2].Value = global::System.DBNull.Value; } else { command.Parameters[2].Value = ((string)(PartNumber)); } if ((JDEPartNumber == null)) { command.Parameters[3].Value = global::System.DBNull.Value; } else { command.Parameters[3].Value = ((string)(JDEPartNumber)); } if ((EmployeeID.HasValue == true)) { command.Parameters[4].Value = ((int)(EmployeeID.Value)); } else { command.Parameters[4].Value = global::System.DBNull.Value; } if ((TransactionDate.HasValue == true)) { command.Parameters[5].Value = ((System.DateTime)(TransactionDate.Value)); } else { command.Parameters[5].Value = global::System.DBNull.Value; } if ((PartActive.HasValue == true)) { command.Parameters[6].Value = ((bool)(PartActive.Value)); } else { command.Parameters[6].Value = global::System.DBNull.Value; } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } int returnValue; try { returnValue = command.ExecuteNonQuery(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } return(returnValue); }
public virtual int InsertTools(string strToolID, global::System.Nullable <int> intEmployeeID, global::System.Nullable <global::System.DateTime> datCreationDate, string strPartNumber, global::System.Nullable <int> intCategoryID, string strToolDescription, global::System.Nullable <global::System.DateTime> datTransactionDate, global::System.Nullable <decimal> decToolCost, global::System.Nullable <bool> blnAvailable, global::System.Nullable <bool> blnToolActive, global::System.Nullable <int> intCurrentLocation, string strToolNotes) { global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0])); if ((strToolID == null)) { command.Parameters[1].Value = global::System.DBNull.Value; } else { command.Parameters[1].Value = ((string)(strToolID)); } if ((intEmployeeID.HasValue == true)) { command.Parameters[2].Value = ((int)(intEmployeeID.Value)); } else { command.Parameters[2].Value = global::System.DBNull.Value; } if ((datCreationDate.HasValue == true)) { command.Parameters[3].Value = ((System.DateTime)(datCreationDate.Value)); } else { command.Parameters[3].Value = global::System.DBNull.Value; } if ((strPartNumber == null)) { command.Parameters[4].Value = global::System.DBNull.Value; } else { command.Parameters[4].Value = ((string)(strPartNumber)); } if ((intCategoryID.HasValue == true)) { command.Parameters[5].Value = ((int)(intCategoryID.Value)); } else { command.Parameters[5].Value = global::System.DBNull.Value; } if ((strToolDescription == null)) { command.Parameters[6].Value = global::System.DBNull.Value; } else { command.Parameters[6].Value = ((string)(strToolDescription)); } if ((datTransactionDate.HasValue == true)) { command.Parameters[7].Value = ((System.DateTime)(datTransactionDate.Value)); } else { command.Parameters[7].Value = global::System.DBNull.Value; } if ((decToolCost.HasValue == true)) { command.Parameters[8].Value = ((decimal)(decToolCost.Value)); } else { command.Parameters[8].Value = global::System.DBNull.Value; } if ((blnAvailable.HasValue == true)) { command.Parameters[9].Value = ((bool)(blnAvailable.Value)); } else { command.Parameters[9].Value = global::System.DBNull.Value; } if ((blnToolActive.HasValue == true)) { command.Parameters[10].Value = ((bool)(blnToolActive.Value)); } else { command.Parameters[10].Value = global::System.DBNull.Value; } if ((intCurrentLocation.HasValue == true)) { command.Parameters[11].Value = ((int)(intCurrentLocation.Value)); } else { command.Parameters[11].Value = global::System.DBNull.Value; } if ((strToolNotes == null)) { command.Parameters[12].Value = global::System.DBNull.Value; } else { command.Parameters[12].Value = ((string)(strToolNotes)); } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { command.Connection.Open(); } int returnValue; try { returnValue = command.ExecuteNonQuery(); } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { command.Connection.Close(); } } return(returnValue); }