public static List <GetEmployeeSearch> EmpAdvanceSearchByName(GetEmployeeSearch Employee) { SqlConnection con = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); List <GetEmployeeSearch> details = new List <GetEmployeeSearch>(); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "HRMIS_ProEmpAdvanceSearchByName"; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = con; cmd.Parameters.Add("@Name", SqlDbType.NVarChar).Value = Employee.Name; SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); foreach (DataRow dtrow in dt.Rows) { GetEmployeeSearch obj = new GetEmployeeSearch(); obj.Employee_ID = dtrow["EmployeeID"].ToString(); obj.Name = dtrow["Name"].ToString(); obj.Father_Name = dtrow["Father_Name"].ToString(); obj.Grand_Father_Name = dtrow["Grand_Father_Name"].ToString(); obj.Gender = dtrow["Gender"].ToString(); obj.Personal_Mobile_Number = dtrow["PersonalMobileNumber"].ToString(); obj.E_Grade_Name = dtrow["E_Grade_Name"].ToString(); obj.Main_Course_of_Study = dtrow["MainCourseofStudy"].ToString(); obj.Specialization = dtrow["Specialization"].ToString(); obj.Present_Province_Name = dtrow["Present_Province_Name"].ToString(); obj.Present_District_Name = dtrow["Present_District_Name"].ToString(); obj.Present_Village = dtrow["PresentVillage"].ToString(); details.Add(obj); } return(details); }
public static List <GetEmployeeSearch> GetEmployeeInfo(string EmpID) { SqlConnection con = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); List <GetEmployeeSearch> details = new List <GetEmployeeSearch>(); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "HRMIS_ProGetEmployeeInfoByEmpID"; cmd.Parameters.Add("@Employee_ID", SqlDbType.NVarChar).Value = EmpID; cmd.Connection = con; SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); foreach (DataRow dtrow in dt.Rows) { GetEmployeeSearch obj = new GetEmployeeSearch(); obj.Employee_ID = dtrow["EmployeeID"].ToString(); obj.Name = dtrow["Name"].ToString(); obj.Father_Name = dtrow["Father_Name"].ToString(); obj.Grand_Father_Name = dtrow["Grand_Father_Name"].ToString(); details.Add(obj); } // Newtonsoft.Json.js return(details); }