protected void saveButton_Click(object sender, EventArgs e) { EmployeeSalaryBillEntry employeeSalaryBillEntry = new EmployeeSalaryBillEntry(); employeeSalaryBillEntry.EmployeeDate = employeeDateTextBox.Value; string year = yearTextBox.Text; employeeSalaryBillEntry.EmployeeMonth = monthTypeDropDownList.SelectedValue; employeeSalaryBillEntry.EmployeeName = employeeNameDropDownList.SelectedValue; string salaryReduce = salaryReduceTextBox.Text; string bonus = bonusTextBox.Text; string salary = salaryTextBox.Text; employeeSalaryBillEntry.Remarks = remarksDropDownList.SelectedValue; if (employeeDateTextBox.Value == "" || yearTextBox.Text == "" || monthTypeDropDownList.Text == "" || employeeNameDropDownList.Text == "" || salaryReduceTextBox.Text == "" || bonusTextBox.Text == "" || salaryTextBox.Text == "" || remarksDropDownList.Text == "") { messageLabel.InnerText = "All Fields are Required!!"; } else { employeeSalaryBillEntry.EmployeeYear = Convert.ToDouble(year); employeeSalaryBillEntry.SalaryReduce = Convert.ToDouble(salaryReduce); employeeSalaryBillEntry.Bonus = Convert.ToDouble(bonus); employeeSalaryBillEntry.Salary = Convert.ToDouble(salary); messageLabel.InnerText = employeeSalaryBillEntryManager.Save(employeeSalaryBillEntry); } }
public string Save(EmployeeSalaryBillEntry employeeSalaryBillEntry) { if (employeeSalaryBillEntryGateway.Insert(employeeSalaryBillEntry) > 0) { return("Saved Successfully!!"); } return("Could Not Save data In Database!!"); }
private static void GetValue(EmployeeSalaryBillEntry employeeSalaryBillEntry, SqlDataReader reader) { employeeSalaryBillEntry.EmployeeSalaryBillEntryId = int.Parse(reader["id"].ToString()); employeeSalaryBillEntry.EmployeeDate = (reader["employee_date"].ToString()).Substring(0, 10); employeeSalaryBillEntry.EmployeeYear = Convert.ToDouble(reader["employee_year"].ToString()); employeeSalaryBillEntry.EmployeeMonth = reader["employee_month"].ToString(); employeeSalaryBillEntry.EmployeeName = reader["employee_id"].ToString(); employeeSalaryBillEntry.SalaryReduce = Convert.ToDouble(reader["salary_reduce"].ToString()); employeeSalaryBillEntry.Bonus = Convert.ToDouble(reader["bonus"].ToString()); employeeSalaryBillEntry.Salary = Convert.ToDouble(reader["salary"].ToString()); employeeSalaryBillEntry.Remarks = reader["remarks"].ToString(); }
private void GetValue(int k) { EmployeeSalaryBillEntry employeeSalaryBillEntry = employeeSalaryBillEntryManager.GetEmployees(k); employeeDateTextBox.Value = employeeSalaryBillEntry.EmployeeDate; yearTextBox.Text = employeeSalaryBillEntry.EmployeeYear.ToString(); monthTypeDropDownList.Text = employeeSalaryBillEntry.EmployeeMonth; employeeNameDropDownList.Text = employeeSalaryBillEntry.EmployeeName; salaryReduceTextBox.Text = employeeSalaryBillEntry.SalaryReduce.ToString(); bonusTextBox.Text = employeeSalaryBillEntry.Bonus.ToString(); salaryTextBox.Text = employeeSalaryBillEntry.Salary.ToString(); remarksDropDownList.Text = employeeSalaryBillEntry.Remarks; }
public int Insert(EmployeeSalaryBillEntry employeeSalaryBillEntry) { SqlConnection connection = new SqlConnection(connectionString); string query = "INSERT INTO tbl_employee_salary_entry VALUES('" + employeeSalaryBillEntry.EmployeeDate + "','" + employeeSalaryBillEntry.EmployeeYear + "','" + employeeSalaryBillEntry.EmployeeMonth + "','" + employeeSalaryBillEntry.EmployeeName + "','" + employeeSalaryBillEntry.SalaryReduce + "','" + employeeSalaryBillEntry.Bonus + "','" + employeeSalaryBillEntry.Salary + "','" + employeeSalaryBillEntry.Remarks + "')"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); int rowAffected = command.ExecuteNonQuery(); connection.Close(); return(rowAffected); }
public EmployeeSalaryBillEntry GetEmployees(int i) { SqlConnection connection = new SqlConnection(connectionString); string query = "SELECT * FROM tbl_employee_salary_entry ORDER BY id ASC OFFSET " + i + " ROWS FETCH NEXT 1 ROWS ONLY"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); EmployeeSalaryBillEntry employeeSalaryBillEntry = new EmployeeSalaryBillEntry(); while (reader.Read()) { GetValue(employeeSalaryBillEntry, reader); } reader.Close(); connection.Close(); return(employeeSalaryBillEntry); }
public List <EmployeeSalaryBillEntry> GetAllEmployeesBillEntryList() { SqlConnection connection = new SqlConnection(connectionString); string query = "Select * from tbl_employee_salary_entry"; connection.Open(); SqlCommand command = new SqlCommand(query, connection); SqlDataReader reader = command.ExecuteReader(); List <EmployeeSalaryBillEntry> employeeSalaryBillEntryList = new List <EmployeeSalaryBillEntry>(); while (reader.Read()) { EmployeeSalaryBillEntry employeeSalaryBillEntry = new EmployeeSalaryBillEntry(); GetValue(employeeSalaryBillEntry, reader); employeeSalaryBillEntryList.Add(employeeSalaryBillEntry); } reader.Close(); connection.Close(); return(employeeSalaryBillEntryList); }