protected override void GetDetailByID() { base.GetDetailByID(); if (CurrentRow != null) { DictionaryDataSet.AreaRow dr = (DictionaryDataSet.AreaRow)CurrentRow; if (dr.NumberOfTable > 0) { lvTest.Items.Clear(); var dt = oBL.GetTableMappingByAreaID(dr.AreaID, DateTime.Now); foreach (DataRow item in dt.Rows) { var name = item[ColumnName.TableName]; //UltraListViewSubItem subItem; //Color foreColor = Color.Black; //switch (item[ColumnName.Inactive].ToString()) //{ // case "1": // subItem = new UltraListViewSubItem("Ngừng sử dụng", null); // foreColor = Color.Red; // break; // default: // subItem = new UltraListViewSubItem("Có thể sử dụng", null); // break; //} //UltraListViewItem lvItem = new UltraListViewItem(name, new UltraListViewSubItem[] { subItem }, null); //if (foreColor == Color.Red) // lvItem.Appearance.ForeColor = Color.Red; UltraListViewItem lvItem = new UltraListViewItem(name, new UltraListViewSubItem[] { }, null); lvTest.Items.Add(lvItem); } } } }
/// <summary> /// Load danh sách khu vực /// </summary> private void LoadArea() { Area_All_Status.Clear(); Area_All_Status_Empty.Clear(); Area_All_Status.Add(Key_All, 0); Area_All_Status_Empty.Add(Key_All, 0); ShareDictionary.LoadArea(true); dsDictionary.Area.Clear(); dsDictionary.Area.Merge(ShareDictionary.DsDictionary.Area); tabAreaTableMapping.Tabs.Clear(); // Bắt đầu sửa giao diện tabAreaTableMapping.BeginUpdate(); tabAreaTableMapping.UseMnemonics = DefaultableBoolean.True; // Danh sách Tab UltraTabsCollection tabs = tabAreaTableMapping.Tabs; if (dsDictionary.Area.Rows.Count == 0) { lblArea_Detail_Title.Text = String.Empty; lblArea_Detail.Text = String.Empty; } foreach (DictionaryDataSet.AreaRow iArea in dsDictionary.Area.Rows) { // Tăng tổng toàn cửa hàng Area_All_Status[Key_All] += iArea.NumberOfTable; // Tổng số bàn của khu vực Area_All_Status.Add(iArea.AreaID.ToString(), iArea.NumberOfTable); Area_All_Status_Empty.Add(iArea.AreaID.ToString(), 0); // Khởi tạo Tab UltraTab ultraTab; ultraTab = tabs.Add(iArea.AreaID.ToString(), iArea.AreaName + " (" + iArea.NumberOfTable.ToString() + ")"); BusinessDataSet dsTable = new BusinessDataSet(); dsTable.AreaTableMapping.Merge(_oblArea.GetTableMappingByAreaID(iArea.AreaID, dteDateAreaTableMapping.DateTime)); FlowLayoutPanel flowLayout = new FlowLayoutPanel(); flowLayout.Padding = new Padding(10); flowLayout.Dock = DockStyle.Fill; flowLayout.AutoScroll = true; if (dsTable.AreaTableMapping.Rows.Count > 0) { foreach (BusinessDataSet.AreaTableMappingRow iAreaTable in dsTable.AreaTableMapping.Rows) { EnumTableStatus tableStatus = (EnumTableStatus)iAreaTable.TableStatus; if (tableStatus == EnumTableStatus.Empty) { Area_All_Status_Empty[iArea.AreaID.ToString()] += 1; Area_All_Status_Empty[Key_All] += 1; } UctTableMapping tableMapping = CreateUctTableMapping(iAreaTable); tableMapping.Click += Table_Click; tableMapping.DoubleClick += Table_DoubleClick; tableMapping.LoadAreaStatus += ChangeAreaStatus; flowLayout.Controls.Add(tableMapping); } } ultraTab.TabPage.Controls.Add(flowLayout); ChangeAreaStatus(); } tabAreaTableMapping.EndUpdate(); }