Exemplo n.º 1
0
 private void gridControl_ChiCuc_ProcessGridKey(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Delete && gridView_ChiCuc.State != DevExpress.XtraGrid.Views.Grid.GridState.Editing)
     {
         if (XtraMessageBox.Show("Bạn có muốn xóa danh mục này hay không?", "Bệnh viện điện tử .NET", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.No)
         {
             try
             {
                 if (BioBLL.DelChiCuc(gridView_ChiCuc.GetRowCellValue(gridView_ChiCuc.FocusedRowHandle, "MaChiCuc").ToString()))
                 {
                     this.gridControl_ChiCuc.DataSource = BioBLL.GetListChiCuc();
                 }
                 else
                 {
                     XtraMessageBox.Show("Xóa danh mục thất bại!", "Bệnh viện điện tử .NET", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             catch
             {
                 XtraMessageBox.Show("Xóa danh mục thất bại!", "Bệnh viện điện tử .NET", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return;
             }
         }
     }
 }
Exemplo n.º 2
0
        private void FrmDMDonViCoSo_Load(object sender, EventArgs e)
        {
            this.repositoryItemLookUpEdit_ChiCuc.DataSource    = BioBLL.GetListChiCuc();
            this.repositoryItemLookUpEdit_ChiCuc.ValueMember   = "MaChiCuc";
            this.repositoryItemLookUpEdit_ChiCuc.DisplayMember = "TenChiCuc";

            DataTable dtkq = new DataTable();

            dtkq.Columns.Add("id", typeof(int));
            dtkq.Columns.Add("name", typeof(string));
            dtkq.Rows.Add(1, "Theo trung tâm");
            dtkq.Rows.Add(2, "Theo đơn vị");
            dtkq.Rows.Add(3, "Theo đơn vị kiểu 2");
            this.repositoryItemLookUpEdit_KieuTraKetQua.DataSource    = dtkq;
            this.repositoryItemLookUpEdit_KieuTraKetQua.DisplayMember = "name";
            this.repositoryItemLookUpEdit_KieuTraKetQua.ValueMember   = "id";

            this.gridControl_DonViCoSo.DataSource = BioBLL.GetListDonViCoSo();
        }
Exemplo n.º 3
0
 private void gridView_ChiCuc_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
 {
     try
     {
         GridView view     = sender as GridView;
         int      rowfocus = e.RowHandle;
         if (string.IsNullOrEmpty(Convert.ToString(view.GetRowCellValue(rowfocus, col_th_TenChiCuc))))
         {
             e.Valid = false;
             view.SetColumnError(col_th_TenChiCuc, "Tên chi cục không được để trống!");
         }
         if (e.Valid)
         {
             byte[]          byteNull = ASCIIEncoding.ASCII.GetBytes("");
             PSDanhMucChiCuc chiCuc   = new PSDanhMucChiCuc();
             if (string.IsNullOrEmpty(gridView_ChiCuc.GetRowCellValue(e.RowHandle, "RowIDChiCuc").ToString()))
             {
                 chiCuc.RowIDChiCuc = 0;
             }
             else
             {
                 chiCuc.RowIDChiCuc = Convert.ToInt32(gridView_ChiCuc.GetRowCellValue(e.RowHandle, "RowIDChiCuc").ToString());
             }
             chiCuc.MaChiCuc     = gridView_ChiCuc.GetRowCellValue(e.RowHandle, "MaChiCuc").ToString();
             chiCuc.TenChiCuc    = gridView_ChiCuc.GetRowCellValue(e.RowHandle, "TenChiCuc").ToString();
             chiCuc.DiaChiChiCuc = gridView_ChiCuc.GetRowCellValue(e.RowHandle, "DiaChiChiCuc").ToString();
             chiCuc.SdtChiCuc    = gridView_ChiCuc.GetRowCellValue(e.RowHandle, "SdtChiCuc").ToString();
             if (string.IsNullOrEmpty(gridView_ChiCuc.GetRowCellValue(e.RowHandle, "Logo").ToString()))
             {
                 chiCuc.Logo = new Binary(byteNull);
             }
             else
             {
                 chiCuc.Logo = (Binary)gridView_ChiCuc.GetRowCellValue(e.RowHandle, "Logo");
             }
             if (string.IsNullOrEmpty(gridView_ChiCuc.GetRowCellValue(e.RowHandle, "HeaderReport").ToString()))
             {
                 chiCuc.HeaderReport = new Binary(byteNull);
             }
             else
             {
                 chiCuc.HeaderReport = (Binary)gridView_ChiCuc.GetRowCellValue(e.RowHandle, "HeaderReport");
             }
             if (string.IsNullOrEmpty(gridView_ChiCuc.GetRowCellValue(e.RowHandle, "Stt").ToString()))
             {
                 chiCuc.Stt = 0;
             }
             else
             {
                 chiCuc.Stt = Convert.ToInt16(gridView_ChiCuc.GetRowCellValue(e.RowHandle, "Stt").ToString());
             }
             if (string.IsNullOrEmpty(gridView_ChiCuc.GetRowCellValue(e.RowHandle, "isLocked").ToString()))
             {
                 chiCuc.isLocked = false;
             }
             else
             {
                 chiCuc.isLocked = Convert.ToBoolean(gridView_ChiCuc.GetRowCellValue(e.RowHandle, "isLocked").ToString());
             }
             if (e.RowHandle < 0)
             {
                 string codeGen = BioBLL.GetCodeChiCuc();
                 if (XtraMessageBox.Show("Danh mục chi cục bạn thêm có mã tự động là " + codeGen + " bạn có muốn thay đổi không?", "Bệnh viện điện tử .NET", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.No)
                 {
                     int result = 0;
                     do
                     {
                         codeGen = this.InputForm(codeGen);
                         if (CheckCodeExist(codeGen))
                         {
                             chiCuc.MaChiCuc = codeGen;
                             result          = 0;
                         }
                         else
                         {
                             result = 1;
                         }
                     } while (result == 1);
                 }
                 else
                 {
                     chiCuc.MaChiCuc = codeGen;
                 }
                 if (BioBLL.InsChiCuc(chiCuc))
                 {
                     XtraMessageBox.Show("Thêm mới chi cục thành công!", "Bệnh viện điện tử .NET", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
                     XtraMessageBox.Show("Thêm mới chi cục thất bại!", "Bệnh viện điện tử .NET", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 if (BioBLL.UpdChiCuc(chiCuc))
                 {
                     XtraMessageBox.Show("Cập nhật chi cục thành công!", "Bệnh viện điện tử .NET", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
                     XtraMessageBox.Show("Cập nhật chi cục thất bại!", "Bệnh viện điện tử .NET", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             this.gridControl_ChiCuc.DataSource = BioBLL.GetListChiCuc();
         }
     }
     catch { XtraMessageBox.Show("Thao tác thất bại!", "Bệnh viện điện tử .NET", MessageBoxButtons.OK, MessageBoxIcon.Error); }
 }
Exemplo n.º 4
0
 private void FrmDMChiCuc_Load(object sender, EventArgs e)
 {
     this.gridControl_ChiCuc.DataSource = BioBLL.GetListChiCuc();
 }