private void InsertUpdateDataChiTiet(Int64 _idPhieu)
        {
            try
            {
                for (int i = 0; i < dgvChiTiet.Rows.Count; i++)
                {
                    CTThuocKhamDTO ctThuoc = new CTThuocKhamDTO();

                    ctThuoc.idPhieu = _idPhieu;

                    ctThuoc.idThuoc    = (int)dgvChiTiet.Rows[i].Cells["ColIDThuoc"].Value;
                    ctThuoc.idDVT      = (int)dgvChiTiet.Rows[i].Cells["ColIDDVT"].Value;
                    ctThuoc.idCachDung = (int)dgvChiTiet.Rows[i].Cells["ColIDCachDung"].Value;

                    ctThuoc.soLuong = Convert.ToDouble(dgvChiTiet.Rows[i].Cells["ColSoLuong"].Value.ToString());

                    if (Convert.ToInt16(dgvChiTiet.Rows[i].Cells["ColIDCT"].Value.ToString()) < 1)
                    {
                        ctThuoc_BUS.Insert(ctThuoc);
                    }
                    else
                    {
                        ctThuoc.id = (int)dgvChiTiet.Rows[i].Cells["ColIDCT"].Value;
                        ctThuoc_BUS.Update(ctThuoc);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Có sự cố! Vui lòng kiểm tra lại!", "Warning-CTThuoc", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Esempio n. 2
0
        public Int64 Insert(CTThuocKhamDTO _nv)
        {
            string[] str = new string[5];
            object[] val = new object[5];

            str[0] = "@idPhieu";
            str[1] = "@idThuoc";
            str[2] = "@soLuong";
            str[3] = "@idDVT";
            str[4] = "@idCachDung";

            val[0] = _nv.idPhieu;
            val[1] = _nv.idThuoc;
            val[2] = _nv.soLuong;
            val[3] = _nv.idDVT;
            val[4] = _nv.idCachDung;

            DataProvider dp = new DataProvider();

            return(dp.WriteDataAddParam("SP_InsertCTThuocKham", str, val, 50));
        }
Esempio n. 3
0
 public Int64 Delete(CTThuocKhamDTO _nv)
 {
     return(nvDAO.Delete(_nv.id));
 }
Esempio n. 4
0
 public Int64 Update(CTThuocKhamDTO _nv)
 {
     return(nvDAO.Update(_nv));
 }
Esempio n. 5
0
 public Int64 Insert(CTThuocKhamDTO _nv)
 {
     return(nvDAO.Insert(_nv));
 }