public override String[] GetRolesForUser(String username) { if (String.IsNullOrEmpty(username)) { throw new ProviderException("User name cannot be empty or null."); } String[] roles; using (Session session = XpoHelper.GetNewSession()) { XPView xpvRoles = new XPView(session, typeof(XpoRole), new CriteriaOperatorCollection() { OperandProperty.Parse("RoleName") }, new GroupOperator( GroupOperatorType.And, new BinaryOperator("ApplicationName", ApplicationName, BinaryOperatorType.Equal), new ContainsOperator("Users", new BinaryOperator("UserName", username, BinaryOperatorType.Equal)))); List <String> rolesList = new List <String>(); for (int i = 0; i < xpvRoles.Count; i++) { rolesList.Add(xpvRoles[i][0].ToString()); } roles = rolesList.ToArray(); } return(roles); }
void GroupBuild(Action<IEnumerable<string>, bool> itemsCalculated) { if (_propertyEditor.View == null) return; var xpView = new XPView(((XPObjectSpace)_propertyEditor.View.ObjectSpace).Session, _propertyEditor.MemberInfo.GetOwnerInstance(_propertyEditor.CurrentObject).GetType()); xpView.AddProperty(_propertyEditor.PropertyName, _propertyEditor.PropertyName, true); itemsCalculated.Invoke(xpView.OfType<ViewRecord>().Select(record => record[0]).OfType<string>(), false); }
public override string[] GetAllRoles() { string[] roles; try { using (XtraUnitOfWork uow = new XtraUnitOfWork(DataLayer)) { XPView xpvRoles = new XPView(uow, typeof(XpoRole), new CriteriaOperatorCollection() { XpoRole.Fields.RoleName }, new BinaryOperator(XpoRole.Fields.ApplicationName, ApplicationName, BinaryOperatorType.Equal)); roles = Helper.GetRoleNameStrings(xpvRoles); } } catch (Exception ex) { if (WriteExceptionsToEventLog) { WriteToEventLog(ex, "GetAllRoles"); throw new ProviderException(exceptionMessage); } else { throw ex; } } return(roles); }
protected void ASPxComboBox_OnItemsRequestedByFilterCondition_SQL(object source, ListEditItemsRequestedByFilterConditionEventArgs e) { string search = e.Filter.ToLower();//.RemoveDiacritics(); if (String.IsNullOrEmpty(search)) { return; } //XPQuery<Solution4.Module.BusinessObjects.DomainObject1> security = new XPQuery<Solution4.Module.BusinessObjects.DomainObject1>(((XPObjectSpace)db).Session); //var q = from s in security // where s.Property2 == null // select new { s.PropertyName, s.Obj2.Prop1 }; //var lsit = q.ToList(); XPView clients = new XPView( ((XPObjectSpace)db).Session, this.CurrentObject.GetType(), "PropertyName", new FunctionOperator(FunctionOperatorType.Contains, new OperandProperty("PropertyName"), search) ); clients.Sorting.Add(new SortProperty("PropertyName", SortingDirection.Descending)); clients.SkipReturnedRecords = e.BeginIndex; clients.TopReturnedRecords = e.EndIndex; dropDownControl.Items.Clear(); foreach (ViewRecord item in clients) { dropDownControl.Items.Add(item["PropertyName"].ToString()); } }
static void Main() { ConnectionProviderSql provider = (ConnectionProviderSql)XpoDefault.GetConnectionProvider(SQLiteConnectionProvider.GetConnectionString(@"CustomCommand.sqlite"), AutoCreateOption.DatabaseAndSchema); provider.RegisterCustomFunctionOperator(new GetMonthFunction()); XPDictionary dict = new ReflectionDictionary(); dict.CustomFunctionOperators.Add(new GetMonthFunction()); XpoDefault.DataLayer = new SimpleDataLayer(dict, provider); CreateData(); using (Session session = new Session()) { XPView view = new XPView(session, typeof(Order)); view.AddProperty("Month", "custom('GetMonth', OrderDate)"); foreach (ViewRecord prop in view) { Console.WriteLine(prop["Month"]); } var list = from o in new XPQuery <Order>(session) where o.OrderName == "Chai" select new { Month = GetMonthFunction.GetMonth(o.OrderDate) }; foreach (var item in list) { Console.WriteLine(item.Month); } } Console.WriteLine("done\npress any key to exit .."); Console.ReadKey(); }
public void CalcularPolizaVigente() { CalcularVersionesVigentes(typeof(DocumentoItem), typeof(PolizaItem), "PolizaItem", "Documento", "ItemVigente"); CalcularVersionesVigentes(typeof(DocumentoInterviniente), typeof(PolizaInterviniente), "PolizaInterviniente", "Documento", "IntervinienteVigente"); CalcularVersionesVigentes(typeof(DocumentoIntervinienteItem), typeof(PolizaIntervinienteItem), "PolizaIntervinienteItem", "DocumentoItem.Documento", "IntervinienteItemVigente"); CalcularVersionesVigentes(typeof(DocumentoItemDetalle), typeof(PolizaItemDetalle), "PolizaItemDetalle", "DocumentoItem.Documento", "DetalleVigente"); CalcularVersionesVigentes(typeof(DocumentoPlan), typeof(PolizaPlan), "PolizaPlan", "Documento", "PlanVigente"); CalcularVersionesVigentes(typeof(DocumentoPlanDetalle), typeof(PolizaPlanDetalle), "PolizaPlanDetalle", "DocumentoPlan.Documento", "DetalleVigente"); //Calcular fecha var v = new XPView(Session, typeof(Documento)) { Criteria = CriteriaOperator.Parse("Poliza = ? AND NOT ISNULL(EmitidaFecha)", this) }; v.AddProperty("MaxVigenciaInicio", CriteriaOperator.Parse("MAX(VigenciaInicio)")); v.AddProperty("MaxVigenciaFin", CriteriaOperator.Parse("MAX(VigenciaFin)")); foreach (ViewRecord version in v) { if (version["MaxVigenciaInicio"] != null) { VigenciaInicio = (DateTime)version["MaxVigenciaInicio"]; } VigenciaFin = version["MaxVigenciaFin"] as DateTime?; } Save(); }
public override String[] GetUsersInRole(String roleName) { if (String.IsNullOrEmpty(roleName)) { throw new ProviderException("Role name cannot be empty or null."); } if (!RoleExists(roleName)) { throw new ProviderException("Role does not exist."); } string[] users; using (Session session = XpoHelper.GetNewSession()) { XPView xpvUsers = new XPView(session, typeof(XpoUser), new CriteriaOperatorCollection() { OperandProperty.Parse("UserName") }, new GroupOperator( GroupOperatorType.And, new BinaryOperator("ApplicationName", ApplicationName, BinaryOperatorType.Equal), new ContainsOperator("Roles", new BinaryOperator("RoleName", roleName, BinaryOperatorType.Equal)))); List <String> usersList = new List <String>(); for (int i = 0; i < xpvUsers.Count; i++) { usersList.Add(xpvUsers[i][0].ToString()); } users = usersList.ToArray(); } return(users); }
private void CalcularVersionesVigentes(Type tipoObjMovimiento, Type tipoObjActual, string propName, string rutaDocumento, string propVigente) { var historial = new Dictionary <int, int>(); var v = new XPView(Session, tipoObjMovimiento) { Criteria = CriteriaOperator.Parse($"{rutaDocumento}.Poliza = ? AND NOT ISNULL({propName})", this) }; v.AddProperty(propName, propName, false, true, SortDirection.Ascending); v.AddProperty("EmitidaFecha", $"{rutaDocumento}.EmitidaFecha", false, true, SortDirection.Ascending); v.AddProperty("NumeroSolicitud", $"{rutaDocumento}.NumeroSolicitud", false, true, SortDirection.Ascending); v.AddProperty("Oid", "Oid", false, true, SortDirection.None); foreach (ViewRecord version in v) { var pi = (int)version[0]; if (!historial.ContainsKey(pi)) { historial[pi] = -1; } historial[pi] = (int)version[3]; } foreach (var elemento in historial) { var pi = (BasicObject)Session.GetObjectByKey(tipoObjActual, elemento.Key); pi.SetMemberValue(propVigente, Session.GetObjectByKey(tipoObjMovimiento, elemento.Value)); } }
public static XPView GetLpnStatusrReportView(bool onlyAssigned) { XPView lpnStatusReportView = new XPView(Session.DefaultSession, typeof(Inventory)); try { if (onlyAssigned) { lpnStatusReportView.GroupCriteria = CriteriaOperator.And(new InOperator(Inventory.Fields.InventoryItemID.ItemCustomerID.PropertyName, UsersCustomerBLL.GetAssignedCustomerIDs(XpoDefault.Session)), new BinaryOperator(Inventory.Fields.InventoryDate.PropertyName, DateTime.Parse("Aug/4/2013"), BinaryOperatorType.GreaterOrEqual), CriteriaOperator.Parse("[FullLPNNumber] Is Not NULL")); } else { lpnStatusReportView.GroupCriteria = CriteriaOperator.And(new BinaryOperator(Inventory.Fields.InventoryDate.PropertyName, DateTime.Parse("Aug/4/2013"), BinaryOperatorType.GreaterOrEqual), CriteriaOperator.Parse("[FullLPNNumber] Is Not NULL")); } lpnStatusReportView.Properties.AddRange(new ViewProperty[] { new ViewProperty("Full LPN Number", SortDirection.Ascending, Inventory.Fields.FullLPNNumber, true, true), new ViewProperty("Item #", SortDirection.Ascending, Inventory.Fields.InventoryItemID.ItemCode, true, true), new ViewProperty("Quantity", SortDirection.None, "Sum([InventoryQuantity])", false, true), new ViewProperty("Production Date", SortDirection.Ascending, Inventory.Fields.InventoryDate, true, true), new ViewProperty("Shipping Date", SortDirection.Ascending, Inventory.Fields.Shipment.ShipMainDate, true, true), new ViewProperty("BOL #", SortDirection.Ascending, Inventory.Fields.Shipment.ShipMainBOL, true, true), new ViewProperty("Customer Name", SortDirection.None, Inventory.Fields.InventoryItemID.ItemCustomerID.CustomerName, true, true), new ViewProperty("ShippingID", SortDirection.None, Inventory.Fields.Shipment.ShipMainID, true, true) }); return(lpnStatusReportView); } catch (ArgumentException ex) { MessageBox.Show(string.Format("There was an error while trying to retrieve the data for the report.{0}{1}", Environment.NewLine, ex.Message)); } return(null); }
void GroupBuild(Action <IEnumerable <string>, bool> itemsCalculated) { var xpView = new XPView(((XPObjectSpace)_propertyEditor.View.ObjectSpace).Session, _propertyEditor.MemberInfo.GetOwnerInstance(_propertyEditor.CurrentObject).GetType()); xpView.AddProperty(_propertyEditor.PropertyName, _propertyEditor.PropertyName, true); itemsCalculated.Invoke(xpView.OfType <ViewRecord>().Select(record => record[0]).OfType <string>(), false); }
public override String[] FindUsersInRole(String roleName, String userNameToMatch) { String[] users; if (!RoleExists(roleName)) { throw new ProviderException("Role does not exist."); } using (Session session = XpoHelper.GetNewSession()) { CriteriaOperator theCriteria = CriteriaOperator.Parse("ApplicationName = ? and contains(UserName, ?) and Roles[RoleName = ?]", ApplicationName, userNameToMatch, roleName); XPView xpvUsers = new XPView(session, typeof(XpoUser), new CriteriaOperatorCollection() { OperandProperty.Parse("UserName") }, theCriteria); List <String> usersList = new List <String>(); for (int i = 0; i < xpvUsers.Count; i++) { usersList.Add(xpvUsers[i][0].ToString()); } users = usersList.ToArray(); } return(users); }
static bool valida_fechahora_sesion(DateTime ld_fecha, Fundraising_PTDM.FUNDRAISING_PT.Cajas lo_caja) { bool pass_fechahora = true; int total_minutes_new = (ld_fecha.Hour * 60) + ld_fecha.Minute; int time_new_sesion = Fundraising_PT.Properties.Settings.Default.time_new_sesion; XPView vhora_sesion = new XPView(XpoDefault.Session, typeof(Fundraising_PTDM.FUNDRAISING_PT.Sesiones)); vhora_sesion.AddProperty("fecha_hora", "fecha_hora", false, true, DevExpress.Xpo.SortDirection.Descending); vhora_sesion.Criteria = CriteriaOperator.Parse(string.Format("GetDay(fecha_hora) = {0} and GetMonth(fecha_hora) = {1} and GetYear(fecha_hora) = {2} and caja.oid = '{3}'", ld_fecha.Day, ld_fecha.Month, ld_fecha.Year, lo_caja.oid)); // if (vhora_sesion.Count > 0) { int time_diff = 0; int total_minutes_exis = 0; foreach (ViewRecord items in vhora_sesion) { DateTime fecha_hora = (DateTime)items["fecha_hora"]; total_minutes_exis = (fecha_hora.Hour * 60) + fecha_hora.Minute; time_diff = total_minutes_new - total_minutes_exis; if (time_diff < time_new_sesion) { pass_fechahora = false; break; } } } // vhora_sesion.Dispose(); // return(pass_fechahora); }
public Dictionary <int, decimal> CalcularSaldoPago(XPView saldosAplicaciones, XPView saldoValores) { var saldo = new Dictionary <int, decimal>( ); foreach (ViewRecord row in saldosAplicaciones) { var moneda = (( int )row["Moneda"]); if (!saldo.ContainsKey(moneda)) { saldo[moneda] = 0; } saldo[moneda] += ( decimal )row["Importe"]; } foreach (ViewRecord row in saldoValores) { var moneda = (( int )row["Moneda"]); if (!saldo.ContainsKey(moneda)) { saldo[moneda] = 0; } saldo[moneda] -= ( decimal )row["Importe"]; } return(saldo); }
private object GetCustomerTypes() { XPView view = new XPView(XpoSession, typeof(AdventureWorks.Customer)); view.AddProperty("CustomerType", "CustomerType", true); return(view); }
public Form1() { InitializeComponent(); //Register Custom Aggregates STDEVPCustomAggregate.Register(); CountDistinctCustomAggregate.Register(); //Load data with XPView XPView xpView = new XPView(session1, typeof(Customer)); xpView.AddProperty("ContactName", CriteriaOperator.Parse("[FirstName] + ' ' + [LastName]")); xpView.AddProperty("DistinctProducts", CriteriaOperator.Parse("[Orders][].CountDistinct([ProductName])")); xpView.AddProperty("QuantityVariance", CriteriaOperator.Parse("[Orders][].STDEVP([Quantity])")); xpView.AddProperty("PriceVariance", CriteriaOperator.Parse("[Orders][].STDEVP([Price])")); xpView.Sorting.Add(new SortProperty("ContactName", DevExpress.Xpo.DB.SortingDirection.Ascending)); gridControl1.DataSource = xpView; //Load data using XPQuery gridControl2.DataSource = new XPQuery <Customer>(session1) .Select(t => new { ContactName = t.ContactName, DistinctProducts = (int)CountDistinctCustomAggregate.CountDistinct(t.Orders, o => o.ProductName), QuantityVariance = (double?)STDEVPCustomAggregate.STDEVP(t.Orders, o => o.Quantity), PriceVariance = (double?)STDEVPCustomAggregate.STDEVP(t.Orders, o => o.Price), }) .OrderBy(t => t.ContactName) .ToList(); }
public static XPView GetProductionBillingReportView(bool onlyAssigned) { XPView productionBillingReportXPView = new XPView(Session.DefaultSession, typeof(Inventory)); try { if (onlyAssigned) { productionBillingReportXPView.Criteria = new InOperator(Inventory.Fields.InventoryItemID.ItemCustomerID.PropertyName, UsersCustomerBLL.GetAssignedCustomerIDs(XpoDefault.Session)); } productionBillingReportXPView.Properties.AddRange(new ViewProperty[] { new ViewProperty("Production Date", SortDirection.Ascending, Inventory.Fields.InventoryDate, true, true), new ViewProperty("Customer Name", SortDirection.Ascending, Inventory.Fields.InventoryItemID.ItemCustomerID.CustomerName, true, true), new ViewProperty("Item #", SortDirection.Ascending, Inventory.Fields.InventoryItemID.ItemCode, true, true), new ViewProperty("Item Description", SortDirection.None, Inventory.Fields.InventoryItemID.ItemDescription, true, true), new ViewProperty("Item Type", SortDirection.None, CriteriaOperator.Parse(string.Format("IIF({0} = 'RM', 'Raw Material', IIF({0} = 'IG', 'Intermediate Goods', 'Finished Goods'))", Inventory.Fields.InventoryItemID.ItemType.PropertyName)), true, true), new ViewProperty("Shift", SortDirection.Ascending, Inventory.Fields.Shift.ShiftName, true, true), new ViewProperty("PO #", SortDirection.Ascending, Inventory.Fields.PO, true, true), new ViewProperty("UOM", SortDirection.Ascending, Inventory.Fields.InventoryItemID.strUnitOfMeasure, true, true), new ViewProperty("Quantity", SortDirection.None, CriteriaOperator.Parse(string.Format("Sum({0})", Inventory.Fields.InventoryQuantity.PropertyName)), false, true), new ViewProperty("Cases", SortDirection.Ascending, CriteriaOperator.Parse(string.Format("Sum({0}/{1})", Inventory.Fields.InventoryQuantity.PropertyName, Inventory.Fields.InventoryItemID.intUnitsPerCase.PropertyName)), false, true), new ViewProperty("Price", SortDirection.Ascending, CriteriaOperator.Parse(string.Format("Sum({0}*{1})", Inventory.Fields.InventoryQuantity.PropertyName, Inventory.Fields.InventoryItemID.dblPrice.PropertyName)), false, true) }); return(productionBillingReportXPView); } catch (ArgumentException ex) { MessageBox.Show(string.Format("There was an error while trying to retrieve the data for the report.{0}{1}", Environment.NewLine, ex.Message)); } return(null); }
private void LoadViaXPView(object sender, EventArgs e) { XPView xpView1 = new XPView(XpoDefault.Session, typeof(Northwind.Order)); xpView1.Properties.Add(new DevExpress.Xpo.ViewProperty("Company Name", DevExpress.Xpo.SortDirection.None, "[Customer.CompanyName]", true, true)); gridControl1.DataSource = xpView1; RefreshColumns(); }
void GroupBuild(Action <IEnumerable <string>, bool> itemsCalculated) { var xpView = new XPView(((XPObjectSpace)((IObjectSpaceHolder)_propertyEditor).ObjectSpace).Session, _propertyEditor.ObjectTypeInfo.Type); var columnSortOrder = ((IModelMemberViewItemSortOrder)_propertyEditor.Model).SortingDirection; xpView.Sorting = new SortingCollection(new SortProperty(_propertyEditor.PropertyName, columnSortOrder)); xpView.AddProperty(_propertyEditor.PropertyName, _propertyEditor.PropertyName, true); itemsCalculated.Invoke(xpView.OfType <ViewRecord>().Select(record => record[0]).OfType <string>(), false); }
public ActionResult Index() { XPView customers = new XPView(new Session(), typeof(Customer)); customers.AddProperty("Name"); customers.AddProperty("CompanyName"); return(View(customers)); }
public override void guardar(object sender, EventArgs e) { int ln_tipo = 0; if (int.TryParse(lookUp_tipo.gridLookUpEdit1.EditValue.ToString().Trim(), out ln_tipo)) { decimal ln_valor = decimal.Zero; if (decimal.TryParse(textBox_valor.textEdit1.EditValue.ToString().Trim(), out ln_valor)) { try { //NumberFormatInfo nfi = new NumberFormatInfo(); //nfi.NumberGroupSeparator = ","; //nfi.NumberDecimalSeparator = "."; //ln_valor = decimal.Parse(ln_valor.ToString(nfi)); XPView valida_moneda = new XPView(XpoDefault.Session, typeof(Fundraising_PTDM.FUNDRAISING_PT.Denominacion_Monedas)); valida_moneda.AddProperty("oid", "oid", false, true, DevExpress.Xpo.SortDirection.None); valida_moneda.AddProperty("codigo", "codigo", false, true, DevExpress.Xpo.SortDirection.None); valida_moneda.AddProperty("tipo", "tipo", false, true, DevExpress.Xpo.SortDirection.None); valida_moneda.AddProperty("valor", "valor", false, true, DevExpress.Xpo.SortDirection.None); valida_moneda.AddProperty("status", "status", false, true, DevExpress.Xpo.SortDirection.None); valida_moneda.Criteria = CriteriaOperator.Parse(string.Format("oid != '{0}' and tipo = {1} and valor = {2} and status = 1", ((Fundraising_PTDM.FUNDRAISING_PT.Denominacion_Monedas)bindingSource1.Current).oid, ln_tipo, ln_valor)); // if (valida_moneda != null & valida_moneda.Count > 0) { MessageBox.Show("Ya existe un registro con este Tipo y Denominación, favor cambiar los datos e intentar de nuevo...", "Guardar"); } else { ((Fundraising_PTDM.FUNDRAISING_PT.Denominacion_Monedas)this_primary_object_persistent_current).sucursal = 0; //Fundraising_PT.Properties.Settings.Default.sucursal; if (lAccion == "Insertar") { ((Fundraising_PTDM.FUNDRAISING_PT.Denominacion_Monedas)this_primary_object_persistent_current).status = 1; } base.guardar(sender, e); } } catch (Exception oerror) { MessageBox.Show("Ocurrio un ERROR validando que no existan denominaciones de monedas repetidas..." + "\n" + "Error: " + oerror.Message, "Guardar", MessageBoxButtons.OK, MessageBoxIcon.Error); base.cancelar(sender, e); } } else { MessageBox.Show("Ocurrio un ERROR evaluando el valor de la denominación de la moneda...", "Guardar", MessageBoxButtons.OK, MessageBoxIcon.Error); base.cancelar(sender, e); } } else { MessageBox.Show("Ocurrio un ERROR evaluando el tipo de la denominación de la moneda...", "Guardar", MessageBoxButtons.OK, MessageBoxIcon.Error); base.cancelar(sender, e); } }
internal static string[] GetUserNameStrings(XPView xpvUsers) { List <string> usersList = new List <string>(); for (int i = 0; i < xpvUsers.Count; i++) { usersList.Add(xpvUsers[i][0].ToString()); } return(usersList.ToArray()); }
protected override object CreateCollection() { var xpv = new XPView(((XPObjectSpace)ObjectSpace).Session, _objectType) { Criteria = _fixedCriteria }; xpv.Properties.AddRange(_properties.ToArray()); return(xpv); }
public XPView CalcularSaldosAplicaciones( ) { var subtotalesAplic = new XPView(Session, typeof(PagoAplicacion)); subtotalesAplic.AddProperty("Importe", CriteriaOperator.Parse("SUM(Importe)")); subtotalesAplic.AddProperty("Moneda", "Moneda", true); subtotalesAplic.Criteria = CriteriaOperator.Parse("Pago = ?", Oid); return(subtotalesAplic); }
internal static string[] GetRoleNameStrings(XPView xpvRoles) { List <string> rolesList = new List <string>(); for (int i = 0; i < xpvRoles.Count; i++) { rolesList.Add(xpvRoles[i][0].ToString()); } return(rolesList.ToArray()); }
public RandevuAl() { InitializeComponent(); dtpRandevuTarih.Anchor = AnchorStyles.Top | AnchorStyles.Right; XPView xPView = new XPView(XpoDefault.Session, typeof(Doktor)); xPView.AddProperty("Concat([Ad],' ' ,[Soyad])"); xPView.AddProperty(""); xPView.AddProperty("RandevuAdet", new AggregateOperand("Randevular", "RandevuTarih", Aggregate.Max)); }
public XPView GetXpView(string fields) { var xpView = new XPView(Session, ObjectClassInfo, GetOperatorCollection(fields, new DataTable()), Criteria) { TopReturnedRecords = TopReturnedObjects, Sorting = Sorting }; return(xpView); }
public XPView CalcularSaldosValores( ) { var subtotalesVal = new XPView(Session, typeof(Fondos.ComprobanteItem)); subtotalesVal.AddProperty("Importe", CriteriaOperator.Parse("SUM(Importe * DebeHaber)")); subtotalesVal.AddProperty("Moneda", "Especie.Moneda", true); subtotalesVal.Criteria = CriteriaOperator.Parse("Autogenerado = FALSE AND Comprobante = ?", Oid); //recordar que yo (Pago) también es un Comprobante de fondos return(subtotalesVal); }
public InterlinearEditorForm(Verse verse) { InitializeComponent(); this.Text = "Interlinear Bible Editor"; Uow = new UnitOfWork(); Translation = verse.ParentTranslation;// new XPQuery<Translation>(Uow).Where(x => x.Name == verse.ParentTranslation.Name).FirstOrDefault(); NAME = Translation.Name; var view = new XPView(Uow, typeof(BookBase)); view.CriteriaString = $"[Status.BookType] = {(int)Translation.BookType}"; view.Properties.Add(new ViewProperty("NumberOfBook", SortDirection.None, "[NumberOfBook]", false, true)); view.Properties.Add(new ViewProperty("BookTitle", SortDirection.None, "[BookTitle]", false, true)); var list = new List <BookBaseInfo>(); foreach (ViewRecord item in view) { list.Add(new BookBaseInfo() { NumberOfBook = item["NumberOfBook"].ToInt(), BookTitle = item["BookTitle"].ToString() }); } var index = verse.GetVerseIndex(); btnOblubienicaEu.Visibility = index.NumberOfBook >= 470 ? DevExpress.XtraBars.BarItemVisibility.Always : DevExpress.XtraBars.BarItemVisibility.Never; btnLogosSeptuagint.Visibility = index.NumberOfBook < 470 ? DevExpress.XtraBars.BarItemVisibility.Always : DevExpress.XtraBars.BarItemVisibility.Never; editBook.DataSource = list; VerseControl = new VerseEditorControl() { Dock = DockStyle.Fill }; this.Controls.Add(VerseControl); this.Load += new EventHandler(delegate(object sender, EventArgs e) { Application.DoEvents(); var bookInfo = list.Where(x => x.NumberOfBook == index.NumberOfBook).FirstOrDefault(); txtBook.EditValue = bookInfo; editBook_EditValueChanged(this, new DevExpress.XtraEditors.Controls.ChangingEventArgs(null, bookInfo)); Application.DoEvents(); txtChapter.EditValue = index.NumberOfChapter; editChapter_EditValueChanged(this, new DevExpress.XtraEditors.Controls.ChangingEventArgs(null, index.NumberOfChapter)); Application.DoEvents(); txtVerse.EditValue = index.NumberOfVerse; editVerse_EditValueChanged(this, new DevExpress.XtraEditors.Controls.ChangingEventArgs(null, index.NumberOfVerse)); Application.DoEvents(); }); TransliterationController = new GreekTransliterationController(); }
private void CreateXpoView_Execute(object sender, SimpleActionExecuteEventArgs e) { Session session = (this.Application.CreateObjectSpace() as XPObjectSpace).Session; XPView ProductXpView = new XPView(session, typeof(Product)); ProductXpView.Properties.AddRange(new ViewProperty[] { new ViewProperty("Product Name", SortDirection.None, "[Name]", true, true) }); foreach (ViewRecord viewRecord in ProductXpView) { Console.WriteLine(viewRecord["Product Name"]); } }
public string GetDataView(string className, ViewProperty[] properties, string filter) { using (Session session = new Session()) { XPClassInfo classInfo = session.GetClassInfo(typeof(Category).Assembly.FullName, string.Concat(typeof(Category).Namespace, ".", className)); XPView result = new XPView(session, classInfo, new CriteriaOperatorCollection(), CriteriaOperator.Parse(filter)); result.Properties.AddRange(properties); return(new PersistentObjectToXmlConverter().ConvertViewToXml(result)); } }
public IActionResult Index() { var view = new XPView(new UnitOfWork(), typeof(Song)); view.Properties.Add(new ViewProperty("Id", SortDirection.None, "[Oid]", false, true)); view.Properties.Add(new ViewProperty("Name", SortDirection.None, "[Name]", false, true)); view.Properties.Add(new ViewProperty("Signature", SortDirection.None, "[Signature]", false, true)); view.Properties.Add(new ViewProperty("BPM", SortDirection.None, "[BPM]", false, true)); view.Properties.Add(new ViewProperty("Number", SortDirection.Ascending, "[Number]", false, true)); view.Properties.Add(new ViewProperty("Type", SortDirection.None, "[Type]", false, true)); return(View(view)); }
private void frmSST24OA_Load(object sender, EventArgs e) { // Set Code Box... fastColoredTextBox1.Language = Language.VB; // Load Card Details obj = Session.DefaultSession.FindObject<Cards>(CriteriaOperator.Parse("[CardSerialNumber] == ? AND [CardModel] == ? AND [CardRevision] == ?", _CardSerialNumber, _CardModel, _CardRevision)); Text = obj.CardName; //lblCardDescription.Text = obj.CardDescription; // Card Details LogEvent("Card Model Number: " + _CardModel, "X001", clsEventLogType.EventLogType.Info); LogEvent("Card Revision: " + _CardRevision, "X002", clsEventLogType.EventLogType.Info); LogEvent("Card Serial Number: " + _CardSerialNumber, "X003", clsEventLogType.EventLogType.Info); // Check to see if the card details exist in the database XPView CardDetails = new XPView(Session.DefaultSession, typeof(Database.AnalogOutputConfiguration)); CardDetails.AddProperty("Serial", "CardSerial"); CardDetails.Criteria = CriteriaOperator.Parse(String.Format("[CardRevision] = '{0}' And [CardModel] = '{1}' And [CardSerial] == {2}", _CardRevision, _CardModel, _CardSerialNumber), null); bool CardAdded; if (CardDetails.Count > 0) CardAdded = true; else CardAdded = false; if (!CardAdded) { for (int i = 1; i <= 24; i++) { Database.AnalogOutputConfiguration dbConfiguration = new Database.AnalogOutputConfiguration(); dbConfiguration.Output = i; dbConfiguration.OutputName = "Output #" + i; dbConfiguration.OutputStatus = false; dbConfiguration.CardSerial = _CardSerialNumber; dbConfiguration.CardRevision = _CardRevision; dbConfiguration.CardModel = _CardModel; dbConfiguration.Save(); } } // Initilize Datatable _dtOutputs = new DataTable(); _dtOutputs.Columns.Add("output", typeof(int)); _dtOutputs.Columns.Add("value", typeof(bool)); DataRow row; for (int i = 1; i <= 24; i++) { row = _dtOutputs.NewRow(); row["output"] = i; row["value"] = false; _dtOutputs.Rows.Add(row); } _dtOffsets = new DataTable(); _dtOffsets.Columns.Add("offset", typeof(string)); _dtOffsets.Columns.Add("bytes", typeof(int)); _dtOffsets.Columns.Add("bit", typeof(int)); _dtOffsets.Columns.Add("value", typeof(int)); SetupScriptDatatable(); xpCollectionCardInfo.Criteria = CriteriaOperator.Parse(String.Format("[CardModel] = '{0}' And [CardRevision] = '{1}' And [CardSerialNumber] = {2}", _CardModel, _CardRevision, _CardSerialNumber), null); xpCollectionConfiguration.Criteria = CriteriaOperator.Parse(String.Format("[CardRevision] = '{0}' And [CardModel] = '{1}' And [CardSerial] = {2}", _CardRevision, _CardModel, _CardSerialNumber), null); // Setup Group Control Boxes gcCardConfiguration.Dock = DockStyle.Fill; gcCardSettings.Dock = DockStyle.Fill; gcDebugLog.Dock = DockStyle.Fill; gcScripts.Dock = DockStyle.Fill; // Hide Group Control Boxes gcCardConfiguration.Visible = false; gcDebugLog.Visible = false; gcScripts.Visible = false; // Set Form Details objCardsDB = Session.DefaultSession.FindObject<Cards>(CriteriaOperator.Parse("[CardSerialNumber] == ? AND [CardModel] == ? AND [CardRevision] == ?", _CardSerialNumber, _CardModel, _CardRevision)); DataBindings.Add("Text", objCardsDB, "CardName"); //lblCardDescription.DataBindings.Add("Text", objCardsDB, "CardDescription"); chkUSBConnected.DataBindings.Add("Text", objCardsDB, "CardConnected"); xpCollectionConfiguration.Load(); gridControl1.DataSource = xpCollectionConfiguration; gridControl1.ForceInitialize(); SetupScriptDropDown(); // Enable Timers //tmrInputConfigRefresh.Enabled = true; tmrCheckUSB.Enabled = true; tmrCheckFormDetails.Enabled = true; }
private void bbtnRegisterSoftware_ItemClick(object sender, ItemClickEventArgs e) { frmRegistrationDetails frm = new frmRegistrationDetails(); frm.ShowDialog(); // Load Registration Details XPView view = new XPView(Session.DefaultSession, typeof(Database.Registration)); view.AddProperty("Name", "Name"); view.AddProperty("Company", "Company"); bool registered = false; foreach (ViewRecord record in view) { lblRegisteredName.Caption = "Registered To: " + (string)record["Name"]; registered = true; } if (!registered) lblRegisteredName.Caption = "Registered To: Unregistered"; }
private void frmMain_Load(object sender, EventArgs e) { richEditControl1.LoadDocument("About Smart Sim Tech.rtf"); Version vrs = new Version(Application.ProductVersion); _AppVersion = String.Format("{0}.{1}.{2}", vrs.Major, vrs.Minor, vrs.Build); try { WebClient getrtf = new WebClient(); richEditControl2.RtfText = getrtf.DownloadString(_BaseURL + _BaseFile + _AppVersion + _ExtInfo); } catch (Exception) { // No Internet Connection richEditControl2.Text = "Release notes file not found..."; } // Load USB Device List DataTable _usbDeviceList = new DataTable(); _usbDeviceList.Columns.Add("usbGUID", typeof(string)); _usbDeviceList.Columns.Add("GUID", typeof(string)); _usbDeviceList.Columns.Add("cardtype", typeof(string)); _usbDeviceList.Columns.Add("serial", typeof(int)); _usbDeviceList.Columns.Add("deviceid", typeof(int)); _usbDeviceList.Columns.Add("connected", typeof(bool)); tmrEnumerateUSB.Enabled = true; tmrCheckFSUIPC.Enabled = true; // Set Application Version lblAppVersion.Caption = String.Format("Version: {0}", _AppVersion); // Load Start Page frmStartPage frm = new frmStartPage(); frm.MdiParent = this; frm.ParentFrm = this; frm.Show(); // Load Registration Details XPView view = new XPView(Session.DefaultSession, typeof(Database.Registration)); view.AddProperty("Name", "Name"); view.AddProperty("Company", "Company"); bool registered = false; foreach (ViewRecord record in view) { lblRegisteredName.Caption = "Registered To: " + (string)record["Name"]; registered = true; } if (!registered) lblRegisteredName.Caption = "Registered To: Unregistered"; // Load Child Forms LoadChildrenForms(); // Set Start Page as Default Page foreach (Form mdi in MdiChildren) { if (mdi is frmStartPage) { mdi.Activate(); } } // Set Notification Icon notifyIcon1.Icon = Icon; // Set CardConnected = false to all records in the cards database XPCollection cardsdb = new XPCollection(typeof(Database.Cards)); foreach (Database.Cards record in cardsdb) { record.CardConnected = false; record.Save(); } loaded = true; // Show Window Show(); Refresh(); _LaunchProcess.ApplicationLoading(); tmrCloseSplash.Enabled = true; }
private void LoadChildrenForms() { XPView cards = new XPView(Session.DefaultSession, typeof(Database.Cards)); cards.AddProperty("Model", "CardModel"); cards.AddProperty("Rev", "CardRevision"); cards.AddProperty("Serial", "CardSerialNumber"); foreach (ViewRecord record in cards) { LoadForm((string)record["Model"], (string)record["Rev"], record["Serial"].ToString()); } }
public XPView GetXpView(string fields) { var xpView = new XPView(Session, ObjectClassInfo, GetOperatorCollection(fields, new DataTable()), Criteria) { TopReturnedRecords = TopReturnedObjects, Sorting = Sorting }; return xpView; }
private void frmSST30IA_Load(object sender, EventArgs e) { // Set Code Box... fastColoredTextBox1.Language = Language.VB; // Load Card Details obj = Session.DefaultSession.FindObject<Cards>(CriteriaOperator.Parse("[CardSerialNumber] == ? AND [CardModel] == ? AND [CardRevision] == ?", _CardSerialNumber, _CardModel, _CardRevision)); Text = obj.CardName; // Card Details LogEvent("Card Model Number: " + _CardModel, "X001", clsEventLogType.EventLogType.Info); LogEvent("Card Revision: " + _CardRevision, "X002", clsEventLogType.EventLogType.Info); LogEvent("Card Serial Number: " + _CardSerialNumber, "X003", clsEventLogType.EventLogType.Info); // Check to see if the card details exist in the database XPView CardDetails = new XPView(Session.DefaultSession, typeof(Database.AnalogInputConfiguration)); CardDetails.AddProperty("Serial", "CardSerial"); CardDetails.Criteria = CriteriaOperator.Parse(String.Format("[CardRevision] = '{0}' And [CardModel] = '{1}' And [CardSerial] == {2}", _CardRevision, _CardModel, _CardSerialNumber), null); bool CardAdded; if (CardDetails.Count > 0) CardAdded = true; else CardAdded = false; if (!CardAdded) { for (int i = 1; i <= 30; i++) { Database.AnalogInputConfiguration dbConfiguration = new Database.AnalogInputConfiguration(); dbConfiguration.Input = i; dbConfiguration.InputName = "Input #" + i; dbConfiguration.InputStatus = false; dbConfiguration.CodeButtonUp = ""; dbConfiguration.CodeButtonDown = ""; dbConfiguration.CardSerial = _CardSerialNumber; dbConfiguration.CardRevision = _CardRevision; dbConfiguration.CardModel = _CardModel; dbConfiguration.Save(); } } xpCollectionCardInfo.Criteria = CriteriaOperator.Parse(String.Format("[CardModel] = '{0}' And [CardRevision] = '{1}' And [CardSerialNumber] = {2}", _CardModel, _CardRevision, _CardSerialNumber), null); xpCollectionConfiguration.Criteria = CriteriaOperator.Parse(String.Format("[CardRevision] = '{0}' And [CardModel] = '{1}' And [CardSerial] = {2}", _CardRevision, _CardModel, _CardSerialNumber), null); // Setup Code Dropdown SetupFunctionDropdown(); // Setup Group Control Boxes gcCardConfiguration.Dock = DockStyle.Fill; gcCardSettings.Dock = DockStyle.Fill; gcDebugLog.Dock = DockStyle.Fill; gcInputScripts.Dock = DockStyle.Fill; // Hide Group Control Boxes gcCardConfiguration.Visible = false; gcDebugLog.Visible = false; gcInputScripts.Visible = false; // Enable Timers tmrInputConfigRefresh.Enabled = true; tmrCheckUSB.Enabled = true; tmrCheckFormDetails.Enabled = true; // Set Form Details objCardsDB = Session.DefaultSession.FindObject<Cards>(CriteriaOperator.Parse("[CardSerialNumber] == ? AND [CardModel] == ? AND [CardRevision] == ?", _CardSerialNumber, _CardModel, _CardRevision)); DataBindings.Add("Text", objCardsDB, "CardName"); chkUSBConnected.DataBindings.Add("Text", objCardsDB, "CardConnected"); }
private void frmMain_Load(object sender, EventArgs e) { // Set template UserLookAndFeel.Default.SetSkinStyle("Sharp Plus"); // Set Application Version Version vrs = new Version(Application.ProductVersion); lblAppVersion.Caption = String.Format("Version: {0}.{1}.{2}", vrs.Major, vrs.Minor, vrs.Build); // Load Start Page frmStartPage frm = new frmStartPage(); frm.MdiParent = this; frm.ParentFrm = this; frm.Show(); // Load Registration Details XPView view = new XPView(Session.DefaultSession, typeof(Database.Registration)); view.AddProperty("Name", "Name"); view.AddProperty("Company", "Company"); bool registered = false; foreach (ViewRecord record in view) { lblRegisteredName.Caption = "Registered To: " + (string)record["Name"]; registered = true; } if (!registered) lblRegisteredName.Caption = "Registered To: Unregistered"; // Load Child Forms LoadChildrenForms(); // Set Start Page as Default Page foreach (Form mdi in MdiChildren) { if (mdi is frmStartPage) { mdi.Activate(); } } // Set Notification Icon notifyIcon1.Icon = Icon; loaded = true; }
private void LoadChildrenForms() { XPView cards = new XPView(Session.DefaultSession, typeof(Database.Cards)); cards.AddProperty("Model", "CardModel"); cards.AddProperty("Rev", "CardRevision"); cards.AddProperty("Serial", "CardSerialNumber"); foreach (ViewRecord record in cards) { switch ((string)record["Model"] + (string)record["Rev"]) { // Smart Sim Tech 30 Input Cards case "SST30IBeta": Boards.SST30I.Beta.frmSST30IBeta SST30IBeta = new Boards.SST30I.Beta.frmSST30IBeta(); SST30IBeta.MdiParent = this; SST30IBeta.ParentFrm = this; SST30IBeta.CardSerialNumber = (int)record["Serial"]; SST30IBeta.Show(); break; case "SST30IR1": Boards.SST30I.Rev1.frmSST30IR1 SST30IR1 = new Boards.SST30I.Rev1.frmSST30IR1(); SST30IR1.MdiParent = this; SST30IR1.CardSerialNumber = (int)record["Serial"]; SST30IR1.Show(); break; default: break; } } }
static void Main() { DevExpress.UserSkins.BonusSkins.Register(); DevExpress.Skins.SkinManager.EnableFormSkins(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Add the event handler for handling UI thread exceptions to the event. Application.ThreadException += new ThreadExceptionEventHandler(Form1_UIThreadException); // Set the unhandled exception mode to force all Windows Forms errors to go through // our handler. Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); // Add the event handler for handling non-UI thread exceptions to the event. //AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); //Forms.frmSplash frm = new Forms.frmSplash(); Forms.frmTransparentSplash launch = new Forms.frmTransparentSplash(); launch.Show(); launch.Refresh(); // Check for latest version Version vrs = new Version(Application.ProductVersion); //lblAppVersion.Caption = String.Format("Version: {0}.{1}.{2}", vrs.Major, vrs.Minor, vrs.Build); try { string latestversion; WebClient getversion = new WebClient(); latestversion = getversion.DownloadString("http://www.smartsimtech.com/software/sstcp-latestversion.txt"); Version latver = new Version(latestversion); getversion.Dispose(); if (latver > vrs) { Forms.frmAutoUpdate update = new Forms.frmAutoUpdate(); update.AppVersion = latestversion; update.ShowDialog(); if (update.ApplyUpdate) return; } } catch (Exception) { // No internet access to check for updates } launch.CheckDatabase(); //MessageBox.Show(XpoDefault.Session.ConnectionString); //XpoDefault.Session.ConnectionString = "data source=localhost\\SQLEXPRESS;integrated security=true;initial catalog=SSTCP2;"; //XpoDefault.Session.ConnectionString = String.Format("data source=tcp:{0}.database.windows.net;initial catalog={1};user id={2};password={3};", serverName, databaseName, userName, password); launch.CheckRegistration(); XPView view = new XPView(Session.DefaultSession, typeof(Database.Registration)); view.AddProperty("Name", "Name"); view.AddProperty("Company", "Company"); bool registered = false; foreach (ViewRecord record in view) { registered = true; } if (!registered) { Forms.frmRegistrationDetails register = new Forms.frmRegistrationDetails(); register.ShowDialog(); register.Dispose(); } launch.LaunchApplication(); if (launch.RunApplication) { Forms.frmMain MainApp = new Forms.frmMain(); MainApp.LaunchProcess = launch; Application.Run(MainApp); } else { launch.Dispose(); } }
void GroupBuild(Action<IEnumerable<string>, bool> itemsCalculated) { var xpView = new XPView(((XPObjectSpace) ((IObjectSpaceHolder) _propertyEditor).ObjectSpace).Session, _propertyEditor.ObjectTypeInfo.Type); xpView.AddProperty(_propertyEditor.PropertyName, _propertyEditor.PropertyName, true); itemsCalculated.Invoke(xpView.OfType<ViewRecord>().Select(record => record[0]).OfType<string>(), false); }