Exemplo n.º 1
0
        public Boolean add(Model.yuangong y)
        {
            bool y1 = new bool();

            con.Open();

            SqlCommand com = new SqlCommand();

            com.CommandText = "insert into yuangong (工号,员工职位,员工姓名,密码) values('" + y.Id + "','" + y.Position + "','" + y.Name + "','" + y.Password + "')";
            com             = new SqlCommand(com.CommandText, con); //sqlcommand表示要向向数据库执行sql语句或存储过程
            int q = com.ExecuteNonQuery();                          //执行后返回记录行数

            if (q > 0)                                              //如果大于0,说明记录存在
            {
                y1 = true;
            }
            else
            {
                y1 = false;
            }
            return(y1);
        }
Exemplo n.º 2
0
        public bool delete(Model.yuangong y)
        {
            bool y1 = new bool();

            con.Open();

            SqlCommand com = new SqlCommand();

            com.CommandText = "delete yuangong where 工号='" + y.Id + "'";
            com             = new SqlCommand(com.CommandText, con); //sqlcommand表示要向向数据库执行sql语句或存储过程
            int q = com.ExecuteNonQuery();                          //执行后返回记录行数

            if (q > 0)                                              //如果大于0,说明记录存在
            {
                y1 = true;
            }
            else
            {
                y1 = false;
            }
            con.Close();
            return(y1);
        }
Exemplo n.º 3
0
 public bool delete(Model.yuangong y)
 {
     return(l.delete(y));
 }
Exemplo n.º 4
0
 public bool add(Model.yuangong y)
 {
     return(l.add(y));
 }