private void btnSearchReport_Click(object sender, EventArgs e) { int mhs_id = Convert1.ToInt32(DDsite.SelectedValue); int mrm_id = Convert1.ToInt32(DDStation.SelectedValue); ShowReport(mhs_id, mrm_id); }
private void Timecheck(MaskedTextBox txt, KeyEventArgs e) { if (e.KeyCode == Keys.Back || e.KeyCode == Keys.Enter || e.KeyCode == Keys.Delete) { return; } string[] timekey = txt.Text.ToString().Split(':'); int time1Houre = Convert1.ToInt32(timekey[0].Trim()); if (timekey[0].Trim().Length == 2) { if (time1Houre > 23) { time1Houre = 23; txt.Text = time1Houre.ToString() + ":" + timekey[1]; } } int time2Houre = Convert1.ToInt32(timekey[1].Trim()); if (timekey[1].Trim().Length == 2) { if (time2Houre > 59) { time2Houre = 59; txt.Text = time1Houre.ToString("00") + ":" + time2Houre.ToString(); } } }
private void GV_Null_Result_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1) { dbc.Connection.Close(); dbc = new InhCheckupDataContext(); Clearfrm(); SetTprID = Convert1.ToInt32(GV_Null_Result["Coltprid", e.RowIndex].Value); SetEN = Convert1.ToString(GV_Null_Result["EN", e.RowIndex].Value); CurrentRegis = (from t1 in dbc.trn_patient_regis where t1.tpr_id == SetTprID select t1).FirstOrDefault(); Program.CurrentRegis = CurrentRegis; if (CurrentRegis != null) { UIProfileHorizontal1.Loaddata(SetTprID, Program.CurrentSite.mhs_id); //new code// this.subjectiveUC1.PatientRegis = CurrentRegis; this.objectiveUC1.PatientRegis = CurrentRegis; this.tabAssessmentAndPlanUC1.PatientRegis = CurrentRegis; if (tabControl1.SelectedTab.Tag.ToString() != "1") { tabControl1.SelectedIndex = 0; } btnSaveDraft.Enabled = true; btnSendAuto.Enabled = true; } } }
private void GridPatient_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) { return; } string strEn = Convert1.ToString(GridPatient["ColEN", e.RowIndex].Value); var objcurrentRegi = (from t1 in dbc.trn_patient_regis where t1.tpr_en_no == strEn select t1).FirstOrDefault(); if (objcurrentRegi != null) { txtHN.Text = objcurrentRegi.trn_patient.tpt_hn_no; txtEN.Text = objcurrentRegi.tpr_en_no; txtFullName.Text = objcurrentRegi.trn_patient.tpt_othername; txtDOB.Text = objcurrentRegi.trn_patient.tpt_dob_text; //objcurrentRegi.trn_patient.tpt_dob.Value.ToString("dd/MM/yyyy"); txtGender.Text = (objcurrentRegi.trn_patient.tpt_gender == 'F') ? "Female" : "Male"; txtNationality.Text = objcurrentRegi.trn_patient.tpt_nation_desc; txtAge.Text = Program.CalculateAge(objcurrentRegi.trn_patient.tpt_dob.Value, Program.GetServerDateTime()); txtVisitDate.Text = (objcurrentRegi.tpr_arrive_date == null) ? "" : objcurrentRegi.tpr_arrive_date.Value.ToString("dd / MM / yyyy"); txtVisitTime.Text = (objcurrentRegi.tpr_arrive_date == null) ? "" : objcurrentRegi.tpr_arrive_date.Value.ToString("HH:mm:ss"); txtAllergy.Text = objcurrentRegi.trn_patient.tpt_allergy; PicProfile.Image = Program.byteArrayToImage(objcurrentRegi.trn_patient.tpt_image.ToArray()); DDsite.SelectedValue = 0; DDStation.SelectedValue = 0; ShowReport(0, 0); currentRegis = objcurrentRegi; } }
private void GvHealthSelect_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { try { var selectedItems = GvHealthSelect.CurrentRow; SelectedID = Convert1.ToInt32(GvHealthSelect.Rows[e.RowIndex].Cells[0].Value); strSelectedName = GvHealthSelect.Rows[e.RowIndex].Cells[1].Value.ToString(); this.Close(); } catch { return; } }
private int GetPort() { using (InhCheckupDataContext dbc = new InhCheckupDataContext()) { int objip = Convert1.ToInt32((from mfh in dbc.mst_config_hdrs join mfd in dbc.mst_config_dtls on mfh.mfh_id equals mfd.mfh_id where mfh.mfh_code == "PUD" && mfh.mhs_id == Program.CurrentSite.mhs_id && mfh.mfh_status == 'A' && mfh.mfh_effective_date.Value.Date <= DateTime.Now.Date && (mfh.mfh_expire_date == null ? DateTime.Now.Date : mfh.mfh_expire_date.Value.Date) >= DateTime.Now.Date && mfd.mfd_status == 'A' && mfd.mfd_effective_date.Value.Date <= DateTime.Now.Date && (mfd.mfd_expire_date == null ? DateTime.Now.Date : mfd.mfd_expire_date.Value.Date) >= DateTime.Now.Date select mfd.mfd_text).FirstOrDefault()); return(objip); } }
private void GridReport_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != -1) { if (GridReport.CurrentRow != null && GridReport.ReadOnly == false) { bool ischeck = Convert1.ToBoolean(GridReport[1, e.RowIndex].Value); if (ischeck == false) { GridReport[1, e.RowIndex].Value = true; } else { GridReport[1, e.RowIndex].Value = false; } } } }
private void SetUIProfileHorizontal1() { if (GV_Null_Result.RowCount > 0) { SetTprID = Convert1.ToInt32(GV_Null_Result["Coltprid", 0].Value); SetEN = Convert1.ToString(GV_Null_Result["EN", 0].Value); CurrentRegis = (from t1 in dbc.trn_patient_regis where t1.tpr_id == SetTprID select t1).FirstOrDefault(); if (CurrentRegis != null) { UIProfileHorizontal1.Loaddata(SetTprID, Program.CurrentSite.mhs_id); //this.LoadData(); this.subjectiveUC1.PatientRegis = CurrentRegis; this.objectiveUC1.PatientRegis = CurrentRegis; this.tabAssessmentAndPlanUC1.PatientRegis = CurrentRegis; } } }
private void DDsite_SelectedValueChanged(object sender, EventArgs e) { /* * select mrm.mrm_id, * mrm.mrm_ename * from mst_room_hdr mrm * where mrm.mhs_id = 1 * and mrm.mrm_status = 'A' * and CONVERT(date,GETDATE(),103) between * CONVERT(date,isnull(mrm.mrm_effective_date,getdate()),103) and * CONVERT(date,isnull(mrm.mrm_expire_date,getdate()),103); */ int msh_id = Convert1.ToInt32(DDsite.SelectedValue); var datenow = Program.GetServerDateTime().Date; List <mst_room_hdr> objRoom = (from t1 in dbc.mst_room_hdrs where t1.mrm_status == 'A' && (t1.mrm_effective_date == null || (t1.mrm_effective_date.Value.Date <= datenow && (t1.mrm_expire_date == null || t1.mrm_expire_date.Value.Date >= datenow) ) ) select t1).ToList(); if (msh_id > 0) { objRoom = objRoom.Where(x => x.mhs_id == msh_id).ToList(); } mst_room_hdr roomselect = new mst_room_hdr(); roomselect.mrm_id = 0; roomselect.mrm_ename = "Select All"; objRoom.Add(roomselect); DDStation.DataSource = objRoom.OrderBy(x => x.mhs_id).ToList(); DDStation.DisplayMember = "mrm_ename"; DDStation.ValueMember = "mrm_id"; if (msh_id == 0) { DDStation.SelectedValue = 0; } }
private void DDsiteToSend_SelectedValueChanged(object sender, EventArgs e) { if (siteid != Convert1.ToInt32(DDsiteToSend.SelectedValue)) { siteid = Convert1.ToInt32(DDsiteToSend.SelectedValue); try { int? mvt_id = Program.CurrentPatient_queue.mvt_id; string mvt_code = dbc.mst_events.Where(x => x.mvt_id == mvt_id).Select(x => x.mvt_code).FirstOrDefault(); int? mrm_id = Program.CurrentPatient_queue.mrm_id; string mrm_code = dbc.mst_room_hdrs.Where(x => x.mrm_id == mrm_id).Select(x => x.mrm_code).FirstOrDefault(); // Add Button in Gridview var objview = (from t1 in dbc.vw_patient_rooms where t1.mhs_id == siteid && t1.tpr_id == Program.CurrentRegis.tpr_id && (mrm_code == "CB" ? true : t1.mvt_code != mvt_code) select new ChoiceRoomGrid { mvt_id = t1.mvt_id, mhs_ename = t1.mhs_ename, mze_ename = t1.mze_ename, mrm_ename = t1.mrm_ename, mrm_id = t1.mrm_id, mrm_code = t1.mrm_code, mvt_code = t1.mvt_code, waiting_person = t1.waiting_person, waiting_time = t1.waiting_time, vip = t1.patient_vip }); dataGridView2.DataSource = new SortableBindingList <ChoiceRoomGrid>(objview.ToList()); } catch (Exception ex) { Program.MessageError("frmChoiceRoom", "DDsiteToSend_SelectedValueChanged", ex, false); } } }
private void selectedRoom() { DataGridViewRow row = dataGridView2.CurrentRow; int select_mrm_id = Convert.ToInt32(row.Cells["colRoomid"].Value.ToString()); //if (new EmrClass.GetDataMasterCls().GetMstRoomHdr((int)select_mrm_id).mrm_code == "DC") //{ //new Class.FunctionDataCls().stampPEDoctor(Program.CurrentRegis.tpr_id); //} int select_mvt_id = Convert.ToInt32(row.Cells["colmvtid"].Value.ToString()); int select_waiting_time = Convert1.ToInt32(row.Cells["ColWaitingTime"].Value); if (ProcessSelectRoom(select_mvt_id, select_mrm_id, select_waiting_time)) { select_mrmID = select_mrm_id; mvtID = select_mvt_id; WaitingTime = select_waiting_time; this.DialogResult = DialogResult.OK; } else { //this.DialogResult = DialogResult.Cancel; } }
private void btnPrintAllselect_Click(object sender, EventArgs e) { //previewRpt List <string> rptCode = new List <string>(); for (int i = 0; i <= GridReport.Rows.Count - 1; i++) { if (Convert1.ToBoolean(GridReport[1, i].Value) == true) { string ReportCode = Convert1.ToString(GridReport["ColReportCode", i].Value); rptCode.Add(ReportCode); } } if (rptCode.Count > 0) { Report.frmPreviewReport frm = new Report.frmPreviewReport(currentRegis.tpr_id, rptCode); //Report.frmPreviewReport._propertyReport prop = new Report.frmPreviewReport._propertyReport(); //prop.tpr_id = currentRegis.tpr_id; //prop.reportCode = rptCode; //frm.propertyReport = prop; frm.previewReport(); } //if (rptCode.Count > 0) ClsReport.previewRpt(currentRegis.tpr_id, rptCode); }
private void GridReportResult_CellClick(object sender, DataGridViewCellEventArgs e) { lbMsgAlert.Text = ""; if (e.RowIndex != -1) { int toc_id = Convert1.ToInt32(GridReportResult["Coltoc_id", e.RowIndex].Value); string HNno = GridReportResult["ColHN2", e.RowIndex].Value.ToString(); currentObste = (from t1 in dbc.trn_obstetric_chiefs where t1.toc_id == toc_id orderby t1.tpr_id descending select t1).FirstOrDefault(); var objcurrentRegis = (from t1 in dbc.trn_obstetric_chiefs where t1.toc_id == toc_id orderby t1.tpr_id descending select new { HN = t1.trn_patient_regi.trn_patient.tpt_hn_no, EN = t1.trn_patient_regi.tpr_en_no, FullName = t1.trn_patient_regi.trn_patient.tpt_othername, Arrivedate = t1.trn_patient_regi.tpr_arrive_date, CheckDocName = t1.toc_doc_name }).FirstOrDefault(); if (objcurrentRegis != null) { txtHNno.Text = HNno; txtENno.Text = objcurrentRegis.EN; txtName.Text = objcurrentRegis.FullName; txtArriveDate.Text = objcurrentRegis.Arrivedate.Value.ToString("dd/MM/yyyy"); txtDoctorCheck.Text = objcurrentRegis.CheckDocName; ch_ResultAlert.Enabled = true; DateTimeAlert.Enabled = true; txtRemark.Enabled = true; } } }
private void btnRebister_Click(object sender, EventArgs e) { frmBGScreen frmbg = new frmBGScreen(); frmbg.Show(); Application.DoEvents(); //Avation Type Value label18.ForeColor = Color.Black; if (Program.GetValueRadioTochar(GBPatienttype) == '2' || Program.GetValueRadioTochar(GBPatienttype) == '4') { var AvationtypeValue = Program.GetValueRadioTochar(GBAviationType); if (AvationtypeValue == null || CBAviationCategory.SelectedValue == null) { if (CBAviationCategory.SelectedValue == null) { lbAlertMsg.Text = "Avation Category must have value!"; } if (AvationtypeValue == null) { lbAlertMsg.Text = "Avation type must have value!"; } lbAlertMsg.Focus(); label18.ForeColor = Color.Red; frmbg.Close(); return; } } //check NEO Time Correct TimeSpan interval; bool isconvert = true; try { interval = TimeSpan.Parse(txtnpotimeRemark.Text.Trim()); } catch (FormatException) { isconvert = true; } catch (OverflowException) { isconvert = false; } if (RDnpotimeYes.Checked && (txtnpotimeRemark.Text.Trim().Length < 5 || isconvert == false)) { lbAlertMsg.Text = "NPO Time incorrect."; lbAlertMsg.Focus(); frmbg.Close(); return; } //Save Data try { Boolean saveIsCompleted = false; dbc.Connection.Open(); DbTransaction trans = dbc.Connection.BeginTransaction(); dbc.Transaction = trans; DateTime datenowvalue = Program.GetServerDateTime(); var objregis = (tmp_patient_regi)this.TmpPatientRegisBindingSource.Current; objregis.hn_no = HNno; objregis.appoint_date = AppointDate;//รับค่าจากปุ่มที่กดตอนเปิดหน้าจอ objregis.status = 'N'; if (CBAviationCategory.Enabled == true && CBAviationCategory.SelectedValue != null) { objregis.mac_id = Program.GetValueComboBoxInt(CBAviationCategory); } else { objregis.mac_id = null; } if (CBDoctorCategory.Enabled == true && CBDoctorCategory.SelectedValue != null) { objregis.mdc_id = Program.GetValueComboBoxInt(CBDoctorCategory); } else { objregis.mdc_id = null; } if (CBHealthCheckUPProgram.SelectedValue != null) { objregis.mhc_id = Convert1.ToInt32(CBHealthCheckUPProgram.SelectedValue); } else { objregis.mhc_id = null; } objregis.patient_type = Program.GetValueRadioTochar(GBPatienttype); objregis.req_pe_bef_chkup = Program.GetValueRadioTochar(GBRequestPEBefore); objregis.req_doctor = Program.GetValueRadioTochar(GBRequestPE); if (objregis.req_doctor == 'N') { objregis.req_doc_gender = null; objregis.req_inorout_doctor = string.Empty; objregis.req_doc_code = string.Empty; objregis.req_doc_name = string.Empty; } else { objregis.req_doc_gender = Program.GetValueRadioTochar(GBDoctorGender); objregis.req_inorout_doctor = Program.GetValueRadio(GBRequestDoctor); } if (RDPatientType_Aviation.Checked || RDPatientType_AviationAircrew.Checked) {//ถ้าเลือกAViation ค่อย Save objregis.aviation_type = Program.GetValueRadioTochar(GBAviationType); } objregis.pe_type = Program.GetValueRadioTochar(GBPEType); objregis.npo_time = Program.GetValueRadioTochar(GBNPOTime); objregis.send_book = Program.GetValueRadioTochar(GBBook); objregis.send_to = Program.GetValueRadioTochar(panelBookSendTo); objregis.vip_hpc = (chkviphpc.Checked) ? true : false;//Added.Akkaradech on 2013-12-24{viphpc} try { tmpoutdepartmentsBindingSource.EndEdit(); TmpPatientRegisBindingSource.EndEdit(); dbc.SubmitChanges(); dbc.Transaction.Commit(); saveIsCompleted = true; Iscompleted = true; } catch (Exception ex) { dbc.Transaction.Rollback(); Program.MessageError(this.Name, "btnRebister_Click", ex, false); } finally { dbc.Connection.Close(); } if (saveIsCompleted == true) { lbAlertMsg.Text = "Save data completed."; lbAlertMsg.Focus(); } } catch (Exception ex) { Program.MessageError(this.Name, "btnRebister_Click", ex, false); } //ปิดหน้าจอมืดๆๆ frmbg.Close(); }
//Grid Event private void GridResult_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex != -1) { string HNno = Convert1.ToString(GridResult["ColHN", e.RowIndex].Value); string En = Convert1.ToString(GridResult["Colen", e.RowIndex].Value); if (HNno != "") { btnSave.Enabled = true; btnClear.Enabled = true; btnPreview.Enabled = true; var objCurrentHN = (from t1 in dbc.trn_pfts where t1.trn_patient_regi.trn_patient.tpt_hn_no == HNno select t1).FirstOrDefault(); PFTbindingSource1.DataSource = objCurrentHN; if (objCurrentHN != null) { int tpr_id = objCurrentHN.tpr_id; UIProfileHorizontal1.Loaddata(tpr_id, objCurrentHN.trn_patient_regi.mhs_id);// Load Profile var objcurrentQuestionPatient = (from t1 in dbc.trn_ques_patients where t1.tpr_id == tpr_id select t1).FirstOrDefault(); QestionPatientbindingSource1.DataSource = objcurrentQuestionPatient; #region WaitingConfirm ////Load image HistoryData.showform = 'N'; //docscan.GetHistory("LR102", "", 4434); docscan.GetHistory("LR102", En, tpr_id); pictureBox_result.SizeMode = PictureBoxSizeMode.AutoSize; pictureBox_result.Image = docscan.resizeImage(HistoryData.newImage, new Size(450, 500)); if (pictureBox_result.Image == null) { btnSend.Enabled = false; btnPreview.Enabled = false; } else { btnSend.Enabled = true; btnPreview.Enabled = true; } ////EndLoad image // TestGetDocscan.ServiceSoapClient wsSaveDocscan = new TestGetDocscan.ServiceSoapClient(); //DataSet ds = new DataSet(); //ds = wsSaveDocscan.getDocumentList("0111006591", "O0113450939", "", "VVF", "A1"); //pictureBox_result.SizeMode = PictureBoxSizeMode.AutoSize; //pictureBox_result.Image = docscan.resizeImage(HistoryData.newImage, new Size(450, 500)); #endregion } } } } catch { return; } }
private bool SaveData() { bool isCompleted = false; try { DateTime dtnow = Program.GetServerDateTime(); trn_pft objcurrentpft = (trn_pft)PFTbindingSource1.Current; if (objcurrentpft.tpr_id == 0) { objcurrentpft.tpr_id = Program.CurrentRegis.tpr_id; } if (objcurrentpft.tpf_create_by == null) { objcurrentpft.tpf_create_by = Program.CurrentUser.mut_username; objcurrentpft.tpf_create_date = dtnow; } objcurrentpft.tpf_update_by = Program.CurrentUser.mut_username; objcurrentpft.tpf_update_date = dtnow; objcurrentpft.tpf_result = true; PictureBox p1 = new PictureBox(); using (Bitmap bitmap = new Bitmap(pictureBox_result.ClientSize.Width, pictureBox_result.ClientSize.Height)) { pictureBox_result.DrawToBitmap(bitmap, pictureBox_result.ClientRectangle); Bitmap bmp = new Bitmap(bitmap); p1.SizeMode = PictureBoxSizeMode.StretchImage; p1.Image = (Image)bmp; } MemoryStream stream = new MemoryStream(); p1.Image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg); byte[] img1 = stream.ToArray(); objcurrentpft.tpf_docscan_img = img1; trn_ques_patient objqp = (trn_ques_patient)QestionPatientbindingSource1.Current; //load เคยมีอาการหรือปัญหาเหล่านี้หรือไม่ if (objqp.tpr_id == 0) { objqp.tpr_id = Program.CurrentRegis.tpr_id; } objqp.tqp_symp_faint = Program.GetValueRadioTochar(pl_symp_faint); objqp.tqp_symp_shake = Program.GetValueRadioTochar(pl_symp_shake); objqp.tqp_symp_wind = Program.GetValueRadioTochar(pl_symp_wind); objqp.tqp_symp_breath = Program.GetValueRadioTochar(pl_symp_breath); objqp.tqp_symp_vein = Program.GetValueRadioTochar(pl_symp_vein); objqp.tqp_symp_paralysis = Program.GetValueRadioTochar(pl_symp_paralysis); // Load 5 objqp.tqp_his_smok = Program.GetValueGroupBox(gb_his_smok); if (objqp.tqp_his_smok == 'S') { objqp.tqp_his_smok_amt = Convert1.ToDouble(txt_his_smok_amt1.Text); objqp.tqp_his_smok_dur = Convert1.ToDouble(txt_his_smok_dur1.Text); } else if (objqp.tqp_his_smok == 'Q') { objqp.tqp_his_smok_amt = Convert1.ToDouble(txt_his_smok_amt2.Text); objqp.tqp_his_smok_dur = Convert1.ToDouble(txt_his_smok_dur2.Text); } //load 6.1 ไอ objqp.tqp_cur_ill_cough = Program.GetValueRadioTochar(pl2_cur_ill_cough); objqp.tqp_cur_ill_wcough = Program.GetValueRadioTochar(pl2_cur_ill_wcough); objqp.tqp_cur_ill_gcough = Program.GetValueRadioTochar(pl2_cur_ill_gcough); objqp.tqp_cur_ill_bcough = Program.GetValueRadioTochar(pl2_cur_ill_bcough); //6.2 เหนื่อยหอบ objqp.tqp_cur_ill_pant = Program.GetValueRadioTochar(pl3_cur_ill_pant); //ความถี่ของการเกิดอาการ objqp.tqp_pat_freq = Program.GetValueRadioTochar(pl4_pat_freq); if (objqp.tqp_create_by == null) { objqp.tqp_create_by = Program.CurrentUser.mut_username; objqp.tqp_create_date = dtnow; } objqp.tqp_update_by = Program.CurrentUser.mut_username; objqp.tqp_update_date = dtnow; PFTbindingSource1.EndEdit(); QestionPatientbindingSource1.EndEdit(); try { dbc.SubmitChanges(); } catch (System.Data.Linq.ChangeConflictException) { foreach (System.Data.Linq.ObjectChangeConflict occ in dbc.ChangeConflicts) { dbc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object); } dbc.SubmitChanges(); } isCompleted = true; } catch (Exception ex) { Program.MessageError(this.Name, "SaveData", ex, false); } return(isCompleted); }
private void frmChoiceRoom_Load(object sender, EventArgs e) { var objsite = (from t1 in dbc.mst_hpc_sites where t1.mhs_status == 'A' && t1.mhs_room_chkup == true select new DropdownData { Code = t1.mhs_id, Name = t1.mhs_ename }).ToList(); DDsiteToSend.DataSource = objsite; DDsiteToSend.DisplayMember = "Name"; DDsiteToSend.ValueMember = "Code"; if (Program.CheckPointBSiteUse == 0) { DDsiteToSend.SelectedValue = Program.CurrentSite.mhs_id; } else { DDsiteToSend.SelectedValue = Program.CheckPointBSiteUse; //Program.CurrentSite.mhs_id; } int SendtoSiteId = 0; if (Program.CheckPointBSiteUse != 0) { SendtoSiteId = Program.CheckPointBSiteUse; } else { SendtoSiteId = Program.CurrentSite.mhs_id; } this.Text = Program.GetRoomName(); int? mvt_id = Program.CurrentPatient_queue.mvt_id; string mvt_code = dbc.mst_events.Where(x => x.mvt_id == mvt_id).Select(x => x.mvt_code).FirstOrDefault(); int? mrm_id = Program.CurrentPatient_queue.mrm_id; string mrm_code = dbc.mst_room_hdrs.Where(x => x.mrm_id == mrm_id).Select(x => x.mrm_code).FirstOrDefault(); // Add Button in Gridview var objview = (from t1 in dbc.vw_patient_rooms where t1.mhs_id == SendtoSiteId && t1.tpr_id == Program.CurrentRegis.tpr_id //&& (mrm_code == "CB" ? true : (mrm_code == "TE") ? true : t1.mrm_code != mrm_code) && (mrm_code == "CB" ? true : mrm_code == "US" ? t1.mrm_code != mrm_code : t1.mvt_code != mvt_code) select t1) .OrderBy(x => x.mhs_id) .ThenBy(x => x.mze_code) .ThenBy(x => x.mrm_seq_room) .Select(t1 => new ChoiceRoomGrid { mvt_id = t1.mvt_id, mrm_id = t1.mrm_id, mrm_code = t1.mrm_code, mhs_ename = t1.mhs_ename, mze_ename = t1.mze_ename, mrm_ename = t1.mrm_ename, waiting_person = t1.waiting_person_show, waiting_time = t1.waiting_time, mvt_code = t1.mvt_code, vip = t1.patient_vip }).ToList(); dataGridView2.DataSource = new SortableBindingList <ChoiceRoomGrid>(objview.ToList()); if (objview.Count() > 0) { select_mrmID = Convert.ToInt32(dataGridView2["colRoomid", 0].Value); mvtID = Convert.ToInt32(dataGridView2["colmvtid", 0].Value); WaitingTime = Convert1.ToInt32(dataGridView2["ColWaitingTime", 0].Value); } if (Program.CurrentSite.mhs_extra_pe_type != true) { dataGridView2.Columns["colVIP"].Visible = false; dataGridView2.Width = dataGridView2.Width - dataGridView2.Columns["colVIP"].Width; this.Width = this.Width - dataGridView2.Columns["colVIP"].Width; } }