public List <emp_payModel> emp_pay(string emp) { List <emp_payModel> obj = new List <emp_payModel>(); List <string> ls = new List <string>(); List <string> le = new List <string>(); string dt = DateTime.Now.ToString("yyyy-MM", EN); using (SqlConnection conn = new SqlConnection(connect.sqlConnection)) { conn.Open(); SqlCommand cmd = new SqlCommand("SELECT pay_start_date, pay_end_date FROM tab_emp_pay WHERE pay_ref_emp_id = '" + emp + "' AND pay_status = 'Y' AND pay_start_date >= '" + dt + "-01' GROUP BY pay_start_date , pay_end_date", conn); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { emp_payModel pay = new emp_payModel(); pay.pay_start_date = Convert.ToDateTime(rdr["pay_start_date"]).ToString("dd MMMM yyyy"); pay.pay_end_date = Convert.ToDateTime(rdr["pay_end_date"]).ToString("dd MMMM yyyy"); pay.start = Convert.ToDateTime(rdr["pay_start_date"]).ToString("yyyy-MM-dd", EN);; pay.end = Convert.ToDateTime(rdr["pay_end_date"]).ToString("yyyy-MM-dd", EN); obj.Add(pay); } } return(obj); }
public List <emp_payModel> select_pay(string emp) { List <emp_payModel> obj = new List <emp_payModel>(); using (SqlConnection conn = new SqlConnection(connectionString())) { conn.Open(); SqlCommand cmd = new SqlCommand("SELECT * FROM tab_emp_pay INNER JOIN tab_info_income ON tab_info_income.income_id = pay_ref_income_id WHERE pay_ref_emp_id = '" + emp + "'", conn); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { emp_payModel pay = new emp_payModel(); pay.pay_id = rdr["pay_id"].ToString(); pay.pay_ref_income_id = rdr["pay_ref_income_id"].ToString(); pay.pay_income_name = rdr["income_name"].ToString(); pay.pay_amount = rdr["pay_amount"].ToString(); pay.pay_ref_emp_id = rdr["pay_ref_emp_id"].ToString(); pay.pay_admin_id = rdr["pay_admin_id"].ToString(); pay.pay_submit_date = rdr["pay_submit_date"].ToString(); obj.Add(pay); } conn.Close(); } return(obj); }