private void Form1_Load(object sender, EventArgs e) { dataGridView1.DoubleBuffered(true); frmStartup f = new frmStartup(); if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK) { rap = f._rap; Query(); } }
private void Form1_Load(object sender, EventArgs e) { dataGridView1.DoubleBuffered(true); frmStartup f = new frmStartup(); if (f.ShowDialog() == DialogResult.OK) { rap = f._rap; Query(); } }
private void Form1_Load(object sender, EventArgs e) { dataGridView1.DoubleBuffered(true); Form2 f = new Form2(); if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK) { rap = f._rap; Query(); } }
private void button1_Click(object sender, EventArgs e) { if (radioButton1.Checked) { var p = RaptorDB.RaptorDB.Open(txtFolder.Text); p.RegisterView(new SalesInvoiceView()); p.RegisterView(new SalesItemRowsView()); p.RegisterView(new newview()); _rap = p; } else { _rap = new RaptorDB.RaptorDBClient(txtServer.Text, int.Parse(txtPort.Text), txtUser.Text, txtPassword.Text); } }
public static List <object> Sum_Products_based_on_filter(IRaptorDB rap, string filter) { var q = rap.Query <SalesItemRowsViewRowSchema>(filter); var res = from x in q.Rows group x by x.Product into g select new sumtype // avoid anonymous types { Product = g.Key, TotalPrice = g.Sum(p => p.Price), TotalQTY = g.Sum(p => p.QTY) }; return(res.ToList <object>()); }
public static List<object> Sum_Products_based_on_filter(IRaptorDB rap, string filter) { var q = rap.Query<SalesItemRowsViewRowSchema>(filter); var res = from x in q.Rows group x by x.Product into g select new sumtype // avoid anonymous types { Product = g.Key, TotalPrice = g.Sum(p => p.Price), TotalQTY = g.Sum(p => p.QTY) }; return res.ToList<object>(); }
private void ProcessGET(IRaptorDB rdb, HttpListenerContext ctx, string path, RDBRoute route) { try { var result = DoQuery(rdb, ctx, path, route); var s = fastJSON.JSON.ToJSON(result, new fastJSON.JSONParameters { UseExtensions = false, UseFastGuid = false, EnableAnonymousTypes = true }); ctx.Response.ContentType = "application/json"; WriteResponse(ctx, 200, s); return; } catch (Exception ex) { WriteResponse(ctx, 500, "" + ex); } }
private void button1_Click(object sender, EventArgs e) { if (radioButton1.Checked) { var p = RaptorDB.RaptorDB.Open(txtFolder.Text); p.RegisterView(new SalesInvoiceView()); p.RegisterView(new SalesItemRowsView()); p.RegisterView(new newview()); p.RegisterView(new TestView()); _rap = p; } else { _rap = new RaptorDB.RaptorDBClient(txtServer.Text, int.Parse(txtPort.Text), txtUser.Text, txtPassword.Text); //fastBinaryJSON.BJSON.Parameters.v1_4TypedArray = true; } }
private Result <object> DoQuery(IRaptorDB rdb, HttpListenerContext ctx, string path, RDBRoute route) { string qry = ctx.Request.Url.GetComponents(UriComponents.Query, UriFormat.Unescaped); string viewname = path; if (route != null) { //if (route.EntityType != null) //{ // if (qry != "") // { // // fetch the json document // string[] s = qry.Split('='); // object obj = null; // if (_jsonstore.GetObject(Guid.Parse(s[1].Replace("\"", "")), out obj)) // { // RDBJsonContainer d = (RDBJsonContainer)obj; // WriteResponse(ctx, 200, d.json); // return; // } // } // WriteResponse(ctx, 404, "GUID not found :" + qry); // return; //} if (route.Viewname == null && route.function != null) { viewname = route.Viewname; var o = route.function(_rdb, qry); Result <object> resf = new Result <object>(true); resf.Rows = o; resf.TotalCount = o.Count; resf.Count = o.Count; resf.Title = route.Viewname; return(resf); } } // parse "start" and "count" from qry if exists int start = 0; int count = -1; string orderby = ""; var m = _start_regex.Match(qry); if (m.Success) { start = int.Parse(m.Groups["start"].Value); qry = qry.Replace(m.Value, ""); } m = _count_regex.Match(qry); if (m.Success) { count = int.Parse(m.Groups["count"].Value); qry = qry.Replace(m.Value, ""); } m = _order_regex.Match(qry); if (m.Success) { orderby = m.Groups["orderby"].Value; qry = qry.Replace(m.Value, ""); } var res = rdb.Query(viewname, qry, start, count, orderby); res.Title = viewname; return(res); }
public RaptorDbProvider(IRaptorDB rap) { this.rap = rap; }