private void LoadComboBox() { DataTable testType = new Select(TTestTypeList.Columns.TestTypeId, TTestTypeList.Columns.TestTypeName).From( TTestTypeList.Schema).ExecuteDataSet().Tables[0]; DataBinding.BindDataCombox(cboTestType, testType, TTestTypeList.Columns.TestTypeId, TTestTypeList.Columns.TestTypeName, "-----Chọn loại xét nghiệm-----"); DataTable userName = new Select(SysUser.Columns.PkSuid, SysUser.Columns.SFullName).From( SysUser.Schema).ExecuteDataSet().Tables[0]; var row = userName.NewRow(); row["PK_sUID"] = "ADMIN"; row["sFullName"] = "ADMIN"; userName.Rows.Add(row); DataBinding.BindDataCombox(cboUserName, userName, SysUser.Columns.SFullName, SysUser.Columns.PkSuid, "-----Chọn tài khoản-----"); //cboUserName.DataSource = userName; //cboUserName.ValueMember = TblUser.Columns.PkSuid; //cboUserName.DisplayMember = TblUser.Columns.PkSuid; DataTable reportType = new DataTable(); reportType.Columns.Add("reportTypeId"); reportType.Columns.Add("reportType"); for (int i = 0; i < 2; i++) { var rows = reportType.NewRow(); switch (i) { case 0: rows["reportTypeId"] = 0; rows["reportType"] = "Chi tiết"; break; case 1: rows["reportTypeId"] = 1; rows["reportType"] = "Tổng hợp"; break; } reportType.Rows.Add(rows); } DataBinding.BindData(cboReportType, reportType, "reportTypeId", "reportType"); cboReportType.SelectedIndex = 0; }
private void LoadAssignDoctor() { DataTable dtDoctor = new Select().From(LUser.Schema.Name).ExecuteDataSet().Tables[0]; DataRow dr = dtDoctor.NewRow(); dr[LUser.Columns.UserId] = -1; dr[LUser.Columns.UserName] = "-----Chọn Bác Sỹ-----"; dtDoctor.Rows.InsertAt(dr,0); DataBinding.BindData(cboAssignDoctor,dtDoctor,LUser.Columns.UserId,LUser.Columns.UserName); }
private void FillTestTypeList() { try { var dt = new Select(TTestTypeList.Columns.TestTypeId, TTestTypeList.Columns.TestTypeName).From( TTestTypeList.Schema.Name).ExecuteDataSet().Tables[0]; var dr = dt.NewRow(); dr[TTestTypeList.Columns.TestTypeId] = -1; dr[TTestTypeList.Columns.TestTypeName] = "Tất Cả"; dt.Rows.InsertAt(dr,0); cboTestTypeList.DataSource = dt; cboTestTypeList.DisplayMember = TTestTypeList.Columns.TestTypeName; cboTestTypeList.ValueMember = TTestTypeList.Columns.TestTypeId; cboTestTypeList.SelectedIndex = 0; } catch (Exception ex) { Utility.ShowMsg("Lỗi khi nạp danh sách các loại xét nghiệm", "Thông báo", MessageBoxIcon.Error); } }