private void Build() { MissingTables = new List <string>(); //dcon=new DataConnection(); command = "SHOW TABLES"; DataTable table = dcon.GetTable(command); string outputFile = ODFileUtils.CombinePaths(new string[] { "..", "..", "OpenDentalDocumentation.xml" }); XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.IndentChars = (" "); //input: string inputFile = ODFileUtils.CombinePaths(new string[] { "..", "..", "..", "OpenDentBusiness", "bin", "Release", "OpenDentBusiness.xml" }); XmlDocument document = new XmlDocument(); document.Load(inputFile); Navigator = document.CreateNavigator(); using (XmlWriter writer = XmlWriter.Create(outputFile, settings)){ //<?xml-stylesheet type="text/xsl" href="OpenDentalDocumentation.xsl"?> writer.WriteProcessingInstruction("xml-stylesheet", "type=\"text/xsl\" href=\"OpenDentalDocumentation.xsl\""); //("<?xml-stylesheet type=\"text/xsl\" href=\"OpenDentalDocumentation.xsl\"?>"); writer.WriteStartElement("database"); writer.WriteAttributeString("version", textVersion.Text); for (int i = 0; i < table.Rows.Count; i++) { WriteTable(writer, table.Rows[i][0].ToString()); } writer.WriteEndElement(); writer.Flush(); } if (MissingTables.Count > 0) { string s = ""; for (int i = 0; i < MissingTables.Count; i++) { if (i > 0) { s += "\r\n"; } s += MissingTables[i]; } MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(s); msgbox.ShowDialog(); Environment.Exit(110); return; } if (!string.IsNullOrEmpty(_errorMessage.ToString())) { MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(_errorMessage.ToString()); msgbox.ShowDialog(); Environment.Exit(111); return; } //ProcessStartInfo startInfo=new ProcessStartInfo(); //Process.Start("Notepad.exe",outputFile); //Process.Start("iexplore.exe",outputFile); Process.Start(outputFile); Application.Exit(); }
private void ShowColor(object sender) { Color color = ((Button)sender).BackColor; int colorint = color.ToArgb(); MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(colorint.ToString()); msgbox.ShowDialog(); }
private void Build() { MissingTables = new List <string>(); //dcon=new DataConnection(); List <ODTable> table = ODTables.GetODTables(dcon); string outputFile = ODFileUtils.CombinePaths(new string[] { "..", "..", "OpenDentalDocumentation.xml" }); //input: string inputFileODBusiness = ODFileUtils.CombinePaths(new string[] { "..", "..", "..", "OpenDentBusiness", "bin", "Release", "OpenDentBusiness.xml" }); string inputFileCodeBase = ODFileUtils.CombinePaths(new string[] { "..", "..", "..", "CodeBase", "bin", "Release", "CodeBase.xml" }); NavigatorODBusiness = GetEnumNavigator(inputFileODBusiness); NavigatorCodeBase = GetEnumNavigator(inputFileCodeBase); WriteXml(outputFile, table); if (MissingTables.Count > 0) { string s = ""; for (int i = 0; i < MissingTables.Count; i++) { if (i > 0) { s += "\r\n"; } s += MissingTables[i]; } MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(s); msgbox.ShowDialog(); Environment.Exit(110); return; } if (!string.IsNullOrEmpty(_errorMessage.ToString())) { MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(_errorMessage.ToString()); msgbox.ShowDialog(); Environment.Exit(111); return; } //ProcessStartInfo startInfo=new ProcessStartInfo(); //Process.Start("Notepad.exe",outputFile); //Process.Start("iexplore.exe",outputFile); if (!_isSilentMode) { Process.Start(outputFile); } Application.Exit(); }
private void butLocks_Click(object sender, EventArgs e) { if (gridMain.SelectedIndices.Length == 0) { MsgBox.Show(this, "Please select at least one connection."); return; } List <CentralConnection> listSelectedConns = new List <CentralConnection>(); for (int i = 0; i < gridMain.SelectedIndices.Length; i++) { if (((CentralConnection)gridMain.Rows[gridMain.SelectedIndices[i]].Tag).ConnectionStatus != "OK") { continue; } listSelectedConns.Add((CentralConnection)gridMain.Rows[gridMain.SelectedIndices[i]].Tag); } MsgBoxCopyPaste MsgBoxCopyPaste = new MsgBoxCopyPaste(CentralSyncHelper.SyncLocks(listSelectedConns)); MsgBoxCopyPaste.ShowDialog(); FillGrid(); }
private void butSync_Click(object sender, EventArgs e) { if (textDate.errorProvider1.GetError(textDate) != "") { MsgBox.Show(this, "Please fix error first."); return; } //Enter info into local DB before pushing out to others so we save it. int days = PIn.Int(textDays.Text); DateTime date = PIn.Date(textDate.Text); Prefs.UpdateString(PrefName.SecurityLockDate, POut.Date(date, false)); Prefs.UpdateInt(PrefName.SecurityLockDays, days); Prefs.UpdateBool(PrefName.SecurityLockIncludesAdmin, checkAdmin.Checked); Prefs.UpdateBool(PrefName.CentralManagerSecurityLock, checkEnable.Checked); FormCentralConnections FormCC = new FormCentralConnections(); FormCC.LabelText.Text = Lans.g("CentralSecurity", "Sync will create or update the Central Management users, passwords, and user groups to all selected databases."); FormCC.Text = Lans.g("CentralSecurity", "Sync Security"); foreach (CentralConnection conn in ListConns) { FormCC.ListConns.Add(conn.Copy()); } List <CentralConnection> listSelectedConns = new List <CentralConnection>(); if (FormCC.ShowDialog() == DialogResult.OK) { listSelectedConns = FormCC.ListConns; } else { return; } MsgBoxCopyPaste MsgBoxCopyPaste = new MsgBoxCopyPaste(CentralSyncHelper.SyncAll(listSelectedConns)); MsgBoxCopyPaste.ShowDialog(); }
private void butSyncUsers_Click(object sender, EventArgs e) { FormCentralConnections FormCC = new FormCentralConnections(); FormCC.LabelText.Text = Lans.g("CentralSecurity", "Sync will create or update the Central Management users, passwords, and user groups to all selected databases."); FormCC.Text = Lans.g("CentralSecurity", "Sync Security"); foreach (CentralConnection conn in ListConns) { FormCC.ListConns.Add(conn.Copy()); } List <CentralConnection> listSelectedConns = new List <CentralConnection>(); if (FormCC.ShowDialog() == DialogResult.OK) { listSelectedConns = FormCC.ListConns; } else { return; } MsgBoxCopyPaste MsgBoxCopyPaste = new MsgBoxCopyPaste(CentralSyncHelper.SyncUsers(listSelectedConns)); MsgBoxCopyPaste.ShowDialog(); }
private void RunProvider() { ReportComplex report = new ReportComplex(true, true); _dateFrom = PIn.Date(textDateFrom.Text); _dateTo = PIn.Date(textDateTo.Text); List <DataSet> listProdData = new List <DataSet>(); List <Provider> listProvs = new List <Provider>(); List <string> listServerNames = new List <string>(); string strFailedConn = ""; for (int i = 0; i < ConnList.Count; i++) { ODThread odThread = new ODThread(ConnectAndRunProviderReport, new object[] { ConnList[i] }); odThread.GroupName = "ConnectAndReportProvider"; odThread.Start(false); } ODThread.JoinThreadsByGroupName(Timeout.Infinite, "ConnectAndReportProvider"); List <ODThread> listThreads = ODThread.GetThreadsByGroupName("ConnectAndReportProvider"); for (int i = 0; i < listThreads.Count; i++) { object[] obj = (object[])listThreads[i].Tag; DataSet data = (DataSet)obj[0]; string connString = CentralConnections.GetConnectionString((CentralConnection)obj[1]); List <Provider> listConnProvs = (List <Provider>)obj[2]; if (data == null) { strFailedConn += connString + "\r\n"; } else { listServerNames.Add(connString); listProdData.Add(data); listProvs.AddRange(listConnProvs); } listThreads[i].QuitSync(Timeout.Infinite); } report.ReportName = "Provider P&I"; report.AddTitle("Title", Lan.g(this, "Provider Production and Income")); report.AddSubTitle("PracName", PrefC.GetString(PrefName.PracticeTitle)); report.AddSubTitle("Date", _dateFrom.ToShortDateString() + " - " + _dateTo.ToShortDateString()); report.AddSubTitle("Providers", Lan.g(this, "All Providers")); report.AddSubTitle("Clinics", Lan.g(this, "All Clinics")); //setup query QueryObject query; DataSet dsTotal = new DataSet(); for (int i = 0; i < listProdData.Count; i++) { DataTable dt = listProdData[i].Tables["Clinic"]; DataTable dtTot = listProdData[i].Tables["Total"].Copy(); dtTot.TableName = dtTot.TableName + "_" + i; dsTotal.Tables.Add(dtTot); query = report.AddQuery(dt, listServerNames[i], "Clinic", SplitByKind.Value, 1, true); // add columns to report query.AddColumn("Provider", 75, FieldValueType.String); query.AddColumn("Production", 120, FieldValueType.Number); query.AddColumn("Adjustments", 120, FieldValueType.Number); query.AddColumn("Writeoff", 120, FieldValueType.Number); query.AddColumn("Tot Prod", 120, FieldValueType.Number); query.AddColumn("Pt Income", 120, FieldValueType.Number); query.AddColumn("Ins Income", 120, FieldValueType.Number); query.AddColumn("Total Income", 120, FieldValueType.Number); } if (dsTotal.Tables.Count == 0) { MsgBox.Show(this, "This report returned no values"); return; } DataTable dtTotal; decimal production; decimal adjust; decimal inswriteoff; decimal totalproduction; decimal ptincome; decimal insincome; decimal totalincome; dtTotal = dsTotal.Tables[0].Clone(); for (int i = 0; i < listProvs.Count; i++) { Provider provCur = listProvs[i]; DataRow row = dtTotal.NewRow(); row[0] = provCur.Abbr; production = 0; adjust = 0; inswriteoff = 0; totalproduction = 0; ptincome = 0; insincome = 0; totalincome = 0; bool hasAnyAmount = false; for (int j = 0; j < dsTotal.Tables.Count; j++) { for (int k = 0; k < dsTotal.Tables[j].Rows.Count; k++) { if (dsTotal.Tables[j].Rows[k][0].ToString() == provCur.Abbr && (PIn.Decimal(dsTotal.Tables[j].Rows[k]["Production"].ToString()) != 0 || PIn.Decimal(dsTotal.Tables[j].Rows[k]["Adjustments"].ToString()) != 0 || PIn.Decimal(dsTotal.Tables[j].Rows[k]["WriteOff"].ToString()) != 0 || PIn.Decimal(dsTotal.Tables[j].Rows[k]["Pt Income"].ToString()) != 0 || PIn.Decimal(dsTotal.Tables[j].Rows[k]["Ins Income"].ToString()) != 0)) { production += PIn.Decimal(dsTotal.Tables[j].Rows[k]["Production"].ToString()); adjust += PIn.Decimal(dsTotal.Tables[j].Rows[k]["Adjustments"].ToString()); inswriteoff += PIn.Decimal(dsTotal.Tables[j].Rows[k]["WriteOff"].ToString()); //Writeoffs stored as negative number ptincome += PIn.Decimal(dsTotal.Tables[j].Rows[k]["Pt Income"].ToString()); insincome += PIn.Decimal(dsTotal.Tables[j].Rows[k]["Ins Income"].ToString()); hasAnyAmount = true; } } } totalproduction = production + adjust + inswriteoff; totalincome = ptincome + insincome; row[1] = production.ToString("n"); row[2] = adjust.ToString("n"); row[3] = inswriteoff.ToString("n"); row[4] = totalproduction.ToString("n"); row[5] = ptincome.ToString("n"); row[6] = insincome.ToString("n"); row[7] = totalincome.ToString("n"); if (hasAnyAmount) { dtTotal.Rows.Add(row); } } query = report.AddQuery(dtTotal, "Totals", "", SplitByKind.None, 2, true); query.AddColumn("Provider", 75, FieldValueType.String); query.AddColumn("Production", 120, FieldValueType.Number); query.AddColumn("Adjustments", 120, FieldValueType.Number); query.AddColumn("Writeoff", 120, FieldValueType.Number); query.AddColumn("Tot Prod", 120, FieldValueType.Number); query.AddColumn("Pt Income", 120, FieldValueType.Number); query.AddColumn("Ins Income", 120, FieldValueType.Number); query.AddColumn("Total Income", 120, FieldValueType.Number); report.AddPageNum(); // execute query if (!report.SubmitQueries()) //Does not actually submit queries because we use datatables in the central management tool. { return; } if (strFailedConn != "") { MsgBoxCopyPaste msgBoxCP = new MsgBoxCopyPaste(strFailedConn); msgBoxCP.ShowDialog(); } // display the report FormReportComplex FormR = new FormReportComplex(report); FormR.ShowDialog(); DialogResult = DialogResult.OK; }
private void RunMonthly() { ReportComplex report = new ReportComplex(true, false); _dateFrom = PIn.Date(textDateFrom.Text); _dateTo = PIn.Date(textDateTo.Text); List <DataSet> listProdData = new List <DataSet>(); //A list of all data sets for each connection. List <string> listServerNames = new List <string>(); string stringFailedConns = ""; for (int i = 0; i < ConnList.Count; i++) { ODThread odThread = new ODThread(ConnectAndRunMonthlyReport, new object[] { ConnList[i] }); odThread.GroupName = "ConnectAndReportMonthly"; odThread.Start(false); } ODThread.JoinThreadsByGroupName(Timeout.Infinite, "ConnectAndReportMonthly"); List <ODThread> listThreads = ODThread.GetThreadsByGroupName("ConnectAndReportMonthly"); for (int i = 0; i < listThreads.Count; i++) { object[] obj = (object[])listThreads[i].Tag; DataSet data = (DataSet)obj[0]; string connString = CentralConnections.GetConnectionString((CentralConnection)obj[1]); if (data == null) { stringFailedConns += connString + "\r\n"; } else { listServerNames.Add(connString); listProdData.Add(data); } listThreads[i].QuitSync(Timeout.Infinite); } report.ReportName = "MonthlyP&I"; report.AddTitle("Title", Lan.g(this, "Monthly Production and Income")); report.AddSubTitle("Date", _dateFrom.ToShortDateString() + " - " + _dateTo.ToShortDateString()); report.AddSubTitle("Clinics", Lan.g(this, "All Clinics")); QueryObject query; DataSet dsTotal = new DataSet();//Totals dataset for all connections, it contains a totals table per connection. We use this later for a summary section. int queryObjectNum = 0; for (int i = 0; i < listProdData.Count; i++) { DataTable dt = listProdData[i].Tables["Clinic"]; DataTable dtTot = listProdData[i].Tables["Total"].Copy(); if (dt.Rows.Count > 0 && dtTot.Rows.Count > 0) { queryObjectNum++; dtTot.TableName = dtTot.TableName + "_" + i; dsTotal.Tables.Add(dtTot); query = report.AddQuery(dt, listServerNames[i], "Clinic", SplitByKind.Value, 1, true); // add columns to report Font font = new Font("Tahoma", 8, FontStyle.Regular); query.AddColumn("Date", 70, FieldValueType.String, font); query.AddColumn("Weekday", 70, FieldValueType.String, font); query.AddColumn("Production", 80, FieldValueType.Number, font); query.AddColumn("Sched", 80, FieldValueType.Number, font); query.AddColumn("Adj", 80, FieldValueType.Number, font); query.AddColumn("Writeoff", 80, FieldValueType.Number, font); query.AddColumn("Tot Prod", 80, FieldValueType.Number, font); query.AddColumn("Pt Income", 80, FieldValueType.Number, font); query.AddColumn("Ins Income", 80, FieldValueType.Number, font); query.AddColumn("Tot Income", 80, FieldValueType.Number, font); } else { MsgBox.Show(this, "Connection " + listServerNames[i] + " has no results to show."); } } if (dsTotal.Tables.Count == 0) { MsgBox.Show(this, "This report returned no values"); return; } //setup query DataTable dtTotal; double production; double sched; double adjust; double writeoff; double totprod; double ptincome; double insincome; double totalincome; DateTime[] dates = new DateTime[(_dateTo - _dateFrom).Days]; dtTotal = dsTotal.Tables[0].Clone(); dtTotal.Rows.Clear(); for (int i = 0; i < dates.Length; i++) //Per day { production = 0; sched = 0; adjust = 0; writeoff = 0; totprod = 0; ptincome = 0; insincome = 0; totalincome = 0; dates[i] = _dateFrom.AddDays(i); DataRow row = dtTotal.NewRow(); row[0] = dates[i].ToShortDateString(); row[1] = dates[i].DayOfWeek; //Weekday for (int j = 0; j < dsTotal.Tables.Count; j++) //Per totals table { for (int k = 0; k < dsTotal.Tables[j].Rows.Count; k++) //Per row //If it's the correct day, add to the totals. { if (PIn.Date(dsTotal.Tables[j].Rows[k]["Month"].ToString()).ToShortDateString() == dates[i].ToShortDateString()) { DataRow dataRow = dsTotal.Tables[j].Rows[k]; production += PIn.Double(dataRow["Production"].ToString()); sched += PIn.Double(dataRow["Sched"].ToString()); adjust += PIn.Double(dataRow["Adjustments"].ToString()); writeoff += PIn.Double(dataRow["Writeoff"].ToString()); //Writeoffs stored as negative number totprod += PIn.Double(dataRow["Tot Prod"].ToString()); ptincome += PIn.Double(dataRow["Pt Income"].ToString()); insincome += PIn.Double(dataRow["Ins Income"].ToString()); totalincome += PIn.Double(dataRow["Total Income"].ToString()); break; } } } if (production == 0 && sched == 0 && adjust == 0 && writeoff == 0 && totprod == 0 && ptincome == 0 && insincome == 0 && totalincome == 0) { continue; //Don't display this row if there's nothing to show. (Wasn't like this in 14.3 but is now in 15.3) } row[2] = production.ToString("n"); row[3] = sched.ToString("n"); row[4] = adjust.ToString("n"); row[5] = writeoff.ToString("n"); row[6] = totprod.ToString("n"); row[7] = ptincome.ToString("n"); row[8] = insincome.ToString("n"); row[9] = totalincome.ToString("n"); dtTotal.Rows.Add(row); } query = report.AddQuery(dtTotal, "Totals", "", SplitByKind.None, 2, true); Font font2 = new Font("Tahoma", 8, FontStyle.Regular); query.AddColumn("Date", 70, FieldValueType.String, font2); query.AddColumn("Weekday", 70, FieldValueType.String, font2); query.AddColumn("Production", 80, FieldValueType.Number, font2); query.AddColumn("Sched", 80, FieldValueType.Number, font2); query.AddColumn("Adj", 80, FieldValueType.Number, font2); query.AddColumn("Writeoff", 80, FieldValueType.Number, font2); query.AddColumn("Tot Prod", 80, FieldValueType.Number, font2); query.AddColumn("Pt Income", 80, FieldValueType.Number, font2); query.AddColumn("Ins Income", 80, FieldValueType.Number, font2); query.AddColumn("Tot Income", 80, FieldValueType.Number, font2); query.AddGroupSummaryField("Total Production (Production + Adjustments - Writeoffs): ", "Writeoff", "Tot Prod", SummaryOperation.Sum, new List <int>() { queryObjectNum }, Color.Black, new Font("Tahoma", 9, FontStyle.Bold), 104, 20); query.AddGroupSummaryField("Total Income (Pt Income + Ins Income): ", "Writeoff", "Total Income", SummaryOperation.Sum, new List <int>() { queryObjectNum }, Color.Black, new Font("Tahoma", 9, FontStyle.Bold), 0, 25); report.AddPageNum(); // execute query if (!report.SubmitQueries()) //Does not actually submit queries because we use datatables in the central management tool. { return; } if (stringFailedConns != "") { stringFailedConns = "Failed Connections:\r\n" + stringFailedConns; MsgBoxCopyPaste msgBoxCP = new MsgBoxCopyPaste(stringFailedConns); msgBoxCP.ShowDialog(); } // display the report FormReportComplex FormR = new FormReportComplex(report); FormR.ShowDialog(); DialogResult = DialogResult.OK; }