private void createQueryBuilder(string connectionString, bool loadDefaultDatabaseOnly = false, bool loadSystemObjects = false, bool withFields = true) { this._qb = new QueryBuilder( ) { SyntaxProvider = new SQLiteSyntaxProvider( ), MetadataProvider = new SQLiteMetadataProvider( ) }; SQLiteConnectionParameters connParms = new SQLiteConnectionParameters( ); connParms.FileName = connectionString; connParms.Password = "******"; //string cs = SQLiteConnectionProvider.GetConnectionString( connectionString ); string cs = @"Data Source=" + connectionString;//+ ";Version=3;"; this._qb.MetadataProvider.Connection = new System.Data.SQLite.SQLiteConnection(cs); { MetadataLoadingOptions loadingOptions = this._qb.SQLContext.MetadataContainer.LoadingOptions; loadingOptions.LoadDefaultDatabaseOnly = loadDefaultDatabaseOnly; loadingOptions.LoadSystemObjects = loadSystemObjects; //loadingOptions.IncludeFilter.Types = MetadataType.Field; //loadingOptions.ExcludeFilter.Schemas.Add("dbo"); } //qb.InitializeDatabaseSchemaTree(); this._qb.MetadataContainer.LoadAll(withFields); } // createQueryBuilder(...)
private void Configurator_ConfigureDataConnection(object sender, ConfigureDataConnectionWebEventArgs e) { if (e.ConnectionName == "sqliteConnection") { SQLiteConnectionParameters sqliteParams = new SQLiteConnectionParameters(); sqliteParams.FileName = "file:Data/nwind.db"; e.ConnectionParameters = sqliteParams; } }
private static DashboardSqlDataSource CreateSQLiteDataSource() { SQLiteConnectionParameters sqliteParams = new SQLiteConnectionParameters(); sqliteParams.FileName = @"Data\nwind.db"; DashboardSqlDataSource sqlDataSource = new DashboardSqlDataSource("SQLite Data Source", sqliteParams); SelectQuery selectQuery = SelectQueryFluentBuilder .AddTable("Orders") .SelectAllColumnsFromTable() .Build("SQLite Orders"); sqlDataSource.Queries.Add(selectQuery); sqlDataSource.Fill(); return(sqlDataSource); }
public static SqlDataSource CreateSqlDataSource() { string rootPath = Path.GetDirectoryName(typeof(Form1).Assembly.Location); SQLiteConnectionParameters connectionParameters = new SQLiteConnectionParameters(Path.Combine(rootPath, "nwind.db"), null); SqlDataSource sqlDataSource = new SqlDataSource(connectionParameters); SelectQuery querySalesPerson = SelectQueryFluentBuilder .AddTable("Customers") .SelectAllColumnsFromTable() .Build("Customers"); sqlDataSource.Queries.Add(querySalesPerson); return(sqlDataSource); }
public object CreateDataSource() { SQLiteConnectionParameters connectionParameters = new SQLiteConnectionParameters("Data\\nwind.db", ""); SqlDataSource sqlDataSource = new SqlDataSource(connectionParameters); CustomSqlQuery queryProducts = new CustomSqlQuery() { Name = "Products", Sql = "SELECT " + "Products.ProductID,Products.ProductName,Products.UnitPrice,Products.QuantityPerUnit," + "Categories.CategoryID,Categories.CategoryName,Categories.Description,Categories.Picture " + "FROM Products INNER JOIN Categories ON Products.CategoryID=Categories.CategoryID" }; sqlDataSource.Queries.Add(queryProducts); sqlDataSource.Fill(); return(sqlDataSource); }
private void Window_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.F1) { XtraReport1 report = new XtraReport1(); SQLiteConnectionParameters FF = new SQLiteConnectionParameters(); FF.FileName = Properties.Settings.Default.path; ((SqlDataSource)report.DataSource).ConnectionParameters = FF; XtraReportPreviewModel model = new XtraReportPreviewModel(report); DocumentPreviewWindow windoww = new DocumentPreviewWindow() { Model = model }; report.CreateDocument(true); windoww.ShowDialog(); //using (ReportPrintTool printTool = new ReportPrintTool(report)) //{ // printTool.Print(); // //or printTool.PrintDialog(); //} } }
private void Print_Click(object sender, RoutedEventArgs e) { var SumPricee = new FunctionsOfSum(); var Fa_delete = new Assest.OrcDataAcess(); var FA = new Assest.OrcDataAcess(); try { double afo = 0; var Filtring = new List <string>(); foreach (string item in PriceList) { Filtring.Add(item.Replace("SAR", "")); } var accc = new Assest.OrcDataAcess(); List <string> L0 = new List <string>(); List <string> L1 = new List <string>(); List <string> L2 = new List <string>(); List <string> L3 = new List <string>(); List <string> L4 = new List <string>(); List <string> L5 = new List <string>(); List <string> L6 = new List <string>(); // List <string> L7 = new List <string>(); //dis List <string> L8 = new List <string>(); //pricef List <string> L9 = new List <string>(); //dat /* * * * */ DataTable tt = new DataTable(); accc.Show(tt); // Finall_Price = (Double)((Price * Discount) / 100) - Price; foreach (DataRow r in tt.Rows) { L1.Add(r.Field <string>("NAME")); L2.Add(r.Field <string>("BARCODE")); L3.Add(r.Field <string>("PRICE_A")); L4.Add(r.Field <string>("PRICE")); L5.Add(r.Field <string>("ID")); L6.Add(r.Field <string>("QUANTITY")); L7.Add(r.Field <string>("Dis")); L8.Add(r.Field <string>("Price_F")); } tt.Clear(); accc.show3(tt); foreach (DataRow r in tt.Rows) { L0.Add(r.Field <String>("NUMF")); } foreach (string asf in Filtring) { afo += double.Parse(asf); } PriceList.Add(afo.ToString()); Pricce.Text = "SAR " + afo.ToString(); var RepHelper = new ReportHelper(); var ILIST = new List <ReportHelper>(); ILIST.Add(new ReportHelper() { Getprice_ = Pricce.Text }); XtraReport3 report = new XtraReport3(); SQLiteConnectionParameters FF = new SQLiteConnectionParameters(); FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db"; ((SqlDataSource)report.DataSource).ConnectionParameters = FF; XtraReportPreviewModel model = new XtraReportPreviewModel(report); DocumentPreviewWindow windoww = new DocumentPreviewWindow() { Model = model }; report.CreateDocument(true); windoww.ShowDialog(); string id_3 = ""; //int finalprice = int.Parse(SumPricee.sumPrice().Replace("SAR", "").Replace(",", "")); //double Ristt = double.Parse(afo.ToString().Replace("SAR", "").Replace(",", "")); //double FInaal = finalprice + Ristt; for (int i = 0; i < L1.Count; i++) { if (L1[i] == Name.Text) { id_3 = L5[i]; } } List <int> sawf = new List <int>(); foreach (string d in L0) { sawf.Add(int.Parse(d)); } #region Convert Days to arabic language string dayoftheweek = ""; switch (DateTime.Now.DayOfWeek) { case DayOfWeek.Sunday: { dayoftheweek = ".الاحد"; break; } case DayOfWeek.Monday: { dayoftheweek = ".الاثنين"; break; } case DayOfWeek.Thursday: { dayoftheweek = ".الخميس"; break; } case DayOfWeek.Saturday: { dayoftheweek = ".السبت"; break; } case DayOfWeek.Friday: { dayoftheweek = "الجمعة."; break; } case DayOfWeek.Tuesday: { dayoftheweek = "الثلاثاء."; break; } case DayOfWeek.Wednesday: { dayoftheweek = "الاربعاء."; break; } } #endregion if (L0.Count == 0) { //null } else { numfa = sawf.Max() + 1; } if (sawf.Count == 0) { UmAlQuraCalendar um = new UmAlQuraCalendar(); String CurrentDate = (int.Parse(DateTime.Now.Year.ToString()) < 1600) ? DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() : um.GetYear(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetMonth(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetDayOfMonth(DateTime.Parse(DateTime.Now.ToString())).ToString(); for (int i = 0; i < L1.Count; i++) { double Price = 0; double Discount = 0; double Finall_Price = 0; string Result = ""; DateTime dtttt = new DateTime(); for (int ii = 0; ii < asdf.Count; ii++) { if (L1[i] == asdf[ii]) { accc.insert3(CurrentDate, L1[i], getwholeprice(i, L4, L7), L5[i], L6[i], L3[i], L2[i], numfa.ToString(), dayoftheweek, Pricce.Text); Price = (String.IsNullOrEmpty(L4[i].Replace("SAR", ""))) ? 0 : (Double)Double.Parse(double.Parse(L4[i].Replace("SAR", "")).ToString().Replace("SAR", "")); Discount = (String.IsNullOrEmpty(L7[i].Replace("%", ""))) ? 0 : (Double)Double.Parse(double.Parse(L7[i].Replace("%", "")).ToString().Replace("%", "")); Finall_Price = (Double)((Price * Discount) / 100) - Price; Finall_Price = Finall_Price * int.Parse(L6[i]); Result = "SAR " + Finall_Price.ToString("N2").Replace("-", ""); var mainwi = new MainWindow(L1[i], L4[i], L6[i], L2[i], L3[i], L5[i], L7[i], Result); mainwi.EDIT_MAX(); } /* * * L1.Add(r.Field<string>("NAME")); * L2.Add(r.Field<string>("BARCODE")); * L3.Add(r.Field<string>("PRICE_A")); * L4.Add(r.Field<string>("PRICE")); * L5.Add(r.Field<string>("ID")); * L6.Add(r.Field<string>("QUANTITY")); * L7.Add(r.Field<string>("Dis")); * L8.Add(r.Field<string>("Price_F")); */ } } if (GID.Count > 0) { for (int i = 0; i < GID.Count; i++) { FA.Delete(GID[i]); } } } else { #region Date UmAlQuraCalendar um = new UmAlQuraCalendar(); String CurrentDate = (int.Parse(DateTime.Now.Year.ToString()) < 1600) ? DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() : um.GetYear(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetMonth(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetDayOfMonth(DateTime.Parse(DateTime.Now.ToString())).ToString(); #endregion for (int i = 0; i < L1.Count; i++) { double Price = 0; double Discount = 0; double Finall_Price = 0; string Result = ""; DateTime dtttt = new DateTime(); for (int ii = 0; ii < asdf.Count; ii++) { if (L1[i] == asdf[ii]) { accc.insert3(CurrentDate, L1[i], getwholeprice(i, L4, L7), L5[i], L6[i], L3[i], L2[i], numfa.ToString(), dayoftheweek, Pricce.Text); Price = (String.IsNullOrEmpty(L4[i].Replace("SAR", ""))) ? 0 : (Double)Double.Parse(double.Parse(L4[i].Replace("SAR", "")).ToString().Replace("SAR", "")); Discount = (String.IsNullOrEmpty(L7[i].Replace("%", ""))) ? 0 : (Double)Double.Parse(double.Parse(L7[i].Replace("%", "")).ToString().Replace("%", "")); Finall_Price = (Double)((Price * Discount) / 100) - Price; Finall_Price = Finall_Price * int.Parse(L6[i]); Result = "SAR " + Finall_Price.ToString("N2").Replace("-", ""); var mainwi = new MainWindow(L1[i], L4[i], L6[i], L2[i], L3[i], L5[i], L7[i], Result); mainwi.EDIT_MAX(); } } } if (GID.Count > 0) { for (int i = 0; i < GID.Count; i++) { FA.Updating_QUa("0", GID[i].ToString()); } } } asdf.Clear(); for (int i = 0; i < PriceList.Count; i++) { Fa_delete._Delete(double.Parse(PriceList[i].Replace("SAR", "").Replace(",", ""))); } } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message + ":" + ex.HResult.ToString()); } DD.ItemsSource = ""; Observ.Clear(); NameList.Clear(); PriceList.Clear(); }
private async void PrivewDoucmentPrinter_Click(object sender, RoutedEventArgs e) { if (IS_SELECTED) { if (PrintHelper.Print.IsMounth_) { PrintHelper.Print.GET_STRATED(); var Dataopp = new Assest.OrcDataAcess(); XtraReport4 report = new XtraReport4(); SQLiteConnectionParameters FF = new SQLiteConnectionParameters(); FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db"; ((SqlDataSource)report.DataSource).ConnectionParameters = FF; XtraReportPreviewModel model = new XtraReportPreviewModel(report); DocumentPreviewWindow windoww = new DocumentPreviewWindow() { Model = model }; report.CreateDocument(true); windoww.ShowDialog(); Dataopp.Delete4(); } else if (PrintHelper.Print.IsYear_) { PrintHelper.Print.GET_STRATED(); var Dataopp = new Assest.OrcDataAcess(); XtraReport4 report = new XtraReport4(); SQLiteConnectionParameters FF = new SQLiteConnectionParameters(); FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db"; ((SqlDataSource)report.DataSource).ConnectionParameters = FF; XtraReportPreviewModel model = new XtraReportPreviewModel(report); DocumentPreviewWindow windoww = new DocumentPreviewWindow() { Model = model }; report.CreateDocument(true); windoww.ShowDialog(); Dataopp.Delete4(); } else if (PrintHelper.Print.IsDay_) { PrintHelper.Print.GET_STRATED(); var Dataopp = new Assest.OrcDataAcess(); XtraReport4 report = new XtraReport4(); SQLiteConnectionParameters FF = new SQLiteConnectionParameters(); FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db"; ((SqlDataSource)report.DataSource).ConnectionParameters = FF; XtraReportPreviewModel model = new XtraReportPreviewModel(report); DocumentPreviewWindow windoww = new DocumentPreviewWindow() { Model = model }; report.CreateDocument(true); windoww.ShowDialog(); Dataopp.Delete4(); } else if (!PrintHelper.Print.IsDay_ && !PrintHelper.Print.IsMounth_ && !PrintHelper.Print.IsYear_) { SYear(); PrintHelper.Print.GET_STRATED(); var Dataopp = new Assest.OrcDataAcess(); XtraReport4 report = new XtraReport4(); SQLiteConnectionParameters FF = new SQLiteConnectionParameters(); FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db"; ((SqlDataSource)report.DataSource).ConnectionParameters = FF; XtraReportPreviewModel model = new XtraReportPreviewModel(report); DocumentPreviewWindow windoww = new DocumentPreviewWindow() { Model = model }; report.CreateDocument(true); windoww.ShowDialog(); Dataopp.Delete4(); } } else if (!is_Repair_Selected) { XtraReport1 report = new XtraReport1(); SQLiteConnectionParameters FF = new SQLiteConnectionParameters(); FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db"; ((SqlDataSource)report.DataSource).ConnectionParameters = FF; XtraReportPreviewModel model = new XtraReportPreviewModel(report); DocumentPreviewWindow windoww = new DocumentPreviewWindow() { Model = model }; report.CreateDocument(true); windoww.ShowDialog(); } if (is_Repair_Selected) { if (Encode1.Text == "/d") { NewModel(type_of_date.day); PrintHelper.Print.IsMounth_ = false; PrintHelper.Print.IsDay_ = true; PrintHelper.Print.IsYear_ = false; Reports.XtraReport5 report = new Reports.XtraReport5(); SQLiteConnectionParameters FF = new SQLiteConnectionParameters(); FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db"; ((SqlDataSource)report.DataSource).ConnectionParameters = FF; XtraReportPreviewModel model = new XtraReportPreviewModel(report); DocumentPreviewWindow windoww = new DocumentPreviewWindow() { Model = model }; report.CreateDocument(true); windoww.ShowDialog(); mo.Delete1(); PrintHelper.Print.IsMounth_ = false; PrintHelper.Print.IsDay_ = false; PrintHelper.Print.IsYear_ = false; } else if (Encode1.Text == "/m") { NewModel(type_of_date.month); PrintHelper.Print.IsMounth_ = true; PrintHelper.Print.IsDay_ = false; PrintHelper.Print.IsYear_ = false; Reports.XtraReport5 report = new Reports.XtraReport5(); SQLiteConnectionParameters FF = new SQLiteConnectionParameters(); FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db"; ((SqlDataSource)report.DataSource).ConnectionParameters = FF; XtraReportPreviewModel model = new XtraReportPreviewModel(report); DocumentPreviewWindow windoww = new DocumentPreviewWindow() { Model = model }; report.CreateDocument(true); windoww.ShowDialog(); mo.Delete1(); PrintHelper.Print.IsMounth_ = false; PrintHelper.Print.IsDay_ = false; PrintHelper.Print.IsYear_ = false; } else if (Encode1.Text == "/y") { NewModel(type_of_date.year); PrintHelper.Print.IsMounth_ = false; PrintHelper.Print.IsDay_ = false; PrintHelper.Print.IsYear_ = true; Reports.XtraReport5 report = new Reports.XtraReport5(); SQLiteConnectionParameters FF = new SQLiteConnectionParameters(); FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db"; ((SqlDataSource)report.DataSource).ConnectionParameters = FF; XtraReportPreviewModel model = new XtraReportPreviewModel(report); DocumentPreviewWindow windoww = new DocumentPreviewWindow() { Model = model }; report.CreateDocument(true); windoww.ShowDialog(); mo.Delete1(); PrintHelper.Print.IsMounth_ = false; PrintHelper.Print.IsDay_ = false; PrintHelper.Print.IsYear_ = false; } else if (String.IsNullOrEmpty(Encode1.Text)) { NewModel(type_of_date.year); PrintHelper.Print.IsMounth_ = false; PrintHelper.Print.IsDay_ = false; PrintHelper.Print.IsYear_ = true; Reports.XtraReport5 report = new Reports.XtraReport5(); SQLiteConnectionParameters FF = new SQLiteConnectionParameters(); FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db"; ((SqlDataSource)report.DataSource).ConnectionParameters = FF; XtraReportPreviewModel model = new XtraReportPreviewModel(report); DocumentPreviewWindow windoww = new DocumentPreviewWindow() { Model = model }; report.CreateDocument(true); windoww.ShowDialog(); mo.Delete1(); PrintHelper.Print.IsMounth_ = false; PrintHelper.Print.IsDay_ = false; PrintHelper.Print.IsYear_ = false; } else { //later } } }