Exemplo n.º 1
0
        public NV_DonViTuBo_ChiTiet GetById(int id)
        {
            using (SqlConnection myConnection = new SqlConnection(ConnectionString))
            {
                using (SqlCommand myCommand = new SqlCommand("NV_DonViTuBo_getByID", myConnection))
                {
                    myCommand.CommandType = CommandType.StoredProcedure;

                    SqlParameter pID = new SqlParameter("@id", SqlDbType.Int);
                    pID.Value = id;
                    myCommand.Parameters.Add(pID);

                    DataTable            dt;
                    NV_DonViTuBo_ChiTiet model = new NV_DonViTuBo_ChiTiet();

                    myConnection.Open();
                    using (SqlDataAdapter mData = new SqlDataAdapter(myCommand))
                    {
                        dt = new DataTable();
                        mData.Fill(dt);
                    }
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        model = new NV_DonViTuBo_ChiTiet(dt.Rows[0]);
                    }

                    return(model);
                }
            }
        }
Exemplo n.º 2
0
 public NV_KeHoachTuBo_ChiTiet()
 {
     ChuDauTu     = new NV_DonViTuBo_ChiTiet();
     CapQD        = new NV_DonViTuBo_ChiTiet();
     DonViGiamSat = new NV_DonViTuBo_ChiTiet();
     DonViThiCong = new NV_DonViTuBo_ChiTiet();
     DonViThietKe = new NV_DonViTuBo_ChiTiet();
 }
Exemplo n.º 3
0
        public bool update(NV_DonViTuBo_ChiTiet model)
        {
            using (SqlConnection myConnection = new SqlConnection(ConnectionString))
            {
                using (SqlCommand myCommand = new SqlCommand("NV_DonViTuBo_update", myConnection))
                {
                    myCommand.CommandType = CommandType.StoredProcedure;

                    SqlParameter pID = new SqlParameter("@DonViID", SqlDbType.Int);
                    pID.Value = model.DonViID;
                    myCommand.Parameters.Add(pID);

                    SqlParameter pTenDonVi = new SqlParameter("@TenDonVi", SqlDbType.NVarChar, 50);
                    pTenDonVi.Value = model.TenDonVi;
                    myCommand.Parameters.Add(pTenDonVi);

                    SqlParameter pNguoiDaiDien = new SqlParameter("@NguoiDaiDien", SqlDbType.NVarChar, 50);
                    pNguoiDaiDien.Value = model.NguoiDaiDien;
                    myCommand.Parameters.Add(pNguoiDaiDien);

                    SqlParameter pDiaChi = new SqlParameter("@DiaChi", SqlDbType.NVarChar, 500);
                    pDiaChi.Value = model.DiaChi;
                    myCommand.Parameters.Add(pDiaChi);

                    SqlParameter pSoDienThoai = new SqlParameter("@SoDienThoai", SqlDbType.NVarChar, 50);
                    pSoDienThoai.Value = model.SoDienThoai;
                    myCommand.Parameters.Add(pSoDienThoai);

                    SqlParameter pCapDonVi = new SqlParameter("@CapDonVi", SqlDbType.Int);
                    pCapDonVi.Value = model.CapDonVi;
                    myCommand.Parameters.Add(pCapDonVi);

                    SqlParameter pChungChiHanhNghe = new SqlParameter("@ChungChiHanhNghe", SqlDbType.NVarChar, 100);
                    pChungChiHanhNghe.Value = model.ChungChihanhNghe;
                    myCommand.Parameters.Add(pChungChiHanhNghe);

                    SqlParameter pGhiChu = new SqlParameter("@GhiChu", SqlDbType.NVarChar, 4000);
                    pGhiChu.Value = model.GhiChu;
                    myCommand.Parameters.Add(pGhiChu);


                    SqlParameter pFile = new SqlParameter("@File", SqlDbType.NVarChar, 200);
                    pFile.Value = model.File;
                    myCommand.Parameters.Add(pFile);

                    SqlParameter pChucNang = new SqlParameter("@ChucNang", SqlDbType.NVarChar, 20);
                    pChucNang.Value = model.ChucNang;
                    myCommand.Parameters.Add(pChucNang);
                    try
                    {
                        myConnection.Open();
                        myCommand.ExecuteNonQuery();
                        return(true);
                    }
                    catch
                    {
                        return(false);
                    }
                }
            }
        }