//Tab 1 Config Hdr && dtl private void LoaddataTab1() { //DD Search var objsitelist = (from t1 in dbc.mst_hpc_sites select new DropdownData { Code = t1.mhs_id, Name = t1.mhs_ename }).ToList(); DropdownData newitem = new DropdownData(); newitem.Code = 0; newitem.Name = "Select All"; objsitelist.Insert(0, newitem); DDSite_SearchTab1.ValueMember = "Code"; DDSite_SearchTab1.DisplayMember = "Name"; DDSite_SearchTab1.DataSource = objsitelist; DDSite_SearchTab1.SelectedIndex = 0; var objsitelist2 = (from t1 in dbc.mst_hpc_sites select new DropdownData { Code = t1.mhs_id, Name = t1.mhs_ename }).ToList(); DDtab1_ConfigHeader.ValueMember = "Code"; DDtab1_ConfigHeader.DisplayMember = "Name"; DDtab1_ConfigHeader.DataSource = objsitelist2; ShowConfigHeader(0); }
//tab 2 conclusion Header & Detail private void LoaddataTab2() { //set dropdown Room var objroomlist = (from t1 in dbc.mst_room_hdrs select new DropdownData { Code = t1.mrm_id, Name = t1.mrm_ename }).ToList(); DropdownData newitem = new DropdownData(); newitem.Code = 0; newitem.Name = "Select All"; objroomlist.Insert(0, newitem); DDRoomSearch_tab2.ValueMember = "Code"; DDRoomSearch_tab2.DisplayMember = "Name"; DDRoomSearch_tab2.DataSource = objroomlist; DDRoomSearch_tab2.SelectedIndex = 0; var objsitelist2 = (from t1 in dbc.mst_room_hdrs select new DropdownData { Code = t1.mrm_id, Name = t1.mrm_ename }).ToList(); DDstationTab2Conclusion.ValueMember = "Code"; DDstationTab2Conclusion.DisplayMember = "Name"; DDstationTab2Conclusion.DataSource = objsitelist2; ShowConclusion(0); }
private void LoadDD() { //Set dropdown Site var objRaceGroup = (from t1 in dbc.mst_hpc_sites select new DropdownData { Code = t1.mhs_id, Name = t1.mhs_ename }).ToList(); DropdownData newitem = new DropdownData(); newitem.Code = 0; newitem.Name = "Select All"; objRaceGroup.Insert(0, newitem); DDSite.ValueMember = "Code"; DDSite.DisplayMember = "Name"; DDSite.DataSource = objRaceGroup; DDSite.SelectedIndex = 0; //set dropdown Room var objroomlist = (from t1 in dbc.mst_room_hdrs select new DropdownData { Code = t1.mrm_id, Name = t1.mrm_ename }).ToList(); objroomlist.Insert(0, newitem); DDRoom.ValueMember = "Code"; DDRoom.DisplayMember = "Name"; DDRoom.DataSource = objroomlist; DDRoom.SelectedIndex = 0; }
public static int?GetValueComboBoxInt(ComboBox cmd) { try { DropdownData castedItem = (DropdownData)cmd.SelectedItem; return(Convert1.ToInt32(castedItem.Code)); } catch (Exception) { } return(null); }
private void LoadDD() { //Set dropdown Site var objsitelist = (from t1 in dbc.mst_hpc_sites select new DropdownData { Code = t1.mhs_id, Name = t1.mhs_ename }).ToList(); DropdownData newitem = new DropdownData(); newitem.Code = 0; newitem.Name = "Select All"; objsitelist.Insert(0, newitem); DDsite.ValueMember = "Code"; DDsite.DisplayMember = "Name"; DDsite.DataSource = objsitelist; DDsite.SelectedIndex = 0; //Roomhdr var objsitesearch = (from t1 in dbc.mst_hpc_sites select new DropdownData { Code = t1.mhs_id, Name = t1.mhs_ename }).ToList(); DDsite_roomhdr.ValueMember = "Code"; DDsite_roomhdr.DisplayMember = "Name"; DDsite_roomhdr.DataSource = objsitesearch; DDsite_roomhdr.SelectedIndex = 0; DDsite_Roomhdr_replaceRoom.ValueMember = "Code"; DDsite_Roomhdr_replaceRoom.DisplayMember = "Name"; DDsite_Roomhdr_replaceRoom.DataSource = objsitesearch; DDsite_Roomhdr_replaceRoom.SelectedIndex = 0; DateTime dtnow = Program.GetServerDateTime(); var objzone = (from t1 in dbc.mst_zones select new DropdownData { Code = t1.mze_id, Name = t1.mze_ename }).ToList(); DDzone.ValueMember = "Code"; DDzone.DisplayMember = "Name"; DDzone.DataSource = objzone; DDzone.SelectedIndex = 0; // //set dropdown Room var objroomlist = (from t1 in dbc.mst_room_hdrs select new DropdownData { Code = t1.mrm_id, Name = t1.mrm_ename }).ToList(); DDRoom_station_replaceRoom.ValueMember = "Code"; DDRoom_station_replaceRoom.DisplayMember = "Name"; DDRoom_station_replaceRoom.DataSource = objroomlist; DDRoom_station_replaceRoom.SelectedIndex = 0; //Add ComboboxColumns Site and hiddin ColumnSite var objsite = (from t1 in dbc.mst_hpc_sites select new { Value = t1.mhs_id, Text = t1.mhs_ename }).ToList(); DataGridViewComboBoxColumn dgvCmbForums = new DataGridViewComboBoxColumn(); { dgvCmbForums.HeaderText = "Site"; // Hearder name of column dgvCmbForums.ValueMember = "Value"; // Add items into Combobox dgvCmbForums.DisplayMember = "Text"; dgvCmbForums.DataPropertyName = "mhs_id"; dgvCmbForums.DataSource = objsite; dgvCmbForums.DisplayIndex = 1; dgvCmbForums.Width = 80; dgvCmbForums.DisplayStyleForCurrentCellOnly = true; dgvCmbForums.FlatStyle = FlatStyle.Flat; } GridRoomHDR.Columns["Colmhs_id"].Visible = false; GridRoomHDR.Columns.Add(dgvCmbForums); //Add ComboboxColumns Zone and hiddin Columnzone var objZone = (from t1 in dbc.mst_zones select new { Value = t1.mze_id, Text = t1.mze_ename }).ToList(); DataGridViewComboBoxColumn dgvCmbzone = new DataGridViewComboBoxColumn(); { dgvCmbzone.HeaderText = "Zone"; // Hearder name of column dgvCmbzone.ValueMember = "Value"; // Add items into Combobox dgvCmbzone.DisplayMember = "Text"; dgvCmbzone.DataPropertyName = "mze_id"; dgvCmbzone.DataSource = objZone; dgvCmbzone.DisplayIndex = 2; dgvCmbzone.Width = 70; dgvCmbzone.DisplayStyleForCurrentCellOnly = true; dgvCmbzone.FlatStyle = FlatStyle.Flat; } GridRoomHDR.Columns["Colmze_id"].Visible = false; GridRoomHDR.Columns.Add(dgvCmbzone); //tabEvent *********************************** List <DropdownDataChar> mainsublist = new List <DropdownDataChar>(); DropdownDataChar item1 = new DropdownDataChar(); item1.Code = 'M'; item1.Name = "Main"; mainsublist.Add(item1); DropdownDataChar item2 = new DropdownDataChar(); item2.Code = 'S'; item2.Name = "Sub"; mainsublist.Add(item2); //DropdownDataChar item0 = new DropdownDataChar(); //item0.Code = null; item0.Name = ""; //mainsublist.Add(item0); DataGridViewComboBoxColumn dgvCmbtype_cate = new DataGridViewComboBoxColumn(); { // Hearder name of column dgvCmbtype_cate.HeaderText = "Type"; // Add items into Combobox dgvCmbtype_cate.ValueMember = "Code"; dgvCmbtype_cate.DisplayMember = "Name"; dgvCmbtype_cate.DataPropertyName = "mvt_type_cate"; dgvCmbtype_cate.DataSource = mainsublist; dgvCmbtype_cate.Width = 80; dgvCmbtype_cate.DisplayStyleForCurrentCellOnly = true; dgvCmbtype_cate.FlatStyle = FlatStyle.Flat; } dataGridView3.Columns.Add(dgvCmbtype_cate); dataGridView3.Columns["Colmvt_type_cate"].Visible = false; //Tab Room & Event ***************************** var objsiteRoomEventlist = (from t1 in dbc.mst_hpc_sites select new DropdownData { Code = t1.mhs_id, Name = t1.mhs_ename }).ToList(); //Room && Event objsiteRoomEventlist.Insert(0, newitem); DDSiteRoomEvent_Search.ValueMember = "Code"; DDSiteRoomEvent_Search.DisplayMember = "Name"; DDSiteRoomEvent_Search.DataSource = objsiteRoomEventlist; DDSiteRoomEvent_Search.SelectedIndex = 0; //*********************************** }