Esempio n. 1
0
        public bool update_theloai(BEL.BEL_theloai theloai)
        {
            bool ketqua = false;

            using (SqlConnection connect = new SqlConnection(connectionString.connectionstring))
            {
                try
                {
                    connect.Open();

                    string     query = "update theloai set the_loai=@the_loai,da_xoa=@daxoa where ma_the_loai=@matheloai";
                    SqlCommand cmd   = new SqlCommand(query, connect);
                    //SqlDataReader reader = null;
                    SqlParameter param_the_loai = new SqlParameter();
                    param_the_loai.ParameterName = "@the_loai";
                    param_the_loai.Value         = theloai.The_loai;

                    SqlParameter param = new SqlParameter();
                    param.ParameterName = "@daxoa";
                    param.Value         = 0;

                    SqlParameter param_ma_the_loai = new SqlParameter();
                    param_ma_the_loai.ParameterName = "@matheloai";
                    param_ma_the_loai.Value         = theloai.Ma_the_loai;
                    // SqlCommand cmd = new SqlCommand(query, connect);
                    cmd.Parameters.Add(param_the_loai);

                    cmd.Parameters.Add(param);
                    cmd.Parameters.Add(param_ma_the_loai);
                    if (cmd.ExecuteNonQuery() > 0)
                    {
                        ketqua = true;
                    }
                }
                catch (Exception err)
                {
                    throw;
                }
                finally
                {
                    connect.Close();
                }
            }
            return(ketqua);
        }
Esempio n. 2
0
        public bool insert_theloai(BEL.BEL_theloai theloai)
        {
            bool ketqua = false;

            using (SqlConnection connect = new SqlConnection(connectionString.connectionstring))
            {
                try
                {
                    connect.Open();

                    string     query = "insert into theloai(the_loai,da_xoa) values(@the_loai,@da_xoa)";
                    SqlCommand cmd   = new SqlCommand(query, connect);
                    //SqlDataReader reader = null;
                    SqlParameter param_the_loai = new SqlParameter();
                    param_the_loai.ParameterName = "@the_loai";
                    param_the_loai.Value         = theloai.The_loai;
                    SqlParameter param = new SqlParameter();
                    param.ParameterName = "@da_xoa";
                    param.Value         = 0;
                    // SqlCommand cmd = new SqlCommand(query, connect);
                    cmd.Parameters.Add(param_the_loai);

                    cmd.Parameters.Add(param);
                    // reader = cmd.ExecuteReader();
                    // data.Load(reader);
                    //SqlCommand command = new SqlCommand(sql, connect);
                    if (cmd.ExecuteNonQuery() > 0)
                    {
                        ketqua = true;
                    }
                }
                catch (Exception err)
                {
                }
                finally
                {
                    connect.Close();
                }
            }
            return(ketqua);
        }
Esempio n. 3
0
 public bool Suatheloai(BEL.BEL_theloai theloai)
 {
     DAL.DAL_theloai oject = new DAL.DAL_theloai();
     return(oject.update_theloai(theloai));
 }
Esempio n. 4
0
 public bool capnhat_tragthai_moi(BEL.BEL_theloai theloai)
 {
     DAL.DAL_theloai oject = new DAL.DAL_theloai();
     return(oject.capnhattrangthaimoi(theloai));
 }
Esempio n. 5
0
 public bool Themtheloai(BEL.BEL_theloai theloai)
 {
     DAL.DAL_theloai oject = new DAL.DAL_theloai();
     return(oject.insert_theloai(theloai));
 }