public int InsertEmployeeDetails(DaEmployee dacobject)
 {
     SqlCommand cmd = new SqlCommand("insert into tblEmployee(ename,Salary,did) values(@ename,@salary,@Did)", con);
     cmd.Parameters.AddWithValue("@ename", dacobject.Name);
     cmd.Parameters.AddWithValue("@salary", dacobject.Salary);
     cmd.Parameters.AddWithValue("@Did", dacobject.DepartmentId);
     con.Open();
     int i = cmd.ExecuteNonQuery();
     con.Close();
     return i;
 }
Exemple #2
0
        public int Delete(DaEmployee daobj)
        {
            SqlCommand cmd = new SqlCommand("sp_delete", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@Empid", daobj.Empid);
            con.Open();
            int i = cmd.ExecuteNonQuery();

            con.Close();
            return(i);
        }
Exemple #3
0
        public SqlDataReader EditEmployeeDetails(DaEmployee daobj)
        {
            if (con.State != ConnectionState.Closed)
            {
                con.Close();
            }
            SqlCommand cmd = new SqlCommand("sp_edit", con);

            con.Open();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@Empid", daobj.Empid);
            SqlDataReader dr = cmd.ExecuteReader();

            return(dr);
        }
Exemple #4
0
        public int InsertEmployee(DaEmployee daobj)
        {
            using (SqlCommand cmd = new SqlCommand("sp_inserrt", con))
            {
                con.Open();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@EmpName", daobj.EmpName);
                cmd.Parameters.AddWithValue("@UserName", daobj.UserName);
                cmd.Parameters.AddWithValue("@Password", daobj.Password);
                cmd.Parameters.AddWithValue("@ConfirmPassword", daobj.ConfirmPassword);
                cmd.Parameters.AddWithValue("@Gender", daobj.Gender);
                cmd.Parameters.AddWithValue("@PhoneNumber", daobj.PhoneNumber);
                cmd.Parameters.AddWithValue("@Emailid", daobj.Emailid);
                cmd.Parameters.AddWithValue("@Designation", daobj.Designation);
                cmd.Parameters.AddWithValue("@Empid", daobj.Empid);

                int i = cmd.ExecuteNonQuery();
                con.Close();
                return(i);
            }
        }
        public int InsertEmp(DaEmployee daobject)
      {
          daobject.Salary = GrossSalary();
          return daobject.InsertEmployeeDetails(daobject);

      }