/// <summary> ///创建运营飞机RadGridView /// </summary> /// <returns></returns> public RadGridView CreatOperationGridView() { RadGridView rgView = new RadGridView(); rgView.ShowGroupPanel = true; rgView.AutoGenerateColumns = false; rgView.IsReadOnly = true; rgView.Name = "aircraftDetail"; rgView.RowIndicatorVisibility = Visibility.Collapsed; rgView.IsFilteringAllowed = true; GridViewDataColumn gvColumn1 = new GridViewDataColumn(); gvColumn1.Header = "注册号"; gvColumn1.DataMemberBinding = new System.Windows.Data.Binding("RegNumber"); GridViewDataColumn gvColumn2 = new GridViewDataColumn(); gvColumn2.Header = "运营权人"; gvColumn2.DataMemberBinding = new System.Windows.Data.Binding("ThenAirlineName"); GridViewDataColumn gvColumn3 = new GridViewDataColumn(); gvColumn3.Header = "所有权人"; gvColumn3.DataMemberBinding = new System.Windows.Data.Binding("ThenOwnerName"); GridViewDataColumn gvColumn4 = new GridViewDataColumn(); gvColumn4.Header = "制造商"; gvColumn4.DataMemberBinding = new System.Windows.Data.Binding("AircraftType.Manufacturer.Name"); GridViewDataColumn gvColumn5 = new GridViewDataColumn(); gvColumn5.Header = "座级"; gvColumn5.DataMemberBinding = new System.Windows.Data.Binding("ThenRegional"); GridViewDataColumn gvColumn6 = new GridViewDataColumn(); gvColumn6.Header = "机型"; gvColumn6.DataMemberBinding = new System.Windows.Data.Binding("ThenAircraftTypeName"); GridViewDataColumn gvColumn7 = new GridViewDataColumn(); gvColumn7.Header = "引进方式"; gvColumn7.DataMemberBinding = new System.Windows.Data.Binding("ThenActionName"); GridViewDataColumn gvColumn8 = new GridViewDataColumn(); gvColumn8.Header = "出厂日期"; System.Windows.Data.Binding bingding8 = new System.Windows.Data.Binding("FactoryDate"); bingding8.StringFormat = "yyyy/M/d"; gvColumn8.DataMemberBinding = bingding8; GridViewDataColumn gvColumn9 = new GridViewDataColumn(); gvColumn9.Header = "座位数(座)"; gvColumn9.DataMemberBinding = new System.Windows.Data.Binding("ThenSeatingCapacity"); GridViewDataColumn gvColumn10 = new GridViewDataColumn(); gvColumn10.Header = "商载量(吨)"; gvColumn10.DataMemberBinding = new System.Windows.Data.Binding("ThenCarryingCapacity"); //System.Windows.Data.Binding bingding10 = new System.Windows.Data.Binding("AircraftBusinesses"); //bingding10.Converter = new SelectedTimeConverter(); //bingding10.ConverterParameter = "CarryingCapacity"; //gvColumn10.DataMemberBinding = bingding10; SerialColumn gvColumn11 = new SerialColumn(); ResourceDictionary dictionary = new ResourceDictionary(); dictionary.Source = new Uri("/UniCloud.Infrastructure;component/Resources/CafmStyle.xaml", UriKind.Relative); gvColumn11.Header = "序号"; gvColumn11.CellStyle = (Style)dictionary["style"]; rgView.Columns.Add(gvColumn11); rgView.Columns.Add(gvColumn1); rgView.Columns.Add(gvColumn2); rgView.Columns.Add(gvColumn3); rgView.Columns.Add(gvColumn4); rgView.Columns.Add(gvColumn5); rgView.Columns.Add(gvColumn6); rgView.Columns.Add(gvColumn7); rgView.Columns.Add(gvColumn8); rgView.Columns.Add(gvColumn9); rgView.Columns.Add(gvColumn10); return rgView; }
/// <summary> /// 初始化RadWindow控件的Content的值 /// </summary> /// <param name="windowsType">窗体的类型,主要有三个:1、运行历史 2、商业数据 3、申请</param> /// <param name="obj">RadGridView控件的数据集合</param> /// <returns></returns> public Grid CreateRadWindows(string windowsType, object obj) { Grid grid = new Grid(); RadGridView gridview; if (windowsType == "运营历史") { gridview = new RadGridView(); gridview.ShowGroupPanel = true; gridview.AutoGenerateColumns = false; gridview.IsReadOnly = true; gridview.IsFilteringAllowed = true; gridview.RowIndicatorVisibility = Visibility.Collapsed; var OperationHistories = new List<OperationHistory>(); OperationHistories.Add((obj as OperationPlan).OperationHistory); gridview.ItemsSource = OperationHistories; var gv1 = new GridViewDataColumn { Header = "航空公司", DataMemberBinding = new System.Windows.Data.Binding("Airlines.ShortName") }; var gv2 = new GridViewDataColumn { Header = "飞机号", DataMemberBinding = new System.Windows.Data.Binding("Aircraft.RegNumber") }; var gv3 = new GridViewDataColumn { Header = "机型", DataMemberBinding = new System.Windows.Data.Binding("Aircraft.AircraftType.Name") }; var gv4 = new GridViewDataColumn { Header = "技术接收日期" }; var bing4 = new System.Windows.Data.Binding("TechReceiptDate") { StringFormat = "yyyy/M/d" }; gv4.DataMemberBinding = bing4; var gv5 = new GridViewDataColumn { Header = "接收日期" }; var bing5 = new System.Windows.Data.Binding("ReceiptDate") { StringFormat = "yyyy/M/d" }; gv5.DataMemberBinding = bing5; var gv6 = new GridViewDataColumn { Header = "运营日期" }; var bing6 = new System.Windows.Data.Binding("StartDate") { StringFormat = "yyyy/M/d" }; gv6.DataMemberBinding = bing6; var gv7 = new GridViewDataColumn { Header = "退出停场日期" }; var bing7 = new System.Windows.Data.Binding("StopDate") { StringFormat = "yyyy/M/d" }; gv7.DataMemberBinding = bing7; var gv8 = new GridViewDataColumn { Header = "技术交付日期" }; var bing8 = new System.Windows.Data.Binding("TechDeliveryDate") { StringFormat = "yyyy/M/d" }; gv8.DataMemberBinding = bing8; var gv9 = new GridViewDataColumn { Header = "退出日期" }; var bing9 = new System.Windows.Data.Binding("EndDate") { StringFormat = "yyyy/M/d" }; gv9.DataMemberBinding = bing9; var gv10 = new GridViewDataColumn { Header = "起租日期" }; var bing10 = new System.Windows.Data.Binding("OnHireDate") { StringFormat = "yyyy/M/d" }; gv10.DataMemberBinding = bing10; var gv11 = new GridViewDataColumn { Header = "引进方式", DataMemberBinding = new System.Windows.Data.Binding("ImportCategory.ActionName") }; var gv12 = new GridViewDataColumn { Header = "退出方式", DataMemberBinding = new System.Windows.Data.Binding("ExportCategory.ActionName") }; var gv13 = new GridViewDataColumn { Header = "备注", DataMemberBinding = new System.Windows.Data.Binding("Note") }; SerialColumn gv14 = new SerialColumn(); ResourceDictionary dictionary = new ResourceDictionary(); dictionary.Source = new Uri("/UniCloud.Infrastructure;component/Resources/CafmStyle.xaml", UriKind.Relative); gv14.Header = "序号"; gv14.CellStyle = (Style)dictionary["style"]; gridview.Columns.Add(gv14); gridview.Columns.Add(gv1); gridview.Columns.Add(gv2); gridview.Columns.Add(gv3); gridview.Columns.Add(gv4); gridview.Columns.Add(gv5); gridview.Columns.Add(gv6); gridview.Columns.Add(gv7); gridview.Columns.Add(gv8); gridview.Columns.Add(gv9); gridview.Columns.Add(gv10); gridview.Columns.Add(gv11); gridview.Columns.Add(gv12); gridview.Columns.Add(gv13); } else if (windowsType == "商业数据") { gridview = new RadGridView(); gridview.ShowGroupPanel = true; gridview.AutoGenerateColumns = false; gridview.IsReadOnly = true; gridview.IsFilteringAllowed = true; gridview.RowIndicatorVisibility = Visibility.Collapsed; List<AircraftBusiness> aircraftBusiness = new List<AircraftBusiness>(); aircraftBusiness.Add((obj as ChangePlan).AircraftBusiness); gridview.ItemsSource = aircraftBusiness; GridViewDataColumn gv1 = new GridViewDataColumn(); gv1.Header = "商业数据开始"; System.Windows.Data.Binding bing1 = new System.Windows.Data.Binding("StartDate"); bing1.StringFormat = "yyyy/M/d"; gv1.DataMemberBinding = bing1; GridViewDataColumn gv2 = new GridViewDataColumn(); gv2.Header = "商业数据结束"; System.Windows.Data.Binding bing2 = new System.Windows.Data.Binding("StartDate"); bing2.StringFormat = "yyyy/M/d"; gv2.DataMemberBinding = bing2; GridViewDataColumn gv3 = new GridViewDataColumn(); gv3.Header = "航空公司"; gv3.DataMemberBinding = new System.Windows.Data.Binding("Airlines.ShortName"); GridViewDataColumn gv4 = new GridViewDataColumn(); gv4.Header = "飞机号"; gv4.DataMemberBinding = new System.Windows.Data.Binding("Aircraft.RegNumber"); GridViewDataColumn gv5 = new GridViewDataColumn(); gv5.Header = "机型"; gv5.DataMemberBinding = new System.Windows.Data.Binding("Aircraft.AircraftType.Name"); GridViewDataColumn gv6 = new GridViewDataColumn(); gv6.Header = "座位数"; gv6.DataMemberBinding = new System.Windows.Data.Binding("SeatingCapacity"); GridViewDataColumn gv7 = new GridViewDataColumn(); gv7.Header = "商载(吨)"; gv7.DataMemberBinding = new System.Windows.Data.Binding("CarryingCapacity"); SerialColumn gv8 = new SerialColumn(); ResourceDictionary dictionary = new ResourceDictionary(); dictionary.Source = new Uri("/UniCloud.Infrastructure;component/Resources/CafmStyle.xaml", UriKind.Relative); gv8.Header = "序号"; gv8.CellStyle = (Style)dictionary["style"]; gridview.Columns.Add(gv8); gridview.Columns.Add(gv1); gridview.Columns.Add(gv2); gridview.Columns.Add(gv3); gridview.Columns.Add(gv4); gridview.Columns.Add(gv5); gridview.Columns.Add(gv6); gridview.Columns.Add(gv7); } else //申请 { gridview = new RadGridView(); gridview.ShowGroupPanel = true; gridview.AutoGenerateColumns = false; gridview.IsReadOnly = true; gridview.IsFilteringAllowed = true; gridview.RowIndicatorVisibility = Visibility.Collapsed; List<ApprovalHistory> approvalHistories = new List<ApprovalHistory>(); approvalHistories.Add((obj as PlanHistory).ApprovalHistory); gridview.ItemsSource = approvalHistories; GridViewDataColumn gv1 = new GridViewDataColumn(); gv1.Header = "座级"; System.Windows.Data.Binding bing1 = new System.Windows.Data.Binding("PlanAircraft.AircraftType.AircraftCategory.Regional"); gv1.DataMemberBinding = bing1; GridViewDataColumn gv2 = new GridViewDataColumn(); gv2.Header = "机型"; System.Windows.Data.Binding bing2 = new System.Windows.Data.Binding("PlanAircraft.AircraftType.Name"); gv2.DataMemberBinding = bing2; GridViewDataColumn gv3 = new GridViewDataColumn(); gv3.Header = "引进方式"; gv3.DataMemberBinding = new System.Windows.Data.Binding("ImportCategory.ActionName"); GridViewDataColumn gv4 = new GridViewDataColumn(); gv4.Header = "座位数"; gv4.DataMemberBinding = new System.Windows.Data.Binding("SeatingCapacity"); GridViewDataColumn gv5 = new GridViewDataColumn(); gv5.Header = "商载(吨)"; gv5.DataMemberBinding = new System.Windows.Data.Binding("CarryingCapacity"); GridViewDataColumn gv6 = new GridViewDataColumn(); gv6.Header = "申请交付时间"; gv6.UniqueName = "performTime"; gv6.DataMemberBinding = new System.Windows.Data.Binding("RequestDeliver"); SerialColumn gv7 = new SerialColumn(); ResourceDictionary dictionary = new ResourceDictionary(); dictionary.Source = new Uri("/UniCloud.Infrastructure;component/Resources/CafmStyle.xaml", UriKind.Relative); gv7.Header = "序号"; gv7.CellStyle = (Style)dictionary["style"]; gridview.Columns.Add(gv7); gridview.Columns.Add(gv1); gridview.Columns.Add(gv2); gridview.Columns.Add(gv3); gridview.Columns.Add(gv4); gridview.Columns.Add(gv5); gridview.Columns.Add(gv6); } if (gridview != null) { var radContext = new RadContextMenu(); radContext.ItemClick += radContext_ItemClick; var radMenuItem = new RadMenuItem { Header = "导出数据", }; radContext.Items.Add(radMenuItem); RadContextMenu.SetContextMenu(gridview, radContext); //为控件绑定右键菜单 } grid.Children.Add(gridview); return grid; }