Ejemplo n.º 1
0
        public bool nhacungcap_delete(nhacungcap data)
        {
            try
            {
                using (SqlConnection conn = getConnect())
                {
                    SqlCommand cmd = new SqlCommand("NhaCungCap_Delete", conn);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@MANCC", data.mancc));


                    cmd.ExecuteNonQuery();
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        public List <nhacungcap> nhacungcap_getAll()
        {
            List <nhacungcap> lst = new List <nhacungcap>();

            using (SqlConnection conn = getConnect())
            {
                SqlCommand cmd = new SqlCommand("NhaCungCap_Select", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        nhacungcap obj = new nhacungcap();
                        obj.nhacungcap_datareader(dr);
                        lst.Add(obj);
                    }
                }
            }
            return(lst);
        }
Ejemplo n.º 3
0
        public bool nhacungcap_update(nhacungcap data)
        {
            try
            {
                using (SqlConnection conn = getConnect())
                {
                    SqlCommand cmd = new SqlCommand("NhaCungCap_Update", conn);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@MANCC", data.mancc));
                    cmd.Parameters.Add(new SqlParameter("@TENNCC", data.tenncc));
                    cmd.Parameters.Add(new SqlParameter("@DIACHI", data.diachi));
                    cmd.Parameters.Add(new SqlParameter("@DIENTHOAI", data.dienthoai));

                    cmd.ExecuteNonQuery();
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        }