//public static Dictionary<string, Func<DataTable, T>> _toDatablesFunctions; public static DataTable DefaultToDataTable <T>(T v) { DataTable dt = new DataTable(); if (v is IEnumerable) { IEnumerator enumerator = ((IEnumerable)v).GetEnumerator(); while (enumerator.MoveNext()) { zdt.AddRow(dt, enumerator.Current); } } else { zdt.AddColumns(dt, "name, value"); TypeView view = new TypeView(v); foreach (NamedValue value in view.Values) { string sName = value.Name; if (sName == "") { sName = "value"; } //dt.Rows.Add(sName, value.Value); DataRow row = dt.NewRow(); row["name"] = sName; row["value"] = value.Value; dt.Rows.Add(row); } } return(dt); }
private void ShowIssueDayForm(LoadMWH loadMWH, int year, int month, TypeView typeView, string tracker) { string text = ""; if (typeView == TypeView.LoadIssueDWH) { text = "План на "; if (loadMWH.item != null) { text = loadMWH.item.Name + " " + tracker + " план на "; } } if (typeView == TypeView.LoadTimeDWH) { text = "Факт на "; if (loadMWH.item != null) { text = loadMWH.item.Name + " " + tracker + " факт на "; } } issueMonthForm = new IssueDayForm(loadMWH, manager, year, month, typeView, typeViewSelect, tracker); manager.Update += issueMonthForm.UpdateIssueInfo; DateTime dateText = new DateTime(year, month, 1); issueMonthForm.Text = text + dateText.ToString("MMMM yyyy"); issueMonthForm.Show(); }
public static void AddToRow(DataRow row, object v) { TypeView view = new TypeView(v); DataColumnCollection columns = row.Table.Columns; foreach (NamedValue value in view.Values) { string sName = value.Name; if (sName == "") { sName = "value"; } int iCol = columns.IndexOf(sName); if (iCol == -1) { Type type = typeof(string); if (value.Value != null) { Type type2 = value.Value.GetType(); if (type2 == typeof(Bitmap)) { type = type2; } } DataColumn col = columns.Add(sName, type); iCol = col.Ordinal; } row[iCol] = value.Value; } }
public static void zWriteToFile <T>(this IEnumerable <T> list, string sPath, bool bAppend) { if (list == null) { return; } string sDir = cu.PathGetDir(sPath); if (!Directory.Exists(sDir)) { Directory.CreateDirectory(sDir); } FileMode fm = FileMode.Create; if (bAppend) { fm = FileMode.Append; } FileStream fs = new FileStream(sPath, fm, FileAccess.Write, FileShare.Read); StreamWriter ws = new StreamWriter(fs, Encoding.Default); try { foreach (T v in list) { if (v != null) { //ws.WriteLine(v.ToString()); TypeView view = new TypeView(v); bool bFirst = true; foreach (NamedValue value in view.Values) { if (!bFirst) { ws.Write("\t"); } bFirst = false; if (value.Value != null) { ws.Write(value.Value.ToString()); } } ws.WriteLine(); } else { ws.WriteLine(); } } } finally { ws.Close(); } }
public IssueDayForm(LoadUser loadUser, Manager manager, TypeView typeView, TypeView typeViewSelect, string tracker) { InitializeComponent(); this.IDLoadUser = loadUser.user.Id; this.tracker = tracker; this.manager = manager; this.typeView = typeView; this.typeViewSelect = typeViewSelect; MakeCaptionColumnsDWH(); ShowLoad_TimeDWH(); }
private void ShowIssueDayForm(LoadUser loadUser, TypeView typeView) { string text = "Просроченные задачи специалиста "; //if (typeView == TypeView.LoadIssueDWH) // text = "Запланировано на "; //if (typeView == TypeView.LoadTimeDWH) // text = "Факт на "; issueMonthForm = new IssueDayForm(loadUser, manager, typeView, typeViewSelect, ""); manager.Update += issueMonthForm.UpdateIssueInfo; //DateTime dateText = new DateTime(year, month, 1); issueMonthForm.Text = text + loadUser.user.LastName + " " + loadUser.user.FirstName; issueMonthForm.Show(); }
private void ShowIssueDayForm(LoadProject loadProject, TypeView typeView) { string text = "Просроченные задачи по проекту "; //if (typeView == TypeView.LoadIssueDWH) // text = "Запланировано на "; //if (typeView == TypeView.LoadTimeDWH) // text = "Факт на "; issueMonthForm = new IssueDayForm(loadProject, manager, typeView, typeViewSelect, ""); manager.Update += issueMonthForm.UpdateIssueInfo; //DateTime dateText = new DateTime(year, month, 1); issueMonthForm.Text = text + loadProject.userProject.Name; issueMonthForm.Show(); }
public static TypeView tToTV(TypeTache t) { TypeView tv = null; if (t.Parent != null) { tv = tToTV(t.Parent); } return(new TypeView() { Nom = t.Nom, Parent = tv }); }
public LoadMWHForm(Manager manager, TypeView typeView, TypeView typeViewSelect) { InitializeComponent(); this.manager = manager; this.typeView = typeView; this.typeViewSelect = typeViewSelect; ToolStripMenuItem emailSendMenuItem = new ToolStripMenuItem("Отправить сообщение специалистам"); contextMenuStrip1.Items.Add(emailSendMenuItem); emailSendMenuItem.Click += emailSend_Click; switch (typeView) { case TypeView.LoadProject: tabIndex = 8; break; case TypeView.LoadProjectUser: tabIndex = 8; break; case TypeView.LoadGroup: tabIndex = 5; break; case TypeView.LoadUser: tabIndex = 5; break; case TypeView.LoadYWH: tabIndex = 4; break; case TypeView.LoadExperiedUser: this.listLoadMWH.ContextMenuStrip = contextMenuStrip1; tabIndex = 0; break; case TypeView.LoadExperiedProject: this.listLoadMWH.ContextMenuStrip = contextMenuStrip1; tabIndex = 5; break; } Start(); }
public IssueDayForm(LoadMWH loadMWH, Manager manager, int year, int month, TypeView typeView, TypeView typeViewSelect, string tracker) { InitializeComponent(); this.loadMWH = loadMWH; this.IDitem = loadMWH.item.Id; this.tracker = tracker; this.month = month; this.year = year; this.item = loadMWH.item; this.manager = manager; this.typeView = typeView; this.typeViewSelect = typeViewSelect; MakeCaptionColumnsDWH(); ShowLoad_TimeDWH(); }
public ReportForm(Manager manager, string title, TypeView typeView) { InitializeComponent(); this.manager = manager; this.title = title; switch (typeView) { case TypeView.ReportProject: ShowReportProject(); break; case TypeView.ReportIssue: ShowReportIssue(); break; case TypeView.ReportEmail: ShowReportEmailMessage(); break; } }
private void listPowerObjects_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { PBDotNetLib.orca.ILibEntry lib; LibEntryView libView = null; TypeView typeView = null; Powerscript.Type[] types; Powerscript.Datawindow dw; if (e.NewValue is LibEntryView) { libView = (LibEntryView)e.NewValue; typeView = libView.Type; } else if (e.NewValue is TypeView) { typeView = (TypeView)e.NewValue; libView = (typeView).Parent; } if (libView != null) { lib = libView.LibEntry; txtSource.TextArea.Document.Text = lib.Source ?? ""; switch (lib.Type) { case Objecttype.Datawindow: tabUserobject.Visibility = System.Windows.Visibility.Collapsed; tabDatawindow.Visibility = System.Windows.Visibility.Visible; dw = Powerscript.Datawindow.GetDatawindowFromSource(lib.Source); txtDwRelease.Text = dw.Release; if (dw.Object != null) { listDatawindowObjs.ItemsSource = dw.Object.Childs; } break; case Objecttype.Structure: tabUserobject.Header = "Structure"; goto case Objecttype.Window; case Objecttype.Menu: tabUserobject.Header = "Menu"; goto case Objecttype.Window; case Objecttype.Function: tabUserobject.Header = "Function"; goto case Objecttype.Window; case Objecttype.Application: tabUserobject.Header = "Application"; goto case Objecttype.Window; case Objecttype.Userobject: tabUserobject.Header = "UserObject"; goto case Objecttype.Window; case Objecttype.Window: tabUserobject.Visibility = System.Windows.Visibility.Visible; tabDatawindow.Visibility = System.Windows.Visibility.Collapsed; if (lib.Type == Objecttype.Window) { tabUserobject.Header = "Window"; } types = Powerscript.Type.GetTypesFromSource(lib.Source); if (types == null) { MessageBox.Show("keine Types"); return; } gridUoTypes.ItemsSource = types; if (libView.Types == null) { List <TypeView> typeViews = new List <TypeView>(); foreach (Powerscript.Type t in types) { if (t.Name == libView.Name) { libView.Type = new TypeView(t, libView); typeView = libView.Type; } else { typeViews.Add(new TypeView(t, libView)); } } libView.Types = typeViews; } gridUoProps.ItemsSource = typeView.Type.Properties; if (types.Length > 0) { txtUoIVariables.TextArea.Document.Text = types[0].InstanceVariables ?? ""; txtUoSVariables.TextArea.Document.Text = types[0].SharedVariables ?? ""; txtUoGVariables.TextArea.Document.Text = types[0].GlobalVariables ?? ""; txtUoExtFunctions.TextArea.Document.Text = types[0].ExternalFunctions ?? ""; gridUoMethods.ItemsSource = types[0].Methods; } break; } } }