private void FillFoodItem(Int32 categoryID) { try { if (cmbCategory.SelectedIndex < 0) { return; } else { String sqlCommand = SqlQueries.GetQuery(Query.ViewCategory3ByCat2ComboBox); sqlCommand = String.Format(sqlCommand, categoryID); CDalConfig oTempDal = ConfigManager.GetConfig <CDalConfig>(); String tempConnStr = oTempDal.ConnectionString; // Create a new data adapter based on the specified query. SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlCommand, tempConnStr); // Create a command builder to generate SQL update, insert, and // delete commands based on selectCommand. These are used to // update the database. SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter); // Populate a new data table and bind it to the BindingSource. DataTable table = new DataTable(); table.Locale = System.Globalization.CultureInfo.InvariantCulture; dataAdapter.Fill(table); cmbFoodItem.DataSource = table; cmbFoodItem.Text = m_sFoodItemText; dataAdapter.Dispose(); } } catch (Exception exp) { MessageBox.Show(exp.Message + "Error Occured. Please contact to your administrator.", RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void ThenTheReactivatedRegistrationWillDisplayTheGradeAs(string ExpectedGrade) { var uln = scenarionContext["uln"] as string; int GradeCount = SqlQueries.ReturnLastActiveGradeCount(uln); if (GradeCount == 0) { string ExpectedDBGrade = "Not received"; Console.WriteLine(ExpectedDBGrade); ResultsLearnersResultsPage.VerifyGradeText(ExpectedGrade); ResultsLearnersResultsPage.VerifyGradeText(ExpectedDBGrade); } else { string ExpectedDBGrade = SqlQueries.ReturnLastActiveGrade(uln); Console.WriteLine(ExpectedDBGrade); ResultsLearnersResultsPage.VerifyGradeText(ExpectedGrade); //This checks the last active grade on the database matches the grade shown against the registration ResultsLearnersResultsPage.VerifyGradeText(ExpectedDBGrade); } }
public string InsertUnit(Unit sr) { string ret = string.Empty; try { this.OpenConnection(); string sqlCommand = String.Format(SqlQueries.GetQuery(Query.InsertUnit), sr.UnitName); this.ExecuteNonQuery(sqlCommand); ret = "Unit Insert Sucessfully"; } catch { ret = "Please Try Again"; } finally { this.CloseConnection(); } return(ret); }
public void InsertPaidAmountReport(SalaryTransaction aSalaryTransaction, string month, string year) { try { DateTime aDateTime = DateTime.Now.Date; this.OpenConnection(); string sqlComm = string.Format(SqlQueries.GetQuery(Query.InsertPaidAmountReport), aSalaryTransaction.EmployeeId, aSalaryTransaction.WorkingDay, aSalaryTransaction.AttendingDay, aSalaryTransaction.Salary, aSalaryTransaction.DeductedSalary, aSalaryTransaction.PayableSalary, aSalaryTransaction.ServiceCharge, aSalaryTransaction.FoodAndRoomAllowance, aSalaryTransaction.TotalPayableSalary, aDateTime, aSalaryTransaction.Remarks, month, year); this.ExecuteNonQuery(sqlComm); } catch (Exception ex) { //throw new Exception(ex.ToString()); } finally { this.CloseConnection(); } }
public string UpdateEmployee(Employee aEmployee) { try { this.OpenConnection(); string sqlComm = string.Format(SqlQueries.GetQuery(Query.UpdateEmployee), aEmployee.EmployeeName, aEmployee.EmployeePId, aEmployee.EmployeePhone, aEmployee.EmployeeAddress, aEmployee.EmployeePostion, aEmployee.EmployeeId); this.ExecuteNonQuery(sqlComm); return("Update Sucessfully"); } catch (Exception ex) { return("Please try again"); //throw new Exception(ex.ToString()); } finally { this.CloseConnection(); } }
public string InsertOtherItem(Store aStore) { try { DateTime aDateTime = DateTime.Now.Date; this.OpenConnection(); string sqlComm = string.Format(SqlQueries.GetQuery(Query.InsertOtherItem), aStore.ItemName, aStore.Unit, 0, 0, aStore.CategoryId, aStore.CategoryName); this.ExecuteNonQuery(sqlComm); return("Insert Sucessfully"); } catch (Exception ex) { return("Please try again"); //throw new Exception(ex.ToString()); } finally { this.CloseConnection(); } }
private void FillFoodType(Int32 parentId) { if (cmbParent.SelectedIndex < 0) { return; } String sqlCommand = ""; if (parentId == 0) { sqlCommand = SqlQueries.GetQuery(Query.ViewCategory1); } else { sqlCommand = String.Format(SqlQueries.GetQuery(Query.ViewCat1ComboBox), parentId); } CDalConfig oTempDal = ConfigManager.GetConfig <CDalConfig>(); String tempConnStr = oTempDal.ConnectionString; SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlCommand, tempConnStr); // Create a command builder to generate SQL update, insert, and // delete commands based on selectCommand. These are used to // update the database. SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter); // Populate a new data table and bind it to the BindingSource. DataTable table = new DataTable(); table.Locale = System.Globalization.CultureInfo.InvariantCulture; dataAdapter.Fill(table); cmbFoodType.DataSource = table; cmbFoodType.Text = m_sFoodTypeText; dataAdapter.Dispose(); }
private CResult GetOrderCandidate(CCategory4 oCat) { CResult oResult = new CResult(); try { List <int> iTempList = new List <int>(); this.OpenConnection(); string sSql = string.Format(SqlQueries.GetQuery(Query.GetCat4OrderCandidate), oCat.Category3ID, oCat.Category4Order); IDataReader oReader = this.ExecuteReader(sSql); if (oReader != null) { while (oReader.Read()) { if (oReader["cat4_id"] != null) { int iTempInt = Int32.Parse(oReader["cat4_id"].ToString()); iTempList.Add(iTempInt); } } oResult.Data = iTempList; oResult.IsSuccess = true; } } catch (Exception ex) { Logger.Write("Exception : " + ex + " in ItemGetById()", LogLevel.Error, "Database"); oResult.IsException = true; } finally { this.CloseConnection(); } return(oResult); }
protected static void CreateDbRegistationForNonLrsCombination(string uln, string EmStatus, string IpStatus) { var ipStat = IpStatus switch { "IP completed" => 1, "IP completed with special consideration" => 2, _ => 3 }; switch (EmStatus) { case "MathEng achieved the minimum standard": var profileId = SqlQueries.CreateRegistrationProfileForLrsCombination(uln, "0", "1", "NULL", "1"); var pathwayId = SqlQueries.CreateRegistrationPathwayForLrsCombination(profileId); SqlQueries.CreateRegSpecialismForLrs(pathwayId); SqlQueries.CreateIndustryPlacement(pathwayId, ipStat); var pathwayAssessmentId = SqlQueries.CreatePathwayAssessment(pathwayId); SqlQueries.CreatePathwayResult(pathwayAssessmentId); break; case "MathEng achieved the minimum standard for learners with SEND": var profileId1 = SqlQueries.CreateRegistrationProfileForLrsCombination(uln, "0", "1", "1", "1"); var pathwayId1 = SqlQueries.CreateRegistrationPathwayForLrsCombination(profileId1); SqlQueries.CreateRegSpecialismForLrs(pathwayId1); SqlQueries.CreateIndustryPlacement(pathwayId1, ipStat); var pathwayAssessmentId1 = SqlQueries.CreatePathwayAssessment(pathwayId1); SqlQueries.CreatePathwayResult(pathwayAssessmentId1); break; case "MathEng not achieved the minimum standard": var profileId4 = SqlQueries.CreateRegistrationProfileForLrsCombination(uln, "0", "0", "NULL", "1"); var pathwayId4 = SqlQueries.CreateRegistrationPathwayForLrsCombination(profileId4); SqlQueries.CreateRegSpecialismForLrs(pathwayId4); SqlQueries.CreateIndustryPlacement(pathwayId4, ipStat); var pathwayAssessmentId4 = SqlQueries.CreatePathwayAssessment(pathwayId4); SqlQueries.CreatePathwayResult(pathwayAssessmentId4); break; } }
public void GivenICreateANewRegistrationWhichISubsequentlyWithdraw() { SqlQueries.DeleteFromRegistrationTables(); RegistrationsManualPage.AddNewRegistrations(); RegistrationsManualPage.CreateRegistrationWithSpecialism(Constants.ManualRegULN, Constants.ManualRegFirstName, Constants.ManualRegLastName, Constants.ManualRegDOBDay, Constants.ManualRegDOBMonth, Constants.ManualRegDOBYear); RegistrationsManualPage.ClickSubmit(); ClickElement(RegistrationsPage.BacktoRegistrationLink); ClickElement(RegistrationsSearchPage.SearchRegistrationLink); RegistrationsSearchPage.SearchForULN(); RegistrationsSearchPage.VerifySearchResultPage(); RegistrationsSearchPage.ClickChangeStatusLink(); RegistrationsActiveOptionPage.ClickWithdrawRadioButton(); RegistrationsActiveOptionPage.ClickContinueButton(); RegistrationsWithdrawRegistrations.VerifyWithdrawRegistrationPage(); RegistrationsWithdrawRegistrations.VerifyRadioButtonsNotSelected(); RegistrationsWithdrawRegistrations.WithdrawApplication(); RegistrationsWithdrawRegistrationsSuccess.VerifyWithdrawRegSuccessPage_EntryActiveOptionsPage(); RegistrationsWithdrawRegistrationsSuccess.ClickViewWithdrawnRegistrationButton(); RegistrationsSearchPage.VerifySearchResultPage(); RegistrationsSearchPage.ValidateUlnStatus("WITHDRAWN"); RegistrationsSearchPage.VerifyRegistrationDetailsPageSubHeading(); }
public string UpdateStockByStockId(Stock stock) { string sr = string.Empty; try { this.OpenConnection(); string sqlcomm = String.Format(SqlQueries.GetQuery(Query.UpdateStockByStockId), stock.Stocks, stock.StockId); this.ExecuteNonQuery(sqlcomm); sr = "Update Sucessfully"; } catch (Exception ex) { MessageBox.Show("ohh No " + ex); } finally { this.CloseConnection(); } return(sr); }
private void LoadParentCategory() { try { String queryStr = SqlQueries.GetQuery(Query.ViewParentCategory); CDalConfig oTempDal = ConfigManager.GetConfig <CDalConfig>(); String tempConnStr = oTempDal.ConnectionString; // Create a new data adapter based on the specified query. SqlDataAdapter dataAdapter = new SqlDataAdapter(queryStr, tempConnStr); // Create a command builder to generate SQL update, insert, and // delete commands based on selectCommand. These are used to // update the database. SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter); // Populate a new data table and bind it to the BindingSource. DataTable table = new DataTable(); table.Locale = System.Globalization.CultureInfo.InvariantCulture; dataAdapter.Fill(table); //bindingSource1.DataSource = table; dgvParentCategory.DataSource = table; // dgvParentCategory.Columns["Parent_Category_Name"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; table.TableName = "parent_category"; table.WriteXml("parent_category.xml", XmlWriteMode.IgnoreSchema); dataAdapter.Dispose(); //this.dgvParentCategory.Columns["parent_cat_id"].Visible = false; } catch (Exception ee) { MessageBox.Show(ee.Message + ". Error Occured. Please contact to your administrator."); } }
public string InsertEmployee(Employee aEmployee) { try { DateTime aDateTime = DateTime.Now.Date; this.OpenConnection(); string sqlComm = string.Format(SqlQueries.GetQuery(Query.InsertEmployee), aEmployee.EmployeeName, "123", aEmployee.EmployeePhone, aEmployee.EmployeeAddress, aEmployee.LastPayDate, aEmployee.EmployeePostion); this.ExecuteNonQuery(sqlComm); return("Insert Sucessfully"); } catch (Exception ex) { return("Please try again"); //throw new Exception(ex.ToString()); } finally { this.CloseConnection(); } }
public List <Transaction1> showAllData(long startDate, long endDate) { List <Transaction1> aTransactions = new List <Transaction1>(); //CResult oResult = new CResult(); //CSearchOrderInfo oOrderInfo = new CSearchOrderInfo(); try { this.OpenConnection(); string sqlCommand = ""; sqlCommand = String.Format(SqlQueries.GetQuery(Query.GetOrderInfo), startDate.ToString(), endDate.ToString()); //this.ExecuteNonQuery(sqlCommand); IDataReader oReader = this.ExecuteReader(sqlCommand); if (oReader != null) { while (oReader.Read()) { Transaction1 aTransaction1 = new Transaction1(); aTransaction1 = ReadToOrderTotalforProfit(oReader); aTransactions.Add(aTransaction1); } } //oResult.Data = oOrderInfo; //oResult.IsSuccess = true; } catch (Exception ex) { } finally { this.CloseConnection(); } return(aTransactions); }
protected static void CreateRegWithFinalState(string uln) { var profileId = SqlQueries.CreateRegistrationProfile(uln); var pathwayId = SqlQueries.CreateRegistrationPathway(profileId); SqlQueries.CreateRegSpecialism(pathwayId); var pathwayAssessmentId = SqlQueries.CreatePathwayAssessment(pathwayId); SqlQueries.CreatePathwayResult(pathwayAssessmentId); var updateResult = "update TqPathwayResult set EndDate = GETDATE() where TqPathwayAssessmentId='" + pathwayAssessmentId + "'"; SqlDatabaseConncetionHelper.UpdateSqlCommand(updateResult, ConnectionString); var insertAppealRow = "Insert into TqPathwayResult values('" + pathwayAssessmentId + "',2,GETDATE(),Null,3,1,0,GETDATE(),'System',GETDATE(),'System')"; SqlDatabaseConncetionHelper.ExecuteSqlCommand(insertAppealRow, ConnectionString); var updateResult1 = "update TqPathwayResult set EndDate = GETDATE() where TqPathwayAssessmentId='" + pathwayAssessmentId + "' and PrsStatus=3"; SqlDatabaseConncetionHelper.UpdateSqlCommand(updateResult1, ConnectionString); var insertFinalRow = "Insert into TqPathwayResult values('" + pathwayAssessmentId + "',2,GETDATE(),Null,4,1,0,GETDATE(),'System',GETDATE(),'System')"; SqlDatabaseConncetionHelper.ExecuteSqlCommand(insertFinalRow, ConnectionString); }
private void FillUsers() { try { String queryStr = SqlQueries.GetQuery(Query.ViewUserInfo); CDalConfig oTempDal = ConfigManager.GetConfig <CDalConfig>(); String tempConnStr = oTempDal.ConnectionString; //create an OleDbDataAdapter to execute the query //OleDbDataAdapter dAdapter = // new OleDbDataAdapter(query, connString); // Create a new data adapter based on the specified query. SqlDataAdapter dataAdapter = new SqlDataAdapter(queryStr, tempConnStr); // Create a command builder to generate SQL update, insert, and // delete commands based on selectCommand. These are used to // update the database. SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter); // Populate a new data table and bind it to the BindingSource. DataTable table = new DataTable(); table.Locale = System.Globalization.CultureInfo.InvariantCulture; dataAdapter.Fill(table); //bindingSource1.DataSource = table; dgvUsers.DataSource = table; dataAdapter.Dispose(); } catch (Exception exp) { MessageBox.Show(exp.Message + "Error Occured. Please contact to your administrator.", RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void InsertInventoryKitchenStock(List <InventoryStockReport> aInventoryStockReports) { try { this.OpenConnection(); foreach (InventoryStockReport report in aInventoryStockReports) { string sqlComm = String.Format(SqlQueries.GetQuery(Query.InsertInventoryKitchenStockReport), report.CategoryId, report.CategoryName, report.ItemId, report.ItemName, report.ReceivedQty, report.SendQty, report.DamageQty, report.BalanceQty, report.Date = DateTime.Today.AddDays(-1)); this.ExecuteNonQuery(sqlComm); } } catch (Exception ex) { throw new Exception("InsertInventoryKitchenStock", ex); } finally { this.CloseConnection(); } }
public string InsertKitchenStock(Stock aStock) { string sr = string.Empty; try { this.OpenConnection(); string sqlcomm = String.Format(SqlQueries.GetQuery(Query.InsertKitchenStock), aStock.Category.CategoryId, aStock.Category.CategoryName, aStock.Item.ItemId, aStock.Item.ItemName, aStock.Stocks, aStock.Item.UnitName, aStock.UnitPrice); this.ExecuteNonQuery(sqlcomm); sr = "Insert Sucessfully"; } catch (Exception ex) { MessageBox.Show("ohh No " + ex); } finally { this.CloseConnection(); } return(sr); }
public string InsertSupplier(Supplier aSupplier) { string sr = string.Empty; try { this.OpenConnection(); string sqlCommand = String.Format(SqlQueries.GetQuery(Query.InsertSupplier), aSupplier.Name, aSupplier.ContactInformation); this.ExecuteNonQuery(sqlCommand); sr = "Supplier Create Successfully"; } catch { sr = "Please Check Your Input"; } finally { this.CloseConnection(); } return(sr); }
public void Execute(object parameter) { var param = parameter as LoginModel; Methods Close = new Methods(); SqlQueries query = new SqlQueries(); if (query.Login(param.Login, param.Password) > 0) { UserWindow userwindow = new UserWindow(); Close.CloseMethod(EnumWindow.LoginW); userwindow.ShowDialog(); } else { MessageBoxResult result = MessageBox.Show("Wrong login or password", "FoodDiary", MessageBoxButton.OKCancel, MessageBoxImage.Error); if (result != MessageBoxResult.OK) { WelcomeWindow main = new WelcomeWindow(); Close.CloseMethod(EnumWindow.LoginW); main.ShowDialog(); } } }
public string InsertInventoryCategory(InventoryCategory aCategory) { string sr = string.Empty; try { this.OpenConnection(); string sqlComm = String.Format(SqlQueries.GetQuery(Query.InsertInventoryCategory), aCategory.CategoryName, aCategory.UnitId); this.ExecuteNonQuery(sqlComm); sr = "Insert Inventory Category Successfully"; } catch (Exception ex) { MessageBox.Show(ex + " Try Again"); sr = "Please Try again"; } finally { this.CloseConnection(); } return(sr); }
public bool isUserDataCorrect(string login, string password) { bool isDataCorrect = false; string _password = String.Empty; try { using (var reader = doQuery.Start(SqlQueries.PasswordByLogin(login))) _password = reader.GetString(0); } catch (Exception err) { System.Windows.Forms.MessageBox.Show(err.Message); return(isDataCorrect); } if (_password == password) { isDataCorrect = true; } return(isDataCorrect); }
private void CopyTable(SqlQueries sqlQueries) { if (!string.IsNullOrEmpty(tableName) && sqlQueries.TableName != tableName) { return; } logInfo.Info = $"Table: {sqlQueries.TableName}"; //Check User table //var userInfo = WorkReader.CreateInfo($"{sqlQueries.TableName} -> {sqlQueries.NewTableName}" ,0,0); var userInfo = WorkReader.CreateInfo(sqlQueries.NewTableName, 0, 0); _infoList.Add(userInfo); logInfo.Info = $"New table {userInfo.TableName}"; var maxId = CheckAndCreateTable(sqlQueries.NewTableName, sqlQueries.SqlCreate(), userInfo); if (maxId < 0) { return; } logInfo.Info = $"Create new table {sqlQueries.NewTableName}"; var reader = ReadRecords(sqlQueries, maxId, sqlQueries.SqlSelect(maxId), userInfo); if (reader == null) { return; } logInfo.Info = $"Table {sqlQueries.TableName}. Row count: {userInfo.Count}"; sqlQueries.Insert(reader, DesSqlCon, userInfo, logInfo); }
private void FillFoodCategory(Int32 foodTypeID) { if (cmbFoodType.SelectedIndex < 0) { return; } else { if (cmbFoodType.SelectedValue != null) { String sqlCommand = SqlQueries.GetQuery(Query.ViewCategory2ByCat1); sqlCommand = String.Format(sqlCommand, foodTypeID); CDalConfig oTempDal = ConfigManager.GetConfig <CDalConfig>(); String tempConnStr = oTempDal.ConnectionString; // Create a new data adapter based on the specified query. SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlCommand, tempConnStr); // Create a command builder to generate SQL update, insert, and // delete commands based on selectCommand. These are used to // update the database. SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter); // Populate a new data table and bind it to the BindingSource. DataTable table = new DataTable(); table.Locale = System.Globalization.CultureInfo.InvariantCulture; dataAdapter.Fill(table); cmbCategory.DataSource = table; cmbCategory.Text = m_sCategoryText; dataAdapter.Dispose(); } } }
public virtual async Task SetCacheItemAsync(string key, byte[] value, DistributedCacheEntryOptions options, CancellationToken token = default) { token.ThrowIfCancellationRequested(); var utcNow = SystemClock.UtcNow; var absoluteExpiration = GetAbsoluteExpiration(utcNow, options); ValidateOptions(options.SlidingExpiration, absoluteExpiration); var(query, expiresAtTime) = SqlQueries.SetCacheItem(utcNow, options.SlidingExpiration, absoluteExpiration); using (var connection = new SQLiteConnection(ConnectionString)) using (var upsertCommand = new SQLiteCommand(query, connection)) { upsertCommand.Parameters .AddCacheItemId(key) .AddCacheItemValue(value) .AddSlidingExpirationInSeconds(options.SlidingExpiration) .AddAbsoluteExpiration(absoluteExpiration) .AddWithValue("ExpiresAtTime", DbType.DateTimeOffset, expiresAtTime.ToString("o")); await connection.OpenAsync(token).ConfigureAwait(false); try { await upsertCommand.ExecuteNonQueryAsync(token).ConfigureAwait(false); } catch (SQLiteException ex) { // There is a possibility that multiple requests can try to add the same item to the cache, in which case we receive a 'duplicate key' exception on the primary key column. if (IsDuplicateKeyException(ex)) { } else { throw; } } } }
protected void Button1_Click(object sender, EventArgs e) { if (TextBox1.Text == TextBox2.Text) { if (SqlQueries.updatePassword(TextBox4.Text, TextBox1.Text, TextBox3.Text) == 1) { TextBox4.BackColor = System.Drawing.Color.White; TextBox1.BackColor = System.Drawing.Color.White; TextBox2.BackColor = System.Drawing.Color.White; Label1.Text = "Password successfully updated."; } else { TextBox4.BackColor = System.Drawing.Color.Red; TextBox1.BackColor = System.Drawing.Color.Red; Label1.Text = "Failed to update password."; } } else { Label1.Text = "Passwords entered do not match."; TextBox2.BackColor = System.Drawing.Color.Red; } }
public List <Employee> GetAllEmployee() { List <Employee> aEmployees = new List <Employee>(); try { this.OpenConnection(); string sqlComm = string.Format(SqlQueries.GetQuery(Query.GetAllEmployee)); IDataReader aReader = this.ExecuteReader(sqlComm); if (aReader != null) { while (aReader.Read()) { Employee aEmployee = new Employee(); aEmployee = ReadToEmployee(aReader); aEmployees.Add(aEmployee); } } } catch (Exception) { } return(aEmployees); }
private CResult GetMaxCatOrder() { CResult oResult = new CResult(); try { this.OpenConnection(); string sSql = SqlQueries.GetQuery(Query.GetMaxCat4Order); IDataReader oReader = this.ExecuteReader(sSql); if (oReader != null) { if (oReader.Read()) { if (oReader["max_cat4_order"] != null) { int iTempInt = Int32.Parse(oReader["max_cat4_order"].ToString()); oResult.Data = iTempInt; oResult.IsSuccess = true; } } } } catch (Exception ex) { Logger.Write("Exception : " + ex + " in ItemGetById()", LogLevel.Error, "Database"); oResult.IsException = true; } finally { this.CloseConnection(); } return(oResult); }
private CResult GetCategory2Order(int inCat2ID) { CResult oResult = new CResult(); try { this.OpenConnection(); string sSql = string.Format(SqlQueries.GetQuery(Query.GetCategory23Order), inCat2ID); IDataReader oReader = this.ExecuteReader(sSql); if (oReader != null) { if (oReader.Read()) { // int iTempInt = Int32.Parse(oReader["cat2_order"].ToString()); CCat4Rank oTempCat4Rank = ReaderToCat4Rank2(oReader); oResult.Data = oTempCat4Rank; oResult.IsSuccess = true; } } } catch (Exception ex) { Logger.Write("Exception : " + ex + " in ItemGetById()", LogLevel.Error, "Database"); oResult.IsException = true; } finally { this.CloseConnection(); } return(oResult); }
public List <Supplier1> GetAllSupplier() { List <Supplier1> aSuppliers = new List <Supplier1>(); try { this.OpenConnection(); string sqlComm = string.Format(SqlQueries.GetQuery(Query.GetAllSupplier1)); IDataReader aReader = this.ExecuteReader(sqlComm); if (aReader != null) { while (aReader.Read()) { Supplier1 aSupplier1 = new Supplier1(); aSupplier1 = ReadToSupplier(aReader); aSuppliers.Add(aSupplier1); } } } catch (Exception) { } return(aSuppliers); }