public static void DoubleIntFieldsRefReturn( [DNNE.C99Type("struct int_fields")] IntFields input, [DNNE.C99Type("struct int_fields*")] IntFields *result) { result->a = input.a * 2; result->b = input.b * 2; result->c = input.c * 2; }
public static IntFields DoubleIntFields([DNNE.C99Type("struct int_fields")] IntFields input) { return(new IntFields() { a = input.a * 2, b = input.b * 2, c = input.c * 2, }); }
private static void addIntField(string userField, string displayFieldName = null) { UserFields.Add(userField); IntFields.Add(userField); if (displayFieldName != null) { DisplayFieldByIndexField.Add(userField, displayFieldName); } }
private static void addNumericField(this Document doc, string userField, int fieldValue) { userField = userField.ToLower(Str.Culture); if (!IntFields.Contains(userField)) { throw new ArgumentException($"Numeric int field {userField} not initialized"); } var field = new Int32Field(userField, fieldValue, Field.Store.NO); doc.Add(field); }
public void ValidateIntFields() { const int A = 24, B = 37, C = 59; var initial = new IntFields() { a = A, b = B, c = C, }; var expected = new IntFields() { a = initial.a * 2, b = initial.b * 2, c = initial.c * 2, }; var input = initial; { var result = NativeExportsNE.DoubleIntFields(input); Assert.Equal(initial, input); Assert.Equal(expected, result); } { var result = new IntFields(); NativeExportsNE.DoubleIntFieldsRefReturn(input, ref result); Assert.Equal(initial, input); Assert.Equal(expected, result); } { IntFields result; NativeExportsNE.DoubleIntFieldsOutReturn(input, out result); Assert.Equal(initial, input); Assert.Equal(expected, result); } { input = initial; NativeExportsNE.DoubleIntFieldsByRef(ref input); Assert.Equal(expected, input); } { input = initial; NativeExportsNE.DoubleIntFieldsByRefIn(in input); Assert.Equal(expected, input); // Updated even when passed with in keyword (matches built-in system) } }
public unsafe void BlittableStruct() { const int A = 24, B = 37, C = 59; var initial = new IntFields() { a = A, b = B, c = C, }; var expected = new IntFields() { a = initial.a * 2, b = initial.b * 2, c = initial.c * 2, }; var input = initial; { NativeExportsNE.DoubleIntFields_Ptr(&input); Assert.Equal(expected, input); } }
//Filter by number for Customer public List <Backend.Customer> CustomerNumberQuery(int minNumber, int maxNumber, IntFields field) { List <Backend.Customer> allCustomer = ReadFromFile(Elements.Customer).Cast <Backend.Customer>().ToList(); List <Backend.Customer> filteredCustomer; if (allCustomer.ElementAtOrDefault(0) == null) { throw new InvalidDataException("There is nothing to find from."); } if (field == IntFields.id) { filteredCustomer = allCustomer.Where(n => n.Id >= minNumber && n.Id <= maxNumber).Cast <Backend.Customer>().ToList(); } else if (field == IntFields.tranHistory) { filteredCustomer = allCustomer.Where(n => n.TranHistory.Any(x => x.TransactionID >= minNumber && x.TransactionID <= maxNumber)).Cast <Backend.Customer>().ToList(); } else { throw new System.Data.DataException("Bad Input!"); } return(filteredCustomer); }
//Filter by number for transaction public List <Backend.Transaction> TransactionNumberQuery(int minNumber, int maxNumber, IntFields field) { { List <Backend.Transaction> allTransaction = ReadFromFile(Elements.Transaction).Cast <Backend.Transaction>().ToList(); List <Backend.Transaction> filteredTransaction; if (allTransaction.ElementAtOrDefault(0) == null) { throw new InvalidDataException("There is nothing to find from."); } if (field == IntFields.transactionID) { filteredTransaction = allTransaction.Where(n => n.TransactionID >= minNumber && n.TransactionID <= maxNumber).Cast <Backend.Transaction>().ToList(); } else if (field == IntFields.receipt) { filteredTransaction = allTransaction.Where(n => n.Receipt.Any(x => x.PrdID >= minNumber && x.PrdID <= maxNumber)).Cast <Backend.Transaction>().ToList(); } else if (field == IntFields.currentDate) { filteredTransaction = allTransaction.Where(n => int.Parse(n.CurrentDate.ToString("yyyyMMdd")) >= minNumber && int.Parse(n.CurrentDate.ToString("yyyyMMdd")) <= maxNumber).Cast <Backend.Transaction>().ToList(); } else { throw new System.Data.DataException("Bad Input!"); } return(filteredTransaction); } }
//Filter by number for department public List <Backend.Department> DepartmentNumberQuery(int minNumber, int maxNumber, IntFields field) { { List <Backend.Department> allDepartment = ReadFromFile(Elements.Department).Cast <Backend.Department>().ToList(); List <Backend.Department> filteredDepartment; if (allDepartment.ElementAtOrDefault(0) == null) { throw new InvalidDataException("There is nothing to find from."); } if (field != IntFields.departmentID) { throw new System.Data.DataException("Bad Input!"); } filteredDepartment = allDepartment.Where(n => n.DepartmentID >= minNumber && n.DepartmentID <= maxNumber).Cast <Backend.Department>().ToList(); return(filteredDepartment); } }
//Filter by number for employee public List <Backend.Employee> EmployeeNumberQuery(int minNumber, int maxNumber, IntFields field) { List <Backend.Employee> allEmployee = ReadFromFile(Elements.Employee).Cast <Backend.Employee>().ToList(); List <Backend.Employee> filteredEmployee; if (allEmployee.ElementAtOrDefault(0) == null) { throw new InvalidDataException("There is nothing to find from."); } if (field == IntFields.id) { filteredEmployee = allEmployee.Where(n => n.Id >= minNumber && n.Id <= maxNumber).Cast <Backend.Employee>().ToList(); } else if (field == IntFields.depID) { filteredEmployee = allEmployee.Where(n => n.DepID >= minNumber && n.DepID <= maxNumber).Cast <Backend.Employee>().ToList(); } else if (field == IntFields.salary) { filteredEmployee = allEmployee.Where(n => n.Salary >= minNumber && n.Salary <= maxNumber).Cast <Backend.Employee>().ToList(); } else if (field == IntFields.supervisiorID) { filteredEmployee = allEmployee.Where(n => n.SupervisiorID >= minNumber && n.SupervisiorID <= maxNumber).Cast <Backend.Employee>().ToList(); } else { throw new System.Data.DataException("Bad Input!"); } return(filteredEmployee); }
//Filter by number for product public List <Backend.Product> ProductNumberQuery(int minNumber, int maxNumber, IntFields field) { List <Backend.Product> allProducts = ReadFromFile(Elements.Product).Cast <Backend.Product>().ToList(); List <Backend.Product> filteredProducts; if (allProducts.ElementAtOrDefault(0) == null) { throw new InvalidDataException("There is nothing to find from."); } if (field == IntFields.price) { filteredProducts = allProducts.Where(n => n.Price >= minNumber && n.Price <= maxNumber).Cast <Backend.Product>().ToList(); } else if (field == IntFields.productID) { filteredProducts = allProducts.Where(n => n.ProductID >= minNumber && n.ProductID <= maxNumber).Cast <Backend.Product>().ToList(); } else if (field == IntFields.location) { filteredProducts = allProducts.Where(n => n.Location >= minNumber && n.Location <= maxNumber).Cast <Backend.Product>().ToList(); } else if (field == IntFields.stockCount) { filteredProducts = allProducts.Where(n => n.StockCount >= minNumber && n.StockCount <= maxNumber).Cast <Backend.Product>().ToList(); } else { throw new System.Data.DataException("Bad Input!"); } return(filteredProducts); }
public static partial void DoubleIntFieldsByRef(ref IntFields result);
public static partial IntFields DoubleIntFields(IntFields result);
public List <object> FindByNumber(IntFields field, int minNumber, int maxNumber) { return(itsDAL.EmployeeNumberQuery(minNumber, maxNumber, field).Cast <object>().ToList()); }
public List <object> FindByNumber(IntFields field, int minNumber, int maxNumber) { //search method by number return(itsDAL.ClubMemberNumberQuery(minNumber, maxNumber, field).Cast <object>().ToList()); }
public List <object> FindByNumber(IntFields field, int minNumber, int maxNumber) { throw new System.Data.DataException("users doesn't have numbers!"); }