public IActionResult Index() { List <Employee> employeeList1 = new List <Employee>(); string Query1 = "select employee_id,name,age,gender,phone,email,designation,employee.designation_id from employee inner join designation on employee.designation_id = designation.designation_id"; try { SqlDataReader reader = SqlDBOperation.Query(Query1); while (reader.Read()) { Employee emp = new Employee(); emp.EmpID = reader.GetInt32(0); emp.Name = reader.GetString(1); emp.Age = reader.GetInt32(2); emp.Gender = reader.GetString(3); emp.Phone = reader.GetString(4); emp.Email = reader.GetString(5); emp.DesignationName = reader.GetString(6); emp.DesignationID = reader.GetInt32(7); employeeList1.Add(emp); } }catch (Exception e) { } employeeList = employeeList1; return(View(employeeList1)); }
public ActionResult salaryEdit(int id) { Employee x = SqlDBOperation.GetSalary(id); return(View(x)); }
public IActionResult SalaryDetails(int id) { string Query1 = "select employee.employee_id,employee.name,SalaryDetails.salary_elements,SalaryDetails.value from SalaryDetails inner join employee on SalaryDetails.employee_id = employee.employee_id where employee.employee_id=" + id; SqlDataReader reader = SqlDBOperation.Query(Query1); Employee emp = new Employee(); emp.EmpID = id; while (reader.Read()) { string salary_elements = reader.GetString(2); if (salary_elements == "Basic_salary") { emp.EmpID = reader.GetInt32(0); emp.Name = reader.GetString(1); emp.BasicPay = reader.GetDecimal(3); } else if (salary_elements == "HRA") { emp.EmpID = reader.GetInt32(0); emp.Name = reader.GetString(1); emp.HRA = reader.GetDecimal(3); } else if (salary_elements == "TA") { emp.EmpID = reader.GetInt32(0); emp.Name = reader.GetString(1); emp.TA = reader.GetDecimal(3); } } return(View(emp)); }
public ActionResult Edit(int id, Employee collection) { SqlDBOperation.Update(collection); employeeList.Add(collection); return(RedirectToAction("Index")); }
public IActionResult Login(Login object1) { string query1 = " select (case when exists (select * from login where username = '******' and password='******') then 1 else 0 end) as flag"; int reader = SqlDBOperation.Query1(query1); if (reader == 1) { return(RedirectToAction("Index", "Home")); } else { return(View("Login")); } }
public IActionResult PayRoll(int id) { string Query2 = "select SalaryDetails.employee_id,employee.name, sum(value) from employee inner join SalaryDetails on employee.employee_id = SalaryDetails.employee_id where SalaryDetails.employee_id=" + id + " group by employee.name,SalaryDetails.employee_id "; SqlDataReader reader = SqlDBOperation.Query(Query2); Employee emp = new Employee(); emp.EmpID = id; while (reader.Read()) { emp.EmpID = reader.GetInt32(0); emp.Name = reader.GetString(1); emp.TotalSal = reader.GetDecimal(2); } emp.Salary = emp.TotalSal; return(View(emp)); }
public IActionResult Create(Employee collection) { SqlDBOperation.AddEmployee(collection); employeeList.Add(collection); return(RedirectToAction("/Index", employeeList)); }
public ActionResult Delete(Employee collection) { SqlDBOperation.Delete(collection.EmpID); return(RedirectToAction("Index")); }
public ActionResult salaryEdit(int id, Employee collection) { SqlDBOperation.UpdateSalary(collection); employeeList.Add(collection); return(RedirectToAction("Index", "Home", employeeList)); }
public IActionResult AddSalary(Employee collection) { SqlDBOperation.AddSalary(collection); employeeList3.Add(collection); return(RedirectToAction("Index", "Home", employeeList3)); }