public List<Entity> getEmployee() { //List<Employee> EMP = new List<Employee>(); //con.Open(); //SqlCommand cmd; //string str = "Select * From Emp"; //cmd = new SqlCommand(str, con); //SqlDataReader rdr = cmd.ExecuteReader(); //while (rdr.Read()) //{ // Employee empdata = new Employee(); // empdata.Employeeid = Convert.ToInt32(rdr["Employeeid"]); // empdata.Firstname = Convert.ToString(rdr["Firstname"]); // empdata.Lastname = Convert.ToString(rdr["Lastname"]); // empdata.Birthdate = Convert.ToString(rdr["Birthdate"]); // empdata.Sex = Convert.ToString(rdr["Sex"]); // EMP.Add(empdata); //} //con.Close(); Business bl = new Business(); return bl.SelectEmployee().ToList(); //return EMP.ToList(); }
public List<Entity> SelectAll() { Business bb = new Business(); return bb.SelectEmployee(); //return getemp.ToList(); }
public void CheckId() { Business b = new Business(); ent.Employeeid = 2; int i = b.GetId(ent); Assert.AreEqual(1, i); }
public void CheckAge() { Business b = new Business(); ent.Birthdate = "5/5/1988 00:00:00"; //string birth = "10/19/2005 00:00:00"; int i = b.CheckAge(ent); Assert.AreEqual(1, i); }
public void TestCreate() { Business b = new Business(); ent.Employeeid = 27; ent.Firstname = "Prakash"; ent.Lastname = "Pawar"; ent.Birthdate = "5/5/1945"; ent.Sex = "Male"; int i= b.CreateEmp(ent); Assert.AreEqual(1, i); }
public int CreateEmp(Entity emp) { //con.Open(); //SqlCommand cmd = new SqlCommand("insert into Emp(Employeeid,Firstname,Lastname,Birthdate,Sex) values(@Eid,@First,@Last,@Birth,@Esex)", con); //cmd.Parameters.AddWithValue("@Eid", emp.Employeeid); //cmd.Parameters.AddWithValue("@First", emp.Firstname); //cmd.Parameters.AddWithValue("@Last", emp.Lastname); //cmd.Parameters.AddWithValue("@Birth", emp.Birthdate); //cmd.Parameters.AddWithValue("@Esex", emp.Sex); //int i = cmd.ExecuteNonQuery(); //con.Close(); //if (i > 0) //{ // return "Record Insert Successfully"; //} //else //{ // return " Error In Record Insertion"; //} Business bl = new Business(); return bl.CreateEmp(emp); }
public int Employee(Entity ent) { Business b = new Business(); return b.CreateEmp(ent); }