예제 #1
0
        private void OnEditThuoc()
        {
            if (dgChiTiet.SelectedRows == null || dgChiTiet.SelectedRows.Count <= 0)
            {
                MsgBox.Show(Application.ProductName, "Vui lòng chọn 1 thuốc.", IconType.Information);
                return;
            }

            LoaiToaThuoc     type    = raToaChung.Checked ? LoaiToaThuoc.Chung : LoaiToaThuoc.SanKhoa;
            DataRow          drThuoc = (dgChiTiet.SelectedRows[0].DataBoundItem as DataRowView).Row;
            dlgAddThuocKeToa dlg     = new dlgAddThuocKeToa(drThuoc, type);
            DataTable        dt      = (DataTable)dgChiTiet.DataSource;

            dlg.DataSource = dt;
            if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                if (dlg.ChiTietToaThuoc.ThuocGUID != null && dlg.ChiTietToaThuoc.ThuocGUID.HasValue)
                {
                    drThuoc["ThuocGUID"] = dlg.ChiTietToaThuoc.ThuocGUID;
                }
                else
                {
                    drThuoc["ThuocGUID"] = DBNull.Value;
                }

                drThuoc["TenThuoc"]            = dlg.TenThuoc;
                drThuoc["SoLuong"]             = dlg.ChiTietToaThuoc.SoLuong;
                drThuoc["Sang"]                = dlg.ChiTietToaThuoc.Sang;
                drThuoc["SangNote"]            = dlg.ChiTietToaThuoc.SangNote;
                drThuoc["Trua"]                = dlg.ChiTietToaThuoc.Trua;
                drThuoc["TruaNote"]            = dlg.ChiTietToaThuoc.TruaNote;
                drThuoc["Chieu"]               = dlg.ChiTietToaThuoc.Chieu;
                drThuoc["ChieuNote"]           = dlg.ChiTietToaThuoc.ChieuNote;
                drThuoc["Toi"]                 = dlg.ChiTietToaThuoc.Toi;
                drThuoc["ToiNote"]             = dlg.ChiTietToaThuoc.ToiNote;
                drThuoc["TruocAn"]             = dlg.ChiTietToaThuoc.TruocAn;
                drThuoc["TruocAnNote"]         = dlg.ChiTietToaThuoc.TruocAnNote;
                drThuoc["SauAn"]               = dlg.ChiTietToaThuoc.SauAn;
                drThuoc["SauAnNote"]           = dlg.ChiTietToaThuoc.SauAnNote;
                drThuoc["Khac_TruocSauAn"]     = dlg.ChiTietToaThuoc.Khac_TruocSauAn;
                drThuoc["Khac_TruocSauAnNote"] = dlg.ChiTietToaThuoc.Khac_TruocSauAnNote;
                drThuoc["Uong"]                = dlg.ChiTietToaThuoc.Uong;
                drThuoc["UongNote"]            = dlg.ChiTietToaThuoc.UongNote;
                drThuoc["Boi"]                 = dlg.ChiTietToaThuoc.Boi;
                drThuoc["BoiNote"]             = dlg.ChiTietToaThuoc.BoiNote;
                drThuoc["Dat"]                 = dlg.ChiTietToaThuoc.Dat;
                drThuoc["DatNote"]             = dlg.ChiTietToaThuoc.DatNote;
                drThuoc["Khac_CachDung"]       = dlg.ChiTietToaThuoc.Khac_CachDung;
                drThuoc["Khac_CachDungNote"]   = dlg.ChiTietToaThuoc.Khac_CachDungNote;
                drThuoc["LieuDung"]            = dlg.ChiTietToaThuoc.LieuDung;
                drThuoc["Note"]                = dlg.ChiTietToaThuoc.Note;

                if (dlg.ChiTietToaThuoc.CreatedDate.HasValue)
                {
                    drThuoc["CreatedDate"] = dlg.ChiTietToaThuoc.CreatedDate;
                }

                if (dlg.ChiTietToaThuoc.CreatedBy.HasValue)
                {
                    drThuoc["CreatedBy"] = dlg.ChiTietToaThuoc.CreatedBy.ToString();
                }

                if (dlg.ChiTietToaThuoc.UpdatedDate.HasValue)
                {
                    drThuoc["UpdatedDate"] = dlg.ChiTietToaThuoc.UpdatedDate;
                }

                if (dlg.ChiTietToaThuoc.UpdatedBy.HasValue)
                {
                    drThuoc["UpdatedBy"] = dlg.ChiTietToaThuoc.UpdatedBy.ToString();
                }

                if (dlg.ChiTietToaThuoc.DeletedDate.HasValue)
                {
                    drThuoc["DeletedDate"] = dlg.ChiTietToaThuoc.DeletedDate;
                }

                if (dlg.ChiTietToaThuoc.DeletedBy.HasValue)
                {
                    drThuoc["DeletedBy"] = dlg.ChiTietToaThuoc.DeletedBy.ToString();
                }

                drThuoc["ChiTietToaThuocStatus"] = dlg.ChiTietToaThuoc.Status;
            }
        }
예제 #2
0
        private void OnAddThuoc()
        {
            LoaiToaThuoc     type = raToaChung.Checked ? LoaiToaThuoc.Chung : LoaiToaThuoc.SanKhoa;
            dlgAddThuocKeToa dlg  = new dlgAddThuocKeToa(type);
            DataTable        dt   = (DataTable)dgChiTiet.DataSource;

            dlg.DataSource = dt;
            if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                DataRow newRow = dt.NewRow();
                newRow["Checked"]             = false;
                newRow["ChiTietToaThuocGUID"] = dlg.ChiTietToaThuoc.ChiTietToaThuocGUID;
                if (dlg.ChiTietToaThuoc.ThuocGUID != null && dlg.ChiTietToaThuoc.ThuocGUID.HasValue)
                {
                    newRow["ThuocGUID"] = dlg.ChiTietToaThuoc.ThuocGUID;
                }
                else
                {
                    newRow["ThuocGUID"] = DBNull.Value;
                }

                newRow["TenThuoc"]            = dlg.TenThuoc;
                newRow["SoLuong"]             = dlg.ChiTietToaThuoc.SoLuong;
                newRow["Sang"]                = dlg.ChiTietToaThuoc.Sang;
                newRow["SangNote"]            = dlg.ChiTietToaThuoc.SangNote;
                newRow["Trua"]                = dlg.ChiTietToaThuoc.Trua;
                newRow["TruaNote"]            = dlg.ChiTietToaThuoc.TruaNote;
                newRow["Chieu"]               = dlg.ChiTietToaThuoc.Chieu;
                newRow["ChieuNote"]           = dlg.ChiTietToaThuoc.ChieuNote;
                newRow["Toi"]                 = dlg.ChiTietToaThuoc.Toi;
                newRow["ToiNote"]             = dlg.ChiTietToaThuoc.ToiNote;
                newRow["TruocAn"]             = dlg.ChiTietToaThuoc.TruocAn;
                newRow["TruocAnNote"]         = dlg.ChiTietToaThuoc.TruocAnNote;
                newRow["SauAn"]               = dlg.ChiTietToaThuoc.SauAn;
                newRow["SauAnNote"]           = dlg.ChiTietToaThuoc.SauAnNote;
                newRow["Khac_TruocSauAn"]     = dlg.ChiTietToaThuoc.Khac_TruocSauAn;
                newRow["Khac_TruocSauAnNote"] = dlg.ChiTietToaThuoc.Khac_TruocSauAnNote;
                newRow["Uong"]                = dlg.ChiTietToaThuoc.Uong;
                newRow["UongNote"]            = dlg.ChiTietToaThuoc.UongNote;
                newRow["Boi"]                 = dlg.ChiTietToaThuoc.Boi;
                newRow["BoiNote"]             = dlg.ChiTietToaThuoc.BoiNote;
                newRow["Dat"]                 = dlg.ChiTietToaThuoc.Dat;
                newRow["DatNote"]             = dlg.ChiTietToaThuoc.DatNote;
                newRow["Khac_CachDung"]       = dlg.ChiTietToaThuoc.Khac_CachDung;
                newRow["Khac_CachDungNote"]   = dlg.ChiTietToaThuoc.Khac_CachDungNote;
                newRow["LieuDung"]            = dlg.ChiTietToaThuoc.LieuDung;
                newRow["Note"]                = dlg.ChiTietToaThuoc.Note;

                if (dlg.ChiTietToaThuoc.CreatedDate.HasValue)
                {
                    newRow["CreatedDate"] = dlg.ChiTietToaThuoc.CreatedDate;
                }

                if (dlg.ChiTietToaThuoc.CreatedBy.HasValue)
                {
                    newRow["CreatedBy"] = dlg.ChiTietToaThuoc.CreatedBy.ToString();
                }

                if (dlg.ChiTietToaThuoc.UpdatedDate.HasValue)
                {
                    newRow["UpdatedDate"] = dlg.ChiTietToaThuoc.UpdatedDate;
                }

                if (dlg.ChiTietToaThuoc.UpdatedBy.HasValue)
                {
                    newRow["UpdatedBy"] = dlg.ChiTietToaThuoc.UpdatedBy.ToString();
                }

                if (dlg.ChiTietToaThuoc.DeletedDate.HasValue)
                {
                    newRow["DeletedDate"] = dlg.ChiTietToaThuoc.DeletedDate;
                }

                if (dlg.ChiTietToaThuoc.DeletedBy.HasValue)
                {
                    newRow["DeletedBy"] = dlg.ChiTietToaThuoc.DeletedBy.ToString();
                }

                newRow["ChiTietToaThuocStatus"] = dlg.ChiTietToaThuoc.Status;

                dt.Rows.Add(newRow);
                //SelectLastedRow();
            }
        }