/// <summary> /// 窗体加载结束 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MainUI_Shown(object sender, EventArgs e) { try { barTip.Caption = TimeDiff(sw); SplashScreenManager.CloseForm(false); this.Activate(); Provider.Set("BarTip", barTip); Provider.Set("MyToast", myToast); Provider.Set("MyAlert", myAlert); //InitializeService(); } catch (Exception ex) { SharedFunc.RaiseError(ex); } }
private void gcf_CustomButtonChecked(object sender, DevExpress.XtraBars.Docking2010.BaseButtonEventArgs e) { try { e.Button.Properties.Checked = true; foreach (DevExpress.XtraEditors.ButtonPanel.BaseButton btn in gcf.CustomHeaderButtons) { if (btn.Caption != e.Button.Properties.Caption) { btn.Checked = false; } } switch (e.Button.Properties.Caption) { case "Field": tabs.SelectedTabPage = tField; break; case "Tree": tabs.SelectedTabPage = tTree; break; case "Validation": tabs.SelectedTabPage = tValidation; break; case "Button": loadSub(lastPage); tabs.SelectedTabPage = tButton; break; case "Format": tabs.SelectedTabPage = tFormat; break; default: break; } } catch (Exception ex) { SharedFunc.RaiseError(ex); } }
public void IconCompile() { try { CSharpCodeProvider ccp = new CSharpCodeProvider(); CompilerParameters OnePara = new CompilerParameters(); gridView1.CloseEditor(); gridView1.UpdateCurrentRow(); DataTable dt = (DataTable)gd.DataSource; SharedFunc.ShowProcess(this, 0, dt.Rows.Count); foreach (DataRow dr in dt.Select("IsEnabled = 1 ")) { SharedFunc.ShowProcess(1); if (!Directory.Exists(@"tmp")) { Directory.CreateDirectory(@"tmp"); } File.WriteAllBytes(@"tmp\" + (string)dr["Icon_Name"], (byte[])dr["Icon_Byte"]); OnePara.EmbeddedResources.Add(@"tmp\" + (string)dr["Icon_Name"]); } //OnePara.ReferencedAssemblies.Add(""); OnePara.GenerateInMemory = false; OnePara.OutputAssembly = "MyRapid.Images.dll"; CompilerResults cr; StringBuilder sb = new StringBuilder(); sb.AppendLine("using System;"); sb.AppendLine("namespace MyRapid.Images"); sb.AppendLine("{"); sb.AppendLine(" public class IconList"); sb.AppendLine(" {"); sb.AppendLine(" }"); sb.AppendLine("}"); cr = ccp.CompileAssemblyFromSource(OnePara, sb.ToString()); } catch (Exception ex) { SharedFunc.RaiseError(ex); } finally { SharedFunc.ShowProcess(int.MaxValue); } }
public void Connect() { try { BuidConnection(); SqlHelper.GetDataTable("SELECT 0", null); //SharedFunc.RaiseError("Succeed"); DataTable dt = SqlHelper.GetDataTable("SELECT NAME ,NEWID() PID ,NEWID() KID FROM MASTER..SYSDATABASES ORDER BY NAME", null); trr.DataSource = dt; trr.ForceInitialize(); foreach (TreeListNode item in trr.Nodes) { item.Nodes.Add("Null"); } } catch (Exception ex) { SharedFunc.RaiseError(ex); } }
/// <summary> /// 计算时间差 /// </summary> /// <param name="sw">计时器</param> /// <returns></returns> private string TimeDiff(Stopwatch sw) { try { sw.Stop(); int M = sw.Elapsed.Milliseconds; int S = sw.Elapsed.Seconds; string sc = "{0}.{1}s"; sc = String.Format(sc, S, M); return(sc); } catch (Exception ex) { SharedFunc.RaiseError(ex); return(string.Empty); } finally { } }
private void MyMdi_SelectedPageChanged(object sender, EventArgs e) { try { GC.Collect(); if (myMdi.SelectedPage != null) { //Read_Sys_Help_ForMenu ChildPage myPage = (ChildPage)myMdi.SelectedPage.MdiChild; PushSession(myPage); Sys_Page sys_Page = myPage.SysPage; if (sys_Page != null) { barPageName.Caption = sys_Page.Menu_Nick; barVersion.Caption = sys_Page.Menu_Version; barAuther.Caption = sys_Page.Menu_Author; myMdi.SelectedPage.ImageIndex = 0; } Sys_Menu sys_Menu = myPage.SysMenu; if (sys_Menu != null) { CurMenu = sys_Menu; myMdi.SelectedPage.ImageIndex = (int)sys_Menu.Menu_IconIndex; barPageName.Caption = sys_Menu.Menu_Nick; } } else { barPageName.Caption = string.Empty; barVersion.Caption = string.Empty; barAuther.Caption = string.Empty; } } catch (Exception ex) { SharedFunc.RaiseError(ex); } }
private void barMenu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { MyLeftPanel.Visible = !MyLeftPanel.Visible; splitterControl1.Visible = !splitterControl1.Visible; if (BaseService.CheckConfiguration("Global_MainUI_ShowHideMenu_ReloadData").ToBoolEx()) { if (MyLeftPanel.Visible) { InitializeMenu(); MyTree.DataSource = Provider.UserMenus; } } } catch (Exception ex) { SharedFunc.RaiseError(ex); } finally { } }
private void UseFavorite() { try { DataRow dr = gvr.GetFocusedDataRow(); if (dr == null) { return; } DataTable dt = (DataTable)gdr.DataSource; if (dt == null) { return; } DataTable tdt = (DataTable)gdf.DataSource; if (tdt == null) { return; } DataRow tdr = tdt.NewRow(); foreach (DataColumn item in tdr.Table.Columns) { if (dt.Columns[item.ColumnName] != null) { tdr[item.ColumnName] = dr[item.ColumnName]; } } int lastHandle = gvf.GetFocusedDataSourceRowIndex(); tdt.Rows.InsertAt(tdr, lastHandle); gvf.FocusedRowHandle += 1; } catch (Exception ex) { SharedFunc.RaiseError(ex); } }
private void InitializeLayout(List <Sys_Layout> sys_Layouts, Control parentControl) { try { DataTable dt = (DataTable)gdb.DataSource; parentControl.Visible = false; parentControl.Controls.Clear(); foreach (Sys_Layout sys_Layout in sys_Layouts.OrderBy(s => s.Layout_Sort)) { Control contain = parentControl; if (!string.IsNullOrEmpty(sys_Layout.Layout_Parent)) { Control[] cks = parentControl.Controls.Find(sys_Layout.Layout_Parent, true); if (cks.Length > 0) { contain = cks[0]; } } contain.ControlAdded += delegate(object sender, ControlEventArgs e) { e.Control.Paint += Layout_SizeChanged; e.Control.Click += Layout_Select; }; switch (sys_Layout.Layout_Type) { case 0: //Query GroupControl qry = new GroupControl(); InitializeControl(qry, sys_Layout); contain.Controls.Add(qry); qry.BringToFront(); //this.QueryControl = qry; break; case 12: //GroupControl GroupControl grp = new GroupControl(); InitializeControl(grp, sys_Layout); contain.Controls.Add(grp); grp.BringToFront(); break; case 14: //PanelControl PanelControl panel = new PanelControl(); InitializeControl(panel, sys_Layout); contain.Controls.Add(panel); panel.BorderStyle = BorderStyles.NoBorder; panel.BringToFront(); break; case 13: SplitterControl OneSpli = new SplitterControl(); OneSpli.Dock = (DockStyle)sys_Layout.Layout_Dock; OneSpli.Name = sys_Layout.Layout_Name; contain.Controls.Add(OneSpli); OneSpli.BringToFront(); break; case 1: //Grid case 6: //Submit case 7: //Tree 这三个都只有Grid 是在Grid上覆盖控件实现 Submit 和 Tree 效果 GridControl gd = new GridControl(); InitializeControl(gd, sys_Layout); GridView gv = (GridView)gd.CreateView("GridView"); gv.Name = gd.Name.Replace("d", "v"); gv.OptionsView.ShowGroupPanel = false; gv.OptionsView.ShowFooter = true; gv.OptionsSelection.MultiSelect = true; gd.MainView = gv; contain.Controls.Add(gd); gd.BringToFront(); break; case 9: //TabPage TabEx ntabs = new TabEx(); InitializeControl(ntabs, sys_Layout); ntabs.BorderStyle = BorderStyles.NoBorder; ntabs.BorderStylePage = BorderStyles.NoBorder; contain.Controls.Add(ntabs); ntabs.BringToFront(); break; case 10: DevExpress.XtraTab.XtraTabPage tab = new DevExpress.XtraTab.XtraTabPage(); tab.Name = sys_Layout.Layout_Name; tab.Text = sys_Layout.Layout_Nick; if (contain.GetType() == typeof(TabEx)) { TabEx tabs = (TabEx)contain; tabs.TabPages.Add(tab); } break; case 11: Pagination pagination = new Pagination(); pagination.Name = sys_Layout.Layout_Name; pagination.Dock = (DockStyle)sys_Layout.Layout_Dock; contain.Controls.Add(pagination); pagination.BringToFront(); break; case 2: //Chart ChartControl chart = new ChartControl(); InitializeControl(chart, sys_Layout); chart.BorderOptions.Visibility = DevExpress.Utils.DefaultBoolean.False; contain.Controls.Add(chart); chart.BringToFront(); break; case 3: //text MemoEdit memoEdit = new MemoEdit(); InitializeControl(memoEdit, sys_Layout); memoEdit.BorderStyle = BorderStyles.NoBorder; contain.Controls.Add(memoEdit); memoEdit.BringToFront(); break; case 4: //RichText RichEditControl rtf = new RichEditControl(); InitializeControl(rtf, sys_Layout); rtf.BorderStyle = BorderStyles.NoBorder; rtf.ActiveViewType = RichEditViewType.Simple; contain.Controls.Add(rtf); rtf.BringToFront(); break; case 5: //image PictureEdit pictureEdit = new PictureEdit(); InitializeControl(pictureEdit, sys_Layout); pictureEdit.BorderStyle = BorderStyles.NoBorder; pictureEdit.Properties.PictureStoreMode = PictureStoreMode.ByteArray; pictureEdit.Properties.SizeMode = PictureSizeMode.Squeeze; contain.Controls.Add(pictureEdit); pictureEdit.BringToFront(); break; case 8: //BarCode BarCodeControl barCodeControl = new BarCodeControl(); InitializeControl(barCodeControl, sys_Layout); barCodeControl.BorderStyle = BorderStyles.NoBorder; barCodeControl.BackColor = Color.White; barCodeControl.AutoModule = true; barCodeControl.ShowText = false; //QRCodeGenerator DevExpress.XtraPrinting.BarCode.QRCodeGenerator qrCodeGenerator1 = new DevExpress.XtraPrinting.BarCode.QRCodeGenerator(); qrCodeGenerator1.CompactionMode = DevExpress.XtraPrinting.BarCode.QRCodeCompactionMode.Byte; qrCodeGenerator1.ErrorCorrectionLevel = DevExpress.XtraPrinting.BarCode.QRCodeErrorCorrectionLevel.H; qrCodeGenerator1.Version = DevExpress.XtraPrinting.BarCode.QRCodeVersion.Version1; //Code128Generator DevExpress.XtraPrinting.BarCode.Code128Generator code128Generator1 = new DevExpress.XtraPrinting.BarCode.Code128Generator(); //根据长宽比切换二维码 条码显示 if (barCodeControl.Width > barCodeControl.Height * 2) { barCodeControl.Symbology = code128Generator1; } else { barCodeControl.Symbology = qrCodeGenerator1; } contain.Controls.Add(barCodeControl); barCodeControl.BringToFront(); break; default: break; } } parentControl.Visible = true; } catch (Exception ex) { SharedFunc.RaiseError(ex); } }
private void gcf_CustomButtonClick(object sender, DevExpress.XtraBars.Docking2010.BaseButtonEventArgs e) { try { gvb.CloseEditor(); gvb.UpdateCurrentRow(); DataTable dt = (DataTable)gdb.DataSource; if (dt == null) { return; } List <Sys_Layout> sys_Layouts = EntityHelper.GetEntities <Sys_Layout>(dt); if (e.Button.Properties.Caption != "prv") { while (dt.Rows.Count > 0) { dt.Rows[0].Delete(); } foreach (DataRow dr in dt.Rows) { dr.Delete(); } } base.Save(); switch (e.Button.Properties.Caption) { case "tf": AddPanel("qry", "查询", "", 0, (int)DockStyle.Top); AddPanel("spt", "", "", 13, (int)DockStyle.Top); AddPanel("gc", "信息", "", 12, (int)DockStyle.Fill); AddPanel("gd_pagi", "分页", "gc", 11, (int)DockStyle.Bottom); AddPanel("gd", "信息", "gc", 1, (int)DockStyle.Fill); break; case "tbf": AddPanel("qry", "查询", "", 0, (int)DockStyle.Top); AddPanel("spt", "", "", 13, (int)DockStyle.Top); AddPanel("gcb", "信息", "", 12, (int)DockStyle.Bottom); AddPanel("gdb_pagi", "分页", "gcb", 11, (int)DockStyle.Bottom); AddPanel("gdb", "信息", "gcb", 1, (int)DockStyle.Fill); AddPanel("spb", "", "", 13, (int)DockStyle.Bottom); AddPanel("gcf", "信息", "", 12, (int)DockStyle.Fill); AddPanel("gdf_pagi", "分页", "gcf", 11, (int)DockStyle.Bottom); AddPanel("gdf", "信息", "gcf", 1, (int)DockStyle.Fill); break; case "ttf": AddPanel("qry", "查询", "", 0, (int)DockStyle.Top); AddPanel("spt", "", "", 13, (int)DockStyle.Top); AddPanel("gct", "信息", "", 12, (int)DockStyle.Top); AddPanel("gdt_pagi", "分页", "gct", 11, (int)DockStyle.Bottom); AddPanel("gdt", "信息", "gct", 1, (int)DockStyle.Fill); AddPanel("spm", "", "", 13, (int)DockStyle.Top); AddPanel("gcf", "信息", "", 12, (int)DockStyle.Fill); AddPanel("gdf_pagi", "分页", "", 11, (int)DockStyle.Bottom); AddPanel("gdf", "信息", "gcf", 1, (int)DockStyle.Fill); break; case "tlf": AddPanel("qry", "查询", "", 0, (int)DockStyle.Top); AddPanel("spt", "", "", 13, (int)DockStyle.Top); AddPanel("gcl", "信息", "", 12, (int)DockStyle.Left); AddPanel("gdl_pagi", "分页", "gcl", 11, (int)DockStyle.Bottom); AddPanel("gdl", "信息", "gcl", 1, (int)DockStyle.Fill); AddPanel("spl", "", "", 13, (int)DockStyle.Left); AddPanel("gcf", "信息", "", 12, (int)DockStyle.Fill); AddPanel("gdf_pagi", "分页", "gcf", 11, (int)DockStyle.Bottom); AddPanel("gdf", "信息", "gcf", 1, (int)DockStyle.Fill); break; case "trf": AddPanel("qry", "查询", "", 0, (int)DockStyle.Top); AddPanel("spt", "", "", 13, (int)DockStyle.Top); AddPanel("gcr", "信息", "", 12, (int)DockStyle.Right); AddPanel("gdr_pagi", "分页", "gcr", 11, (int)DockStyle.Bottom); AddPanel("gdr", "信息", "gcr", 1, (int)DockStyle.Fill); AddPanel("spr", "", "", 13, (int)DockStyle.Right); AddPanel("gcf", "信息", "", 12, (int)DockStyle.Fill); AddPanel("gdf_pagi", "分页", "gcf", 11, (int)DockStyle.Bottom); AddPanel("gdf", "信息", "gcf", 1, (int)DockStyle.Fill); break; case "tblf": AddPanel("qry", "查询", "", 0, (int)DockStyle.Top); AddPanel("spt", "", "", 13, (int)DockStyle.Top); AddPanel("gcb", "信息", "", 12, (int)DockStyle.Bottom); AddPanel("gdb_pagi", "分页", "gcb", 11, (int)DockStyle.Bottom); AddPanel("gdb", "", "gcb", 1, (int)DockStyle.Fill); AddPanel("spb", "", "", 13, (int)DockStyle.Bottom); AddPanel("gcl", "信息", "", 12, (int)DockStyle.Left); AddPanel("gdl_pagi", "分页", "gcl", 11, (int)DockStyle.Bottom); AddPanel("gdl", "", "gcl", 1, (int)DockStyle.Fill); AddPanel("spl", "", "", 13, (int)DockStyle.Left); AddPanel("gcf", "信息", "", 12, (int)DockStyle.Fill); AddPanel("gdf_pagi", "分页", "gcf", 11, (int)DockStyle.Bottom); AddPanel("gdf", "", "gcf", 1, (int)DockStyle.Fill); break; case "tbrf": AddPanel("qry", "查询", "", 0, (int)DockStyle.Top); AddPanel("spt", "", "", 13, (int)DockStyle.Top); AddPanel("gcb", "信息", "", 12, (int)DockStyle.Bottom); AddPanel("gdb_pagi", "分页", "gcb", 11, (int)DockStyle.Bottom); AddPanel("gdb", "", "gcb", 1, (int)DockStyle.Fill); AddPanel("spb", "", "", 13, (int)DockStyle.Bottom); AddPanel("gcr", "信息", "", 12, (int)DockStyle.Right); AddPanel("gdr_pagi", "分页", "gcr", 11, (int)DockStyle.Bottom); AddPanel("gdr", "", "gcr", 1, (int)DockStyle.Fill); AddPanel("spr", "", "", 13, (int)DockStyle.Right); AddPanel("gcf", "信息", "", 12, (int)DockStyle.Fill); AddPanel("gdf_pagi", "分页", "gcf", 11, (int)DockStyle.Bottom); AddPanel("gdf", "", "gcf", 1, (int)DockStyle.Fill); break; case "tlrf": AddPanel("qry", "查询", "", 0, (int)DockStyle.Top); AddPanel("spt", "", "", 13, (int)DockStyle.Top); AddPanel("gcl", "信息", "", 12, (int)DockStyle.Left); AddPanel("gdl_pagi", "分页", "gcl", 11, (int)DockStyle.Bottom); AddPanel("gdl", "", "gcl", 1, (int)DockStyle.Fill); AddPanel("spl", "", "", 13, (int)DockStyle.Left); AddPanel("gcr", "信息", "", 12, (int)DockStyle.Right); AddPanel("gdr_pagi", "分页", "gcr", 11, (int)DockStyle.Bottom); AddPanel("gdr", "", "gcr", 1, (int)DockStyle.Fill); AddPanel("spr", "", "", 13, (int)DockStyle.Right); AddPanel("gcf", "信息", "", 12, (int)DockStyle.Fill); AddPanel("gdf_pagi", "分页", "gcf", 11, (int)DockStyle.Bottom); AddPanel("gdf", "", "gcf", 1, (int)DockStyle.Fill); break; case "tllf": AddPanel("qry", "查询", "", 0, (int)DockStyle.Top); AddPanel("spt", "", "", 13, (int)DockStyle.Top); AddPanel("gcl", "信息", "", 12, (int)DockStyle.Left); AddPanel("gdl_pagi", "分页", "gcl", 11, (int)DockStyle.Bottom); AddPanel("gdl", "", "gcl", 1, (int)DockStyle.Fill); AddPanel("spl", "", "", 13, (int)DockStyle.Left); AddPanel("gcm", "信息", "", 12, (int)DockStyle.Left); AddPanel("gdm_pagi", "分页", "gcm", 11, (int)DockStyle.Bottom); AddPanel("gdm", "", "gcm", 1, (int)DockStyle.Fill); AddPanel("spm", "", "", 13, (int)DockStyle.Left); AddPanel("gcf", "信息", "", 12, (int)DockStyle.Fill); AddPanel("gdf_pagi", "分页", "gcf", 11, (int)DockStyle.Bottom); AddPanel("gdf", "", "gcf", 1, (int)DockStyle.Fill); break; case "trrf": AddPanel("qry", "查询", "", 0, (int)DockStyle.Top); AddPanel("spt", "", "", 13, (int)DockStyle.Top); AddPanel("gcr", "信息", "", 12, (int)DockStyle.Right); AddPanel("gdr_pagi", "分页", "gcr", 11, (int)DockStyle.Bottom); AddPanel("gdr", "", "gcr", 1, (int)DockStyle.Fill); AddPanel("spr", "", "", 13, (int)DockStyle.Right); AddPanel("gcm", "信息", "", 12, (int)DockStyle.Right); AddPanel("gdm_pagi", "分页", "gcm", 11, (int)DockStyle.Bottom); AddPanel("gdm", "", "gcm", 1, (int)DockStyle.Fill); AddPanel("spm", "", "", 13, (int)DockStyle.Right); AddPanel("gcf", "信息", "", 12, (int)DockStyle.Fill); AddPanel("gdf_pagi", "分页", "gcf", 11, (int)DockStyle.Bottom); AddPanel("gdf", "", "gcf", 1, (int)DockStyle.Fill); break; case "tltf": AddPanel("qry", "查询", "", 0, (int)DockStyle.Top); AddPanel("spt", "", "", 13, (int)DockStyle.Top); AddPanel("gcl", "信息", "", 12, (int)DockStyle.Left); AddPanel("gdl_pagi", "分页", "gcl", 11, (int)DockStyle.Bottom); AddPanel("gdl", "", "gcl", 1, (int)DockStyle.Fill); AddPanel("spl", "", "", 13, (int)DockStyle.Left); AddPanel("gcm", "信息", "", 12, (int)DockStyle.Top); AddPanel("gdm_pagi", "分页", "gcm", 11, (int)DockStyle.Bottom); AddPanel("gdm", "", "gcm", 1, (int)DockStyle.Fill); AddPanel("spm", "", "", 13, (int)DockStyle.Top); AddPanel("gcf", "信息", "", 12, (int)DockStyle.Fill); AddPanel("gdf_pagi", "分页", "gcf", 11, (int)DockStyle.Bottom); AddPanel("gdf", "", "gcf", 1, (int)DockStyle.Fill); break; case "tlfb": AddPanel("qry", "查询", "", 0, (int)DockStyle.Top); AddPanel("spt", "", "", 13, (int)DockStyle.Top); AddPanel("gcl", "信息", "", 12, (int)DockStyle.Left); AddPanel("gdl_pagi", "分页", "gcl", 11, (int)DockStyle.Bottom); AddPanel("gdl", "", "gcl", 1, (int)DockStyle.Fill); AddPanel("spl", "", "", 13, (int)DockStyle.Left); AddPanel("gcb", "信息", "", 12, (int)DockStyle.Bottom); AddPanel("gdb_pagi", "分页", "gcb", 11, (int)DockStyle.Bottom); AddPanel("gdb", "", "gcb", 1, (int)DockStyle.Fill); AddPanel("spb", "", "", 13, (int)DockStyle.Bottom); AddPanel("gcf", "信息", "", 12, (int)DockStyle.Fill); AddPanel("gdf_pagi", "分页", "gcf", 11, (int)DockStyle.Bottom); AddPanel("gdf", "", "gcf", 1, (int)DockStyle.Fill); break; case "trfb": AddPanel("qry", "查询", "", 0, (int)DockStyle.Top); AddPanel("spt", "", "", 13, (int)DockStyle.Top); AddPanel("gcr", "信息", "", 12, (int)DockStyle.Right); AddPanel("gdr_pagi", "分页", "gcr", 11, (int)DockStyle.Bottom); AddPanel("gdr", "", "gcr", 1, (int)DockStyle.Fill); AddPanel("spr", "", "", 13, (int)DockStyle.Right); AddPanel("gcb", "信息", "", 12, (int)DockStyle.Bottom); AddPanel("gdb_pagi", "分页", "gcb", 11, (int)DockStyle.Bottom); AddPanel("gdb", "", "gcb", 1, (int)DockStyle.Fill); AddPanel("spb", "", "", 13, (int)DockStyle.Bottom); AddPanel("gcf", "信息", "", 12, (int)DockStyle.Fill); AddPanel("gdf_pagi", "分页", "gcf", 11, (int)DockStyle.Bottom); AddPanel("gdf", "", "gcf", 1, (int)DockStyle.Fill); break; case "trtf": AddPanel("qry", "查询", "qry", 0, (int)DockStyle.Top); AddPanel("spt", "", "", 13, (int)DockStyle.Top); AddPanel("gcr", "信息", "", 12, (int)DockStyle.Right); AddPanel("gdr_pagi", "分页", "gcr", 11, (int)DockStyle.Bottom); AddPanel("gdr", "", "gcr", 1, (int)DockStyle.Fill); AddPanel("spr", "", "", 13, (int)DockStyle.Right); AddPanel("gct", "信息", "", 12, (int)DockStyle.Top); AddPanel("gdt_pagi", "分页", "gct", 11, (int)DockStyle.Bottom); AddPanel("gdt", "", "gct", 1, (int)DockStyle.Fill); AddPanel("spm", "", "", 13, (int)DockStyle.Top); AddPanel("gcf", "信息", "", 12, (int)DockStyle.Fill); AddPanel("gdf_pagi", "分页", "gcf", 11, (int)DockStyle.Bottom); AddPanel("gdf", "", "gcf", 1, (int)DockStyle.Fill); break; case "prv": //sys_Layouts.Clear(); InitializeLayout(sys_Layouts, gcf); return; default: break; } sys_Layouts = EntityHelper.GetEntities <Sys_Layout>(dt); InitializeLayout(sys_Layouts, gcf); } catch (Exception ex) { SharedFunc.RaiseError(ex); } }
public void DesignReport() { try { if (gridView1.FocusedRowHandle < 0) { return; } this.Cursor = Cursors.WaitCursor; string rptName = gridView1.GetFocusedRowCellValue("Report_Name").ToStringEx(); string rptId = gridView1.GetFocusedRowCellValue("Report_Id").ToStringEx(); var list = new List <MyParameter>(); list.Add("cReport_Id", DbType.String, rptId, null); object obj = BaseService.Get("SystemReport_Data", list); string wk = gridView1.GetFocusedRowCellValue("Report_WorkSet").ToStringEx(); DataTable dt = new DataTable(); if (!string.IsNullOrEmpty(wk)) { var mps = InitializeBind(wk); dt = BaseService.Open(wk, mps); } dt.TableName = "DataSource"; string rptFile = Guid.NewGuid().ToString(); XRDesignForm designForm = new XRDesignForm(); XtraReport xtraReport = new XtraReport(); xtraReport.Name = rptName; if (obj != DBNull.Value) { byte[] bs = (byte[])obj; File.WriteAllBytes(rptFile, bs); xtraReport.LoadLayout(bs.ToStream()); } //xtraReport.RequestParameters = false; xtraReport.DataSource = dt; //xtraReport.Parameters.Clear(); //xtraReport.Parameters.AddRange(ps.ToArray()); designForm.OpenReport(xtraReport); designForm.Shown += delegate { if (designForm.ActiveDesignPanel != null) { designForm.ActiveDesignPanel.Text = rptName; designForm.ActiveDesignPanel.FileName = rptFile; } }; designForm.FormClosing += delegate { MemoryStream ms = new MemoryStream(); designForm.ActiveDesignPanel.Report.SaveLayout(ms); list.Add("Report_Bytes", DbType.Binary, ms.ToBytes(), null); BaseService.Execute("SystemReport_Data", list, "U"); //gridView1.SetFocusedRowCellValue("Report_Bytes", ms.ToBytes()); File.Delete(rptFile); }; designForm.Show(); } catch (Exception ex) { SharedFunc.RaiseError(ex); } finally { this.Cursor = Cursors.Default; } }
private void gpb_CustomButtonChecked(object sender, DevExpress.XtraBars.Docking2010.BaseButtonEventArgs e) { try { switch (e.Button.Properties.Caption) { case "Insert": ChkBtn(e.Button.Properties.Caption); rtfSql_Insert.BringToFront(); TopSql = rtfSql_Insert; break; case "Update": ChkBtn(e.Button.Properties.Caption); rtfSql_Update.BringToFront(); TopSql = rtfSql_Update; break; case "Delete": ChkBtn(e.Button.Properties.Caption); rtfSql_Delete.BringToFront(); TopSql = rtfSql_Delete; break; case "Select": ChkBtn(e.Button.Properties.Caption); rtfSql_Select.BringToFront(); TopSql = rtfSql_Select; break; case "Generate": e.Button.Properties.Checked = false; TopSql = TopSql == null ? rtfSql_Select : TopSql; if (gvt.FocusedRowHandle >= 0) { string conn = gvt.GetFocusedRowCellValue("WorkSet_Connection").ToStringEx(); List <MyParameter> connPara = new List <MyParameter>(); //切换到当前连接 try { connPara.Add("@WorkSet_Name", DbType.String, "SystemWorkSet_Schema", null); connPara.Add("@WorkSet_Connection", DbType.String, conn, null); BaseService.Execute("SystemWorkSet_SchemaClear", connPara); } catch (Exception ex) { SharedFunc.RaiseError(ex); } List <Sys_Schema> sys_Schemas = new List <Sys_Schema>(); string TableName = gvt.GetFocusedRowCellValue("WorkSet_Table").ToStringEx(); try { //执行生成语句 List <MyParameter> myParameters = new List <MyParameter>(); myParameters.Add("@TableName", DbType.String, TableName, null); DataTable dt = BaseService.Open("SystemWorkSet_Schema", myParameters); sys_Schemas = EntityHelper.GetEntities <Sys_Schema>(dt); } catch (Exception ex) { SharedFunc.RaiseError(ex); } //切换到默认连接 connPara.Clear(); try { connPara.Add("@WorkSet_Name", DbType.String, "SystemWorkSet_Schema", null); connPara.Add("@WorkSet_Connection", DbType.String, null, null); BaseService.Execute("SystemWorkSet_SchemaClear", connPara); } catch (Exception ex) { SharedFunc.RaiseError(ex); } if (sys_Schemas != null) { if (!string.IsNullOrEmpty(TableName)) { string IsPagination = gvt.GetFocusedRowCellValue("WorkSet_Pagination").ToStringEx(); if (!string.IsNullOrEmpty(IsPagination) && CurBtn.Equals("Select")) { TopSql.Text = ScriptHelper.GenerateSql(TableName, sys_Schemas, "SelectPage"); } else { TopSql.Text = ScriptHelper.GenerateSql(TableName, sys_Schemas, CurBtn); } } } } break; case "Parameter": e.Button.Properties.Checked = false; try { if (gvt.FocusedRowHandle >= 0) { string WorkSet_Name = gvt.GetFocusedRowCellValue("WorkSet_Name").ToStringEx(); if (string.IsNullOrEmpty(WorkSet_Name.Trim())) { return; } DataTable fdt = (DataTable)gdf.DataSource; List <MyParameter> myParameter = new List <MyParameter>(); if (string.IsNullOrEmpty(rtfSql_Select.Text)) { return; } string tmpSql = rtfSql_Select.Text; Regex decRgx = new Regex("DECLARE( )*@(([A-Za-z0-9_])* )( )*([A-Za-z0-9_,])*( )*(,|\r)", RegexOptions.IgnoreCase); foreach (Match m in decRgx.Matches(tmpSql)) { Regex eRgx = new Regex("@(([A-Za-z0-9_])*)", RegexOptions.IgnoreCase); foreach (Match em in eRgx.Matches(m.Value)) { tmpSql = tmpSql.Replace(em.Value, ""); } } //tmpSql = decRgx.Replace(tmpSql, ""); Regex rgxOne = new Regex("@(([A-Za-z0-9_])*)", RegexOptions.IgnoreCase); foreach (Match OneMth in rgxOne.Matches(tmpSql)) { if (myParameter.Find(p => p.Name.Equals(OneMth.Value)) == null) { string Bind_Name = "Bind_Name='{0}'"; Bind_Name = string.Format(Bind_Name, OneMth.Value); if (fdt.Select(Bind_Name).Length.Equals(0)) { DataRow dr = fdt.NewRow(); dr["Bind_WorkSet"] = gvt.GetFocusedRowCellValue("WorkSet_Id").ToStringEx(); dr["Bind_Name"] = OneMth.Value; dr["Bind_Nick"] = OneMth.Value; dr["Bind_Field"] = OneMth.Value.Trim('@'); dr["Bind_Width"] = 25; dr["Bind_ToolTip"] = OneMth.Value; dr["Bind_Sort"] = fdt.Rows.Count * 10 + 100; dr["Bind_Visible"] = true; dr["Bind_ReadOnly"] = false; dr["Bind_SqlDbType"] = (int)DbType.String; dr["Bind_Summary"] = 6; dr["IsDelete"] = 0; //分页 if (OneMth.Value == "@PageSize" || OneMth.Value == "@PageIndex") { dr["Bind_Sort"] = 999999; dr["Bind_SqlDbType"] = DbType.Int32; dr["Bind_Field"] = gvt.GetFocusedRowCellValue("WorkSet_Pagination").ToStringEx(); dr["Bind_Property"] = OneMth.Value.Trim('@'); } fdt.Rows.Add(dr); } } } } } catch (Exception ex) { SharedFunc.RaiseError(ex); } break; case "Debug": e.Button.Properties.Checked = false; try { if (gvt.FocusedRowHandle >= 0) { string WorkSet_Name = gvt.GetFocusedRowCellValue("WorkSet_Name").ToStringEx(); if (string.IsNullOrEmpty(WorkSet_Name.Trim())) { return; } DataTable fdt = (DataTable)gdf.DataSource; List <MyParameter> myParameter = new List <MyParameter>(); if (string.IsNullOrEmpty(rtfSql_Select.Text)) { return; } List <Sys_Bind> sys_Binds = EntityHelper.GetEntities <Sys_Bind>(fdt); foreach (Sys_Bind sys_Bind in sys_Binds) { myParameter.Add(sys_Bind.Bind_Name, (DbType)sys_Bind.Bind_SqlDbType, null, null); } DataTable dt = BaseService.Open(WorkSet_Name, myParameter); if (dt == null) { throw new ArgumentNullException(WorkSet_Name); } string TableName = gvt.GetFocusedRowCellValue("WorkSet_Table").ToStringEx(); List <MyParameter> SchemaPara = new List <MyParameter>(); SchemaPara.Add("@TableName", DbType.String, TableName, null); List <Sys_Schema> sys_Schemas = EntityHelper.GetEntities <Sys_Schema>(BaseService.Open("SystemWorkSet_Schema", SchemaPara)); foreach (DataColumn col in dt.Columns) { string Bind_Name = "Bind_Name='{0}'"; Bind_Name = string.Format(Bind_Name, col.ColumnName); if (fdt.Select(Bind_Name).Length.Equals(0)) { DataRow dr = fdt.NewRow(); dr["Bind_WorkSet"] = gvt.GetFocusedRowCellValue("WorkSet_Id").ToStringEx(); dr["Bind_Name"] = col.ColumnName; Sys_Schema sys_Schema = sys_Schemas.Find(s => s.FieldName == col.ColumnName); dr["Bind_Nick"] = sys_Schema != null && !string.IsNullOrEmpty(sys_Schema.Description) ? sys_Schema.Description : col.ColumnName; dr["Bind_Field"] = col.ColumnName; dr["Bind_ToolTip"] = col.ColumnName; dr["Bind_Sort"] = (col.Ordinal + 10) * 10 + 1000; dr["Bind_Visible"] = true; dr["Bind_ReadOnly"] = false; if (ReservedHelper.GridAutoField.Contains(col.ColumnName)) { dr["Bind_Visible"] = false; } dr["Bind_SqlDbType"] = (int)ConvertHelper.GetDbType(col.DataType); dr["Bind_Summary"] = 6; dr["IsDelete"] = 0; if (col.DataType.Equals(typeof(DateTime))) { dr["Bind_Width"] = 128; } else if (col.DataType.Equals(typeof(bool))) { dr["Bind_Width"] = 40; } else if (col.DataType.Equals(typeof(int))) { dr["Bind_Width"] = 60; } else { dr["Bind_Width"] = 100; } string submit = gvt.GetFocusedRowCellValue("WorkSet_Type").ToStringEx(); if (submit.Equals("7")) { dr["Bind_FormWidth"] = 25; dr["Bind_FormSort"] = (col.Ordinal + 10) * 10 + 1000; dr["Bind_Push"] = "edit_" + col.ColumnName; dr["Bind_Property"] = "EditValue"; } //IsEditable if (col.ColumnName == "IsEditable") { dr["Bind_Default"] = "True"; } //IsEditable if (col.ColumnName == "IsEnabled") { dr["Bind_Default"] = "True"; } if (col.ColumnName == "PageCount") { dr["Bind_Property"] = col.ColumnName; dr["Bind_Push"] = gvt.GetFocusedRowCellValue("WorkSet_Pagination").ToStringEx(); dr["Bind_Sort"] = 999999; } fdt.Rows.Add(dr); } } } } catch (Exception ex) { SharedFunc.RaiseError(ex); } break; case "Design": e.Button.Properties.Checked = false; break; case "Subversion": e.Button.Properties.Checked = false; List <MyParameter> mps = new List <MyParameter>(); mps.Add("@cSubversion_Table", DbType.String, "Sys_WorkSet", null); mps.Add("@cSubversion_Field", DbType.String, "WorkSet_" + CurBtn, null); mps.Add("@cSubversion_Key", DbType.String, gvt.GetFocusedRowCellValue("WorkSet_Id").ToStringEx(), null); lstVer.Manager.Items.Clear(); DataTable sdt = BaseService.Open("SystemWorkSet_Subversion", mps); List <Sys_Subversion> sys_Subversions = EntityHelper.GetEntities <Sys_Subversion>(sdt); foreach (Sys_Subversion sys_Subversion in sys_Subversions) { string cat = sys_Subversion.Subversion_Version.ToString("yyyy-MM-dd"); DevExpress.XtraBars.BarSubItem subItem; if (lstVer.Manager.Items[cat] == null) { subItem = new DevExpress.XtraBars.BarSubItem(); subItem.Name = cat; subItem.Caption = cat; lstVer.AddItem(subItem); } subItem = (DevExpress.XtraBars.BarSubItem)lstVer.Manager.Items[cat]; DevExpress.XtraBars.BarButtonItem bsi = new DevExpress.XtraBars.BarButtonItem(); bsi.Name = sys_Subversion.Subversion_Id.ToString(); bsi.Hint = sys_Subversion.Subversion_Value; bsi.Description = sys_Subversion.Subversion_Value; bsi.Caption = sys_Subversion.Subversion_Version.ToString("HH:mm:ss"); bsi.Tag = sys_Subversion.Subversion_Value; bsi.ItemClick += Bsi_ItemClick; subItem.AddItem(bsi); } lstVer.ShowPopup(Control.MousePosition); break; case "Reset": e.Button.Properties.Checked = false; break; default: break; } } catch (Exception ex) { SharedFunc.RaiseError(ex); } }
private void MyTree_DoubleClick(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; sw.Restart(); List <Sys_Menu> MenuData = (List <Sys_Menu>)Provider.UserMenus; Sys_Menu sys_Menu = MenuData[MyTree.FocusedNode.Id]; if (string.IsNullOrEmpty(sys_Menu.Menu_Page)) { return; } if (!IsMenuOpen(sys_Menu)) { ImageCollection ims = (ImageCollection)MyTree.SelectImageList; if (ims != null) { barTip.ImageOptions.Image = ims.Images[sys_Menu.Menu_IconIndex];// MyTree.FocusedNode.ImageIndex sys_Menu.Menu_IconIndex; } Sys_Menu sys_Page = InitializePage(sys_Menu); if (sys_Page != null) { ChildPage myPage = SharedFunc.LoadPage(sys_Page); if (myPage == null) { myPage = new ChildPage(); } myPage.SysMenu = sys_Menu; switch ((Sys_Menu_Show)sys_Page.Menu_Show) { case Sys_Menu_Show.MdiChild: myPage.MdiParent = this; myPage.Show(); break; case Sys_Menu_Show.Dialog: myPage.ShowDialog(); break; case Sys_Menu_Show.NewForm: myPage.Show(); break; default: break; } } } barTip.Caption = TimeDiff(sw); barTip.Hint = string.Empty; } catch (Exception ex) { SharedFunc.RaiseError(ex); } finally { this.Cursor = Cursors.Default; } }