Beispiel #1
0
        public static int?GetLPNQuantity(Session session, int LPNNumber, int customerID, DateTime inventoryDate, Inventory currentRecord)
        {
            CriteriaOperatorCollection filter = new CriteriaOperatorCollection();

            filter.Add(new BinaryOperator("InventoryDate", inventoryDate, BinaryOperatorType.Equal));
            filter.Add(new BinaryOperator(Inventory.Fields.InventoryItemID.ItemCustomerID.CustomerID.PropertyName, customerID, BinaryOperatorType.Equal));
            filter.Add(new BinaryOperator("LPNNumber", LPNNumber, BinaryOperatorType.Equal));
            filter.Add(new BinaryOperator(Inventory.Fields.InventoryID.PropertyName, currentRecord.InventoryID, BinaryOperatorType.NotEqual));

            int?LPNQuantity = (int?)session.Evaluate <Inventory>(new AggregateOperand("", "InventoryQuantity", Aggregate.Sum), new GroupOperator(GroupOperatorType.And, filter));

            if (LPNQuantity.HasValue)
            {
                LPNQuantity += currentRecord.InventoryQuantity;
            }
            else
            {
                LPNQuantity = currentRecord.InventoryQuantity;
            }


            if (LPNQuantity.HasValue)
            {
                return(LPNQuantity.Value);
            }
            else
            {
                return(0);
            }
        }
Beispiel #2
0
        public static int GetNewPalletNumber(Session session, DateTime inventoryDate, int itemID, int?shift)
        {
            int?value = null;

            CriteriaOperatorCollection filter = new CriteriaOperatorCollection();

            filter.Add(new BinaryOperator("InventoryDate", inventoryDate.Date, BinaryOperatorType.GreaterOrEqual));
            filter.Add(new BinaryOperator("InventoryDate", inventoryDate.Date.AddDays(1), BinaryOperatorType.Less));
            filter.Add(new BinaryOperator("InventoryItemID", itemID, BinaryOperatorType.Equal));
            if (shift.HasValue)
            {
                filter.Add(new BinaryOperator("Shift", (object)shift, BinaryOperatorType.Equal));
            }
            else
            {
                return(1);
            }


            value = (int?)session.Evaluate <Inventory>(new AggregateOperand("", "Pallet", Aggregate.Max), new GroupOperator(GroupOperatorType.And, filter));

            if (value.HasValue)
            {
                return(value.Value + 1);
            }
            else
            {
                return(1);
            }
        }
Beispiel #3
0
        private static void AddRMItems(Session ReportSession, bool OnlyAssignedCustomers)
        {
            XPCollection <LocationInventory> itemCollection = null;
            CriteriaOperatorCollection       theCriteria    = new CriteriaOperatorCollection();
            VRMItemKey VRMKey = new VRMItemKey();

            theCriteria.Add(new BinaryOperator(LocationInventory.Fields.LocationInventoryItem.ItemType.PropertyName, "RM", BinaryOperatorType.Equal));

            if (OnlyAssignedCustomers)
            {
                theCriteria.Add(new InOperator(LocationInventory.Fields.LocationInventoryItem.ItemCustomerID.PropertyName, UsersCustomerBLL.GetAssignedCustomerIDs(ReportSession)));
            }

            itemCollection = new XPCollection <LocationInventory>(ReportSession, new GroupOperator(GroupOperatorType.And, theCriteria));

            foreach (LocationInventory item in itemCollection)
            {
                VRMKey.ItemCode = item.LocationInventoryItem.ItemCode;
                VRMKey.Location = item.Location.LocationCode;

                if (CurrentRMInventoryDictionary.ContainsKey(VRMKey))
                {
                    CurrentRMInventoryDictionary[VRMKey].QuantityOnHand += item.QuantityOnHand;
                }
                else
                {
                    CurrentRMInventoryDictionary.Add(VRMKey, new VRMItem()
                    {
                        Item = item
                    });
                }
            }
        }
Beispiel #4
0
        public void FillAdjustmentView()
        {
            CriteriaOperatorCollection inventoryViewCriteria = new CriteriaOperatorCollection();

            if (((DateTime?)fromFilterDateEdit.EditValue).HasValue)
            {
                inventoryViewCriteria.Add(new BinaryOperator(InventoryAdjustment.Fields.AdjustmentDate.PropertyName, Convert.ToDateTime(fromFilterDateEdit.EditValue), BinaryOperatorType.GreaterOrEqual));
            }
            if (((DateTime?)toFilterDateEdit.EditValue).HasValue)
            {
                inventoryViewCriteria.Add(new BinaryOperator(InventoryAdjustment.Fields.AdjustmentDate.PropertyName, Convert.ToDateTime(toFilterDateEdit.EditValue), BinaryOperatorType.LessOrEqual));
            }
            if (((int?)customerFilterLookUpEdit.EditValue).HasValue)
            {
                inventoryViewCriteria.Add(new BinaryOperator(InventoryAdjustment.Fields.AdjustmentItem.ItemCustomerID.CustomerID.PropertyName, Convert.ToInt32(customerFilterLookUpEdit.EditValue), BinaryOperatorType.Equal));
            }
            if (((int?)itemFilterLookUpEdit.EditValue).HasValue)
            {
                inventoryViewCriteria.Add(new BinaryOperator(InventoryAdjustment.Fields.AdjustmentItem.ItemID.PropertyName, Convert.ToInt32(itemFilterLookUpEdit.EditValue), BinaryOperatorType.Equal));
            }

            inventoryXPView.Criteria = CriteriaOperator.And(inventoryViewCriteria);


            //Me.adjustmentGridControl.DataSource = m_Adjustment.GetAdjustmentView(CType(Me.fromFilterDateEdit.EditValue, Date?), CType(Me.toFilterDateEdit.EditValue, Date?), _
            //                                                                     CType(Me.customerFilterLookUpEdit.EditValue, Integer?), CType(Me.itemFilterLookUpEdit.EditValue, Integer?))
        }
Beispiel #5
0
        private void FilterLpns()
        {
            CriteriaOperatorCollection lpnViewCriteria = new CriteriaOperatorCollection();

            if (((int?)itemLookUpEdit.EditValue).HasValue && ((int?)locationLookUpEdit.EditValue).HasValue)
            {
                lpnViewCriteria.Add(new BinaryOperator(LocationInventoryByLot.Fields.LocationInventoryItem.ItemID.PropertyName, Convert.ToInt32(itemLookUpEdit.EditValue), BinaryOperatorType.Equal));
                lpnViewCriteria.Add(new BinaryOperator(LocationInventoryByLot.Fields.Location.Oid.PropertyName, Convert.ToInt32(locationLookUpEdit.EditValue), BinaryOperatorType.Equal));

                lpnXpView.Criteria = CriteriaOperator.And(lpnViewCriteria);
            }
        }
        private void AddUsedInProductiontoSummary(DateTime?fromDate, DateTime?toDate, int currentItem)
        {
            CriteriaOperatorCollection theCriteria = new CriteriaOperatorCollection();

            if (fromDate.HasValue)
            {
                theCriteria.Add(new BinaryOperator("InventoryBOMInventoryID.InventoryDate", fromDate.Value, BinaryOperatorType.GreaterOrEqual));
            }
            if (toDate.HasValue)
            {
                theCriteria.Add(new BinaryOperator("InventoryBOMInventoryID.InventoryDate", toDate.Value, BinaryOperatorType.LessOrEqual));
            }
            theCriteria.Add(new BinaryOperator("InventoryBOMRawMatID", currentItem, BinaryOperatorType.Equal));
            transactionSummary.UsedInProduction = Convert.ToDouble(Session.DefaultSession.Evaluate(typeof(InventoryBOMs), CriteriaOperator.Parse("Sum((InventoryBOMQuantity + InventoryBOMQuantity * (ScrapFactor)) * InventoryBOMInventoryID.InventoryQuantity * -1)"), CriteriaOperator.And(theCriteria)));
        }
        private void AddProductionToSummary(DateTime?fromDate, DateTime?toDate, int currentItem)
        {
            CriteriaOperatorCollection theCriteria = new CriteriaOperatorCollection();

            if (fromDate.HasValue)
            {
                theCriteria.Add(new BinaryOperator("InventoryDate", fromDate.Value, BinaryOperatorType.GreaterOrEqual));
            }
            if (toDate.HasValue)
            {
                theCriteria.Add(new BinaryOperator("InventoryDate", toDate.Value, BinaryOperatorType.LessOrEqual));
            }
            theCriteria.Add(new BinaryOperator("InventoryItemID", currentItem, BinaryOperatorType.Equal));
            transactionSummary.Produced = Convert.ToDouble(Session.DefaultSession.Evaluate(typeof(Inventory), CriteriaOperator.Parse("Sum(InventoryQuantity)"), CriteriaOperator.And(theCriteria)));
        }
        private void AddAdjustmentsToSummary(DateTime?fromDate, DateTime?toDate, int currentItem)
        {
            CriteriaOperatorCollection theCriteria = new CriteriaOperatorCollection();

            if (fromDate.HasValue)
            {
                theCriteria.Add(new BinaryOperator("AdjustmentDate", fromDate.Value, BinaryOperatorType.GreaterOrEqual));
            }
            if (toDate.HasValue)
            {
                theCriteria.Add(new BinaryOperator("AdjustmentDate", toDate.Value, BinaryOperatorType.LessOrEqual));
            }
            theCriteria.Add(new BinaryOperator("AdjustmentItem", currentItem, BinaryOperatorType.Equal));
            transactionSummary.Adjusted = Convert.ToDouble(Session.DefaultSession.Evaluate(typeof(InventoryAdjustment), CriteriaOperator.Parse("Sum(NewCount) - Sum(OriginalQuantity)"), CriteriaOperator.And(theCriteria)));
        }
Beispiel #9
0
 public static void Esit(this CriteriaOperatorCollection list, string alan, TextBox textBox)
 {
     if (!string.IsNullOrWhiteSpace(textBox.Text))
     {
         list.Add(new BinaryOperator(alan, textBox.Text));
     }
 }
Beispiel #10
0
 public static void IleBaslayan(this CriteriaOperatorCollection list, string alan, TextBox textBox)
 {
     if (!string.IsNullOrWhiteSpace(textBox.Text))
     {
         list.Add(new BinaryOperator(alan, textBox.Text + "%", BinaryOperatorType.Like));
     }
 }
Beispiel #11
0
        private CriteriaOperatorCollection GetOperatorCollection(string fields, DataTable dataTable)
        {
            var operatorCollection = new CriteriaOperatorCollection();

            foreach (string property in fields.Split(';'))
            {
                if (property != "" && property.IndexOf("!") == -1 && property != "This")
                {
                    XPMemberInfo xpMemberInfo = ReflectorHelper.GetXpMemberInfo(Session, ObjectType, property);
                    if (xpMemberInfo.IsPersistent)
                    {
                        operatorCollection.Add(CriteriaOperator.Parse(property, new object[0]));
                        var dataColumn = new DataColumn(property)
                        {
                            DataType = xpMemberInfo.MemberType
                        };
                        if (typeof(XPBaseObject).IsAssignableFrom(dataColumn.DataType))
                        {
                            dataColumn.DataType = Session.GetClassInfo(dataColumn.DataType).KeyProperty.MemberType;
                        }
                        dataTable.Columns.Add(dataColumn);
                        if (property == ObjectClassInfo.KeyProperty.Name)
                        {
                            dataTable.PrimaryKey = new[] { dataColumn }
                        }
                        ;
                    }
                }
            }
            return(operatorCollection);
        }
Beispiel #12
0
        private static FunctionOperator createOperandValue(object requiredValue, FunctionOperatorType operatorType)
        {
            CriteriaOperatorCollection operands = new CriteriaOperatorCollection();
            OperandValue operandValue           = new OperandValue(requiredValue);

            operands.Add(operandValue);
            return(new FunctionOperator(operatorType, operands));
        }
Beispiel #13
0
        private IEnumerable <Classroom> GetByCriteria(
            Guid addressOid,
            IEnumerable <string> equipmentElements,
            SeatingType?seating = default(SeatingType?),
            int?capacity        = default(int?))
        {
            var criteria = new CriteriaOperatorCollection();

            if (addressOid != Guid.Empty)
            {
                criteria.Add(
                    new BinaryOperator("Address", addressOid, BinaryOperatorType.Equal)
                    );
            }

            if (equipmentElements?.Any() ?? false)
            {
                criteria.Add(CriteriaOperator.Or(
                                 equipmentElements.Select(e => new BinaryOperator(
                                                              "AdditionalInfo",
                                                              $"%{e}%",
                                                              BinaryOperatorType.Like
                                                              ))
                                 ));
            }

            if (capacity.HasValue)
            {
                criteria.Add(
                    new BinaryOperator(
                        "Capacity",
                        capacity.Value,
                        BinaryOperatorType.GreaterOrEqual
                        )
                    );
            }

            if (seating.HasValue)
            {
                criteria.Add(new BinaryOperator("SeatingType", seating.Value));
            }

            return(criteria.Any() ?
                   new XPCollection <Classroom>(session, CriteriaOperator.And(criteria)) :
                   new XPCollection <Classroom>(session));
        }
Beispiel #14
0
        private static FunctionOperator createOperandProperty(string property, FunctionOperatorType operatorType)
        {
            CriteriaOperatorCollection operands        = new CriteriaOperatorCollection();
            OperandProperty            propertyOperand = new OperandProperty(property);

            operands.Add(propertyOperand);
            return(new FunctionOperator(operatorType, operands));
        }
Beispiel #15
0
        public static void BuyukOlanlarByte(this CriteriaOperatorCollection list, string alan, TextBox textBox)
        {
            byte deger;

            if (byte.TryParse(textBox.Text, out deger))
            {
                list.Add(new BinaryOperator(alan, deger, BinaryOperatorType.GreaterOrEqual));
            }
        }
Beispiel #16
0
        public static void TarihAra(this CriteriaOperatorCollection list, string alan, DateTimePicker date)
        {
            DateTime deger;

            if (DateTime.TryParse(Convert.ToString(date.Value.Date), out deger))
            {
                return;
            }
            list.Add(new BinaryOperator(alan, deger, BinaryOperatorType.Equal));
        }
Beispiel #17
0
        public static bool IsMultiLPN(Session session, int LPNNumber, int customerID, DateTime inventoryDate)
        {
            CriteriaOperatorCollection filter = new CriteriaOperatorCollection();

            filter.Add(new BinaryOperator("InventoryDate", inventoryDate, BinaryOperatorType.Equal));
            filter.Add(new BinaryOperator(Inventory.Fields.InventoryItemID.ItemCustomerID.CustomerID.PropertyName, customerID, BinaryOperatorType.Equal));
            filter.Add(new BinaryOperator("LPNNumber", LPNNumber, BinaryOperatorType.Equal));

            int?LPNCount = (int?)session.Evaluate <Inventory>(new AggregateOperand("", "InventoryQuantity", Aggregate.Count), new GroupOperator(GroupOperatorType.And, filter));

            if (LPNCount.HasValue && LPNCount.Value > 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private void FilterLpns()
        {
            CriteriaOperatorCollection lpnViewCriteria = new CriteriaOperatorCollection();

            if (fromLocationLookUpEdit.EditValue != null)
            {
                lpnViewCriteria.Add(new BinaryOperator(LocationInventoryByLot.Fields.Location.Oid.PropertyName, Convert.ToInt32(fromLocationLookUpEdit.EditValue), BinaryOperatorType.Equal));
            }

            autochange = true;
            lpnViewCriteria.Add(new BinaryOperator(LocationInventoryByLot.Fields.LocationInventoryItem.ItemID.PropertyName, transferDetailsGridView.GetFocusedRowCellValue(transferItemGridColumn), BinaryOperatorType.Equal));
            LPNxpView.Criteria = CriteriaOperator.And(lpnViewCriteria);

            if (LPNxpView.Count == 1)
            {
                transferDetailsGridView.SetFocusedRowCellValue(fullLpnNumberGridColumn, LPNxpView[0]["LPN"]);
            }
            autochange = false;
        }
Beispiel #19
0
        public static bool IsUniqueConstrauntViolated <T>(this T prmValue, params string[] prmUniqueFields) where T : XPObject
        {
            var operands = new CriteriaOperatorCollection();

            Array.ForEach(prmUniqueFields, property => operands.Add(new BinaryOperator(new OperandProperty(property),
                                                                                       new OperandValue(prmValue.ClassInfo.GetMember(property).GetValue(prmValue)), BinaryOperatorType.Equal)));
            CriteriaOperator keyCondition = new NotOperator(new BinaryOperator(prmValue.ClassInfo.KeyProperty.Name,
                                                                               prmValue.ClassInfo.KeyProperty.GetValue(prmValue)));

            return(prmValue.Session.FindObject <T>(PersistentCriteriaEvaluationBehavior.InTransaction,
                                                   new GroupOperator(new GroupOperator(GroupOperatorType.And, operands), keyCondition)) != null);
        }
Beispiel #20
0
        private void FilterLots()
        {
            CriteriaOperatorCollection lotViewCriteria = new CriteriaOperatorCollection();

            if (((int?)lpnLookUpEdit.EditValue).HasValue)
            {
                lotViewCriteria.Add(new BinaryOperator(LocationInventoryByLot.Fields.LPNNumber.PropertyName, Convert.ToInt32(lpnLookUpEdit.EditValue), BinaryOperatorType.Equal));

                LotXpView.Criteria = CriteriaOperator.And(lotViewCriteria);
                LotXpView.Reload();
            }
        }
        private void AddReceivingsToSumary(DateTime?fromDate, DateTime?toDate, int currentItem)
        {
            double total = 0;
            CriteriaOperatorCollection theCriteria = new CriteriaOperatorCollection();

            if (fromDate.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ReceivMainID.ReceivDate", fromDate.Value, BinaryOperatorType.GreaterOrEqual));
            }
            if (toDate.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ReceivMainID.ReceivDate", toDate.Value, BinaryOperatorType.LessOrEqual));
            }

            theCriteria.Add(new BinaryOperator("ReceivDetItemID", currentItem, BinaryOperatorType.Equal));
            total = Convert.ToDouble(Session.DefaultSession.Evaluate(typeof(ReceivingDetail), CriteriaOperator.Parse("Sum(intUnits)"), CriteriaOperator.And(theCriteria)));

            theCriteria.Clear();

            if (fromDate.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ReceiveMainID.ReceivDate", fromDate.Value, BinaryOperatorType.GreaterOrEqual));
            }
            if (toDate.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ReceiveMainID.ReceivDate", toDate.Value, BinaryOperatorType.LessOrEqual));
            }
            theCriteria.Add(new BinaryOperator("ReturnDetItemID", currentItem, BinaryOperatorType.Equal));
            total += Convert.ToDouble(Session.DefaultSession.Evaluate(typeof(ReceivedReturns), CriteriaOperator.Parse("Sum(ReturnDetQty)"), CriteriaOperator.And(theCriteria)));

            transactionSummary.Received = total;
        }
Beispiel #22
0
        public void FillProductionView()
        {
            CriteriaOperatorCollection productionViewCriteria = new CriteriaOperatorCollection();

            if (((DateTime?)fromFilterDateEdit.EditValue).HasValue)
            {
                productionViewCriteria.Add(new BinaryOperator(Production.Fields.ProdMainDate.PropertyName, Convert.ToDateTime(fromFilterDateEdit.EditValue), BinaryOperatorType.GreaterOrEqual));
            }
            if (((DateTime?)toFilterDateEdit.EditValue).HasValue)
            {
                productionViewCriteria.Add(new BinaryOperator(Production.Fields.ProdMainDate.PropertyName, Convert.ToDateTime(toFilterDateEdit.EditValue), BinaryOperatorType.LessOrEqual));
            }
            if (((int?)customerFilterLookUpEdit.EditValue).HasValue)
            {
                productionViewCriteria.Add(new BinaryOperator(Production.Fields.ProdMainItemID.ItemCustomerID.CustomerID.PropertyName, Convert.ToInt32(customerFilterLookUpEdit.EditValue), BinaryOperatorType.Equal));
            }
            if (((int?)shiftFilterLookUpEdit.EditValue).HasValue)
            {
                productionViewCriteria.Add(new BinaryOperator(Production.Fields.ProdMainShift.ShiftID.PropertyName, Convert.ToInt32(shiftFilterLookUpEdit.EditValue), BinaryOperatorType.Equal));
            }
            if (((int?)machineFilterLookUpEdit.EditValue).HasValue)
            {
                productionViewCriteria.Add(new BinaryOperator(Production.Fields.ProdMainMachineLine.MachineLineID.PropertyName, Convert.ToInt32(machineFilterLookUpEdit.EditValue), BinaryOperatorType.Equal));
            }
            if (((int?)itemFilterLookUpEdit.EditValue).HasValue)
            {
                productionViewCriteria.Add(new BinaryOperator(Production.Fields.ProdMainItemID.ItemID.PropertyName, Convert.ToInt32(itemFilterLookUpEdit.EditValue), BinaryOperatorType.Equal));
            }

            productionXPView.Criteria = CriteriaOperator.And(productionViewCriteria);
        }
Beispiel #23
0
        private static CriteriaOperatorCollection RemoveEmptyOperands(CriteriaOperatorCollection source)
        {
            CriteriaOperatorCollection result = new CriteriaOperatorCollection();

            foreach (CriteriaOperator operand in source)
            {
                if (!IsNull(operand))
                {
                    result.Add(operand);
                }
            }
            return(result);
        }
Beispiel #24
0
        public static bool IsLPNShipped(string fullLPNNumber, int customerID, Session DXSession)
        {
            if (!fullLPNNumber.StartsWith(CustomersBLL.GetLPNPrefix(customerID)))
            {
                fullLPNNumber = CustomersBLL.GetLPNPrefix(customerID) + ("0000000000" + fullLPNNumber).Substring(("0000000000" + fullLPNNumber).Length - CustomersBLL.GetCustomer(customerID, DXSession).LastLPNNumber.ToString().Length);
            }

            CriteriaOperatorCollection filter = new CriteriaOperatorCollection();

            filter.Add(new BinaryOperator(ShipDet.Fields.ShipDetMainID.ShipMainCustID.CustomerID.PropertyName, customerID, BinaryOperatorType.Equal));
            filter.Add(new BinaryOperator(ShipDet.Fields.FullLPNNumber.PropertyName, fullLPNNumber, BinaryOperatorType.Equal));

            int?LPNCount = (int?)XpoDefault.Session.Evaluate <ShipDet>(new AggregateOperand("", "FullLPNNumber", Aggregate.Count), new GroupOperator(GroupOperatorType.And, filter));

            if (LPNCount.HasValue && LPNCount.Value >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        protected CriteriaOperatorCollection VisitOperands(CriteriaOperatorCollection operands)
        {
            bool isModified = false;
            CriteriaOperatorCollection result = new CriteriaOperatorCollection(operands.Count);

            foreach (CriteriaOperator operand in operands)
            {
                CriteriaOperator acceptedOperand = this.AcceptOperator(operand);
                result.Add(acceptedOperand);
                if (!object.ReferenceEquals(operand, acceptedOperand))
                {
                    isModified = true;
                }
            }
            return(isModified ? result : operands);
        }
Beispiel #26
0
        public static CriteriaOperator GetAndCriteria(params CriteriaOperator[] operators)
        {
            CriteriaOperatorCollection operatorCollection = new CriteriaOperatorCollection();

            foreach (CriteriaOperator op in operators)
            {
                if (!Equals(op, null))
                {
                    operatorCollection.Add(op);
                }
            }
            if (operatorCollection.Count == 0)
            {
                return(null);
            }

            if (operatorCollection.Count == 1)
            {
                return(operatorCollection[0]);
            }

            return(GetANDCriteria(operatorCollection));
        }
 // Простая выборка полей по указанному запросу
 private SelectStatementResult SelectSimple(string sql, string parameterName, object parameterValue, params string[] columnNames)
 {
     StringCollection parametersNames = new StringCollection();
     parametersNames.Add(parameterName);
     CriteriaOperatorCollection selectFields = new CriteriaOperatorCollection(columnNames.Length);
     foreach (string columnName in columnNames)
         selectFields.Add(new QueryOperand(columnName, null));
     Query query = new Query(sql, new QueryParameterCollection(new OperandValue(parameterValue)), parametersNames);
     return SelectData(query, selectFields);
 }
 private SelectStatementResult SelectData(Query query, CriteriaOperatorCollection targets)
 {
     if (query.ConstantValues != null && query.OperandIndexes != null && query.ConstantValues.Count > 0)
     {
         CriteriaOperatorCollection customTargets = new CriteriaOperatorCollection();
         if (query.OperandIndexes.Count == 0)
         {
             customTargets.Add(new OperandValue(1));
         }
         else
         {
             CriteriaOperator[] trgts = new CriteriaOperator[query.OperandIndexes.Count];
             for (int i = 0; i < targets.Count; i++)
             {
                 if (query.OperandIndexes.ContainsKey(i))
                 {
                     trgts[query.OperandIndexes[i]] = targets[i];
                 }
             }
             customTargets.AddRange(trgts);
         }
         SelectStatementResult queryResult = SelectDataSimple(query, customTargets, false)[0];
         SelectStatementResultRow[] rows = new SelectStatementResultRow[queryResult.Rows.Length];
         for (int ri = 0; ri < rows.Length; ri++)
         {
             object[] values = new object[targets.Count];
             for (int i = 0; i < targets.Count; i++)
             {
                 if (query.OperandIndexes.ContainsKey(i))
                 {
                     values[i] = queryResult.Rows[ri].Values[query.OperandIndexes[i]];
                 }
                 else
                 {
                     values[i] = query.ConstantValues[i].Value;
                 }
             }
             rows[ri] = new SelectStatementResultRow(values);
         }
         return new SelectStatementResult(rows);
     }
     return SelectDataSimple(query, targets, false)[0];
 }
Beispiel #29
0
        private void PrintLpnSimpleButton_Click(object sender, EventArgs e)
        {
            int    digits    = CustomersBLL.GetCustomer(7, m_LocationSession).LastLPNNumber.ToString().Length;
            XPView lpnXPview = null;
            CriteriaOperatorCollection critaria = new CriteriaOperatorCollection();

            lpnXPview = new XPView(m_LocationSession, typeof(LocationInventoryByLot));


            if (inventoryByLotGridView.GroupCount > 0)
            {
                int i = -1;
                while (inventoryByLotGridView.IsValidRowHandle(i))
                {
                    if (inventoryByLotGridView.GetChildRowHandle(i, 0) > -1)
                    {
//INSTANT C# NOTE: The ending condition of VB 'For' loops is tested only on entry to the loop. Instant C# has created a temporary variable in order to use the initial value of inventoryByLotGridView.GetChildRowCount(i) + inventoryByLotGridView.GetChildRowHandle(i, 0) for every iteration:
                        int tempVar = inventoryByLotGridView.GetChildRowCount(i) + inventoryByLotGridView.GetChildRowHandle(i, 0);
                        for (int ci = inventoryByLotGridView.GetChildRowHandle(i, 0); ci < tempVar; ci++)
                        {
                            if (inventoryByLotGridView.IsRowVisible(ci) == RowVisibleState.Visible)
                            {
                                int?   lpn = Utilities.ChangeType <int?>(inventoryByLotGridView.GetRowCellValue(ci, colLPNNumber));
                                string lot = inventoryByLotGridView.GetRowCellValue(ci, colLot).ToString();
                                if (lpn.HasValue && lot.Length > 0)
                                {
                                    critaria.Add(new GroupOperator(GroupOperatorType.And, new BinaryOperator("LPNNumber", lpn.Value, BinaryOperatorType.Equal), new BinaryOperator("LocationInventoryLot", lot, BinaryOperatorType.Equal)));
                                }
                            }
                        }
                    }
                    i -= 1;
                }
            }
            else
            {
                for (int ci = 0; ci < inventoryByLotGridView.RowCount; ci++)
                {
                    if (inventoryByLotGridView.IsRowVisible(ci) == RowVisibleState.Visible)
                    {
                        int?   lpn = Utilities.ChangeType <int?>(inventoryByLotGridView.GetRowCellValue(ci, colLPNNumber));
                        string lot = inventoryByLotGridView.GetRowCellValue(ci, colLot).ToString();
                        if (lpn.HasValue && lot.Length > 0)
                        {
                            critaria.Add(new GroupOperator(GroupOperatorType.And, new BinaryOperator("LPNNumber", lpn.Value, BinaryOperatorType.Equal), new BinaryOperator("LocationInventoryLot", lot, BinaryOperatorType.Equal)));
                        }
                    }
                }
            }

            lpnXPview.Criteria = CriteriaOperator.Or(critaria);

            lpnXPview.Properties.AddRange(new ViewProperty[]
            {
                new ViewProperty("Item", SortDirection.None, "[LocationInventoryItem.ItemCode]", false, true),
                new ViewProperty("ItemDesc", SortDirection.None, "[LocationInventoryItem.ItemDescription]", false, true),
                new ViewProperty("Allergens", SortDirection.None, "[LocationInventoryItem.Allergens]", false, true),
                new ViewProperty("Qty", SortDirection.None, "[QuantityOnHand]", false, true),
                new ViewProperty("Expr", SortDirection.None, "[ExpirationDate]", false, true),
                new ViewProperty("Lot", SortDirection.None, "[LocationInventoryLot]", false, true),
                new ViewProperty("LPN", SortDirection.Ascending, "[LPNNumber]", false, true)
            });

            LPNLabelsXtraReport labels = new LPNLabelsXtraReport();

            labels.DataSource = lpnXPview;
            labels.lpnGroupHeader.GroupFields.Add(new GroupField("LPN", XRColumnSortOrder.Ascending));
            labels.itemCodeXrLabel.DataBindings.Add("Text", lpnXPview, "Item");
            labels.itemDescXrLabel.DataBindings.Add("Text", lpnXPview, "ItemDesc");
            labels.AllergensXrLabel.ExpressionBindings.Add(new ExpressionBinding("BeforePrint", "Text", "Iif(Len(Trim([Allergens]))>0,'Allergens: ' + [Allergens],'Allergens: None')"));
            labels.exprXrLabel.DataBindings.Add("Text", lpnXPview, "Expr", "{0:MM/dd/yyyy}");
            labels.qtyXrLabel.DataBindings.Add("Text", lpnXPview, "Qty");
            labels.lotXrLabel.DataBindings.Add("Text", lpnXPview, "Lot");
            labels.LPNXrBarCode.DataBindings.Add("Text", lpnXPview, "LPN", "SPG{0:D" + digits + "}");
            labels.SumQtyXrLabel.ExpressionBindings.Add(new ExpressionBinding("BeforePrint", "Text", "sumSum([Qty])"));
            labels.ReprintXrLabel.Visible = true;
            labels.CreateDocument();
            labels.ShowPreviewDialog();
        }
Beispiel #30
0
        public static XPView GetCurrentInventoryReport(int?customerID, string itemType, string items, bool?inactiveItems, bool?inactiveCustomers, bool?outOfStockItems, bool onlyAssignedCustomers, int?locationID)
        {
            XPView CurrentInventoryReportXPView    = new XPView(Session.DefaultSession, typeof(LocationInventory));
            CriteriaOperatorCollection theCriteria = new CriteriaOperatorCollection();

            if (customerID.HasValue)
            {
                theCriteria.Add(new BinaryOperator(LocationInventory.Fields.LocationInventoryItem.ItemCustomerID.CustomerID.PropertyName, customerID.Value, BinaryOperatorType.Equal));
            }
            if (string.IsNullOrEmpty(itemType) == false)
            {
                theCriteria.Add(new BinaryOperator(LocationInventory.Fields.LocationInventoryItem.ItemType.PropertyName, itemType, BinaryOperatorType.Equal));
            }
            if (inactiveCustomers.Value == false)
            {
                theCriteria.Add(new BinaryOperator(LocationInventory.Fields.LocationInventoryItem.ItemCustomerID.Inactive.PropertyName, false));
            }
            if (inactiveItems.Value == false)
            {
                theCriteria.Add(new BinaryOperator(LocationInventory.Fields.LocationInventoryItem.Inactive.PropertyName, false));
            }
            if (string.IsNullOrEmpty(items) == false)
            {
                theCriteria.Add(new InOperator(LocationInventory.Fields.LocationInventoryItem.ItemID.PropertyName, items.Split('|')));
            }
            if (outOfStockItems.HasValue == false || outOfStockItems == false)
            {
                theCriteria.Add(new BinaryOperator(LocationInventory.Fields.QuantityOnHand.PropertyName, 1, BinaryOperatorType.GreaterOrEqual));
            }
            if (onlyAssignedCustomers == true)
            {
                theCriteria.Add(new InOperator(LocationInventory.Fields.LocationInventoryItem.ItemCustomerID.CustomerID.PropertyName, UsersCustomerBLL.GetAssignedCustomerIDs(XpoDefault.Session)));
            }
            if (locationID.HasValue)
            {
                theCriteria.Add(new BinaryOperator(LocationInventory.Fields.Location.Oid.PropertyName, locationID.Value, BinaryOperatorType.Equal));
            }

            try
            {
                CurrentInventoryReportXPView.Criteria = CriteriaOperator.And(theCriteria);
                CurrentInventoryReportXPView.Properties.AddRange(new ViewProperty[]
                {
                    new ViewProperty("CustomerName", SortDirection.Ascending, LocationInventory.Fields.LocationInventoryItem.ItemCustomerID.CustomerName.PropertyName, false, true),
                    new ViewProperty("ItemCode", SortDirection.Ascending, LocationInventory.Fields.LocationInventoryItem.ItemCode.PropertyName, false, true),
                    new ViewProperty("ItemDescription", SortDirection.None, LocationInventory.Fields.LocationInventoryItem.ItemDescription.PropertyName, false, true),
                    new ViewProperty("ItemType", SortDirection.None, CriteriaOperator.Parse(string.Format("IIF({0} = 'RM', 'Raw Material', IIF({0} = 'IG', 'Intermediate Goods', 'Finished Goods'))", LocationInventory.Fields.LocationInventoryItem.ItemType.PropertyName)), false, true),
                    new ViewProperty("QuantityOnHand", SortDirection.None, LocationInventory.Fields.QuantityOnHand.PropertyName, false, true),
                    new ViewProperty("InventoryByPallets", SortDirection.None, CriteriaOperator.Parse(string.Format("IIF({1} = 0, 0, {0} / {1})", LocationInventory.Fields.QuantityOnHand.PropertyName, LocationInventory.Fields.LocationInventoryItem.intUnitsPerPallet.PropertyName)), false, true),
                    new ViewProperty("UOM", SortDirection.None, LocationInventory.Fields.LocationInventoryItem.strUnitOfMeasure.PropertyName, false, true),
                    new ViewProperty("Location", SortDirection.None, LocationInventory.Fields.Location.LocationCode.PropertyName, false, true),
                    new ViewProperty("InactiveCustomer", SortDirection.None, LocationInventory.Fields.LocationInventoryItem.ItemCustomerID.Inactive.PropertyName, false, true),
                    new ViewProperty("InactiveItem", SortDirection.None, LocationInventory.Fields.LocationInventoryItem.Inactive.PropertyName, false, true)
                });
                return(CurrentInventoryReportXPView);
            }
            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);
        }
Beispiel #31
0
 private CriteriaOperatorCollection GetOperatorCollection(string fields, DataTable dataTable)
 {
     var operatorCollection = new CriteriaOperatorCollection();
     foreach (string property in fields.Split(';'))
         if (property != "" && property.IndexOf("!") == -1 && property != "This")
         {
             XPMemberInfo xpMemberInfo = ReflectorHelper.GetXpMemberInfo(Session, ObjectType, property);
             if (xpMemberInfo.IsPersistent)
             {
                 operatorCollection.Add(CriteriaOperator.Parse(property, new object[0]));
                 var dataColumn = new DataColumn(property) {DataType = xpMemberInfo.MemberType};
                 if (typeof (XPBaseObject).IsAssignableFrom(dataColumn.DataType))
                     dataColumn.DataType = Session.GetClassInfo(dataColumn.DataType).KeyProperty.MemberType;
                 dataTable.Columns.Add(dataColumn);
                 if (property == ObjectClassInfo.KeyProperty.Name)
                     dataTable.PrimaryKey = new[] {dataColumn};
             }
         }
     return operatorCollection;
 }
Beispiel #32
0
        public static XPView GetShippingReturnsReport(DateTime?fromDate, DateTime?toDate, int?shiftID, int?customerID, string lot, string BOL, int?destinationID, int?carrierID, string items, bool?inactiveItems, bool?inactiveCustomers, bool onlyAssignedCustomers)
        {
            XPView ShippingReturnsReportXPView     = new XPView(Session.DefaultSession, typeof(ShippedReturns));
            CriteriaOperatorCollection theCriteria = new CriteriaOperatorCollection();

            if (fromDate.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ShipMainID.ShipMainDate", fromDate.Value, BinaryOperatorType.GreaterOrEqual));
            }
            if (toDate.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ShipMainID.ShipMainDate", toDate.Value, BinaryOperatorType.LessOrEqual));
            }
            if (string.IsNullOrEmpty(BOL) == false)
            {
                theCriteria.Add(new BinaryOperator("ShipMainID.ShipMainBOL", BOL, BinaryOperatorType.Equal));
            }
            //If String.IsNullOrEmpty(po) = False Then
            //    theCriteria.Add(New BinaryOperator("ShipMainID.strPO", po, BinaryOperatorType.Equal))
            //End If
            //If String.IsNullOrEmpty(deliveryNoteNumber) = False Then
            //    theCriteria.Add(New BinaryOperator("ShipMainID.DeliveryNoteNumber", deliveryNoteNumber, BinaryOperatorType.Equal))
            //End If
            if (shiftID.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ShipMainID.Shift", shiftID.Value, BinaryOperatorType.Equal));
            }
            if (customerID.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ShipMainID.ShipMainCustID", customerID.Value, BinaryOperatorType.Equal));
            }
            if (carrierID.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ShipMainID.ShipMainCarrierID", carrierID.Value, BinaryOperatorType.Equal));
            }
            if (destinationID.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ShipMainID.intDestination", destinationID.Value, BinaryOperatorType.Equal));
            }
            if (string.IsNullOrEmpty(lot) == false)
            {
                theCriteria.Add(new BinaryOperator("ReturnDetLot", lot, BinaryOperatorType.Equal));
            }
            if (inactiveCustomers.Value == false)
            {
                theCriteria.Add(new BinaryOperator("ShipMainID.ShipMainCustID.Inactive", false));
            }
            if (inactiveItems.Value == false)
            {
                theCriteria.Add(new BinaryOperator("ReturnDetItemID.Inactive", false));
            }
            if (string.IsNullOrEmpty(items) == false)
            {
                theCriteria.Add(new InOperator("ReturnDetItemID", items.Split('|')));
            }
            if (onlyAssignedCustomers == true)
            {
                theCriteria.Add(new InOperator("ShipMainID.ShipMainCustID", UsersCustomerBLL.GetAssignedCustomerIDs(XpoDefault.Session)));
            }

            try
            {
                ShippingReturnsReportXPView.Criteria = CriteriaOperator.And(theCriteria);
                ShippingReturnsReportXPView.Properties.AddRange(new ViewProperty[]
                {
                    new ViewProperty("ShipMainDate", SortDirection.Ascending, "[ShipMainID].[ShipMainDate]", false, true),
                    new ViewProperty("ShiftName", SortDirection.None, "[ShipMainID].[Shift].[ShiftName]", false, true),
                    new ViewProperty("CustomerName", SortDirection.Ascending, "[ShipMainID].[ShipMainCustID].[CustomerName]", false, true),
                    new ViewProperty("ShipMainBOL", SortDirection.None, "[ShipMainID].[ShipMainBOL]", false, true),
                    new ViewProperty("strPO", SortDirection.None, "[ShipMainID].[strPO]", false, true),
                    new ViewProperty("DeliveryNoteNumber", SortDirection.None, "[ShipMainID].[DeliveryNoteNumber]", false, true),
                    new ViewProperty("ShippingName", SortDirection.None, "[ShipMainID].[intDestination].[ShippingName]", false, true),
                    new ViewProperty("ReturnDetLot", SortDirection.None, "[ReturnDetLot]", false, true),
                    new ViewProperty("ItemCode", SortDirection.Ascending, "[ReturnDetItemID].[ItemCode]", false, true),
                    new ViewProperty("ItemDescription", SortDirection.None, "[ReturnDetItemID].[ItemDescription]", false, true),
                    new ViewProperty("intUnits", SortDirection.None, "[intUnits]", false, true),
                    new ViewProperty("CarrierName", SortDirection.None, "[ShipMainID].[ShipMainCarrierID].[CarrierName]", false, true),
                    new ViewProperty("strTrailer", SortDirection.None, "[ShipMainID].[strTrailer]", false, true),
                    new ViewProperty("strSeal", SortDirection.None, "[ShipMainID].[strSeal]", false, true),
                    new ViewProperty("ExpirationDate", SortDirection.None, "[ExpirationDate]", false, true),
                    new ViewProperty("ExpirationDateFormat", SortDirection.None, "[ShipMainID].[ShipMainCustID].[ExpirationDateFormat]", false, true)
                });
                return(ShippingReturnsReportXPView);
            }
            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);
        }
        public ItemTransactionSummaryList GetItemTransactionSummaryReport(DateTime?fromDate, DateTime?toDate, int?itemCustomerID, string items, string itemType, bool onlyAssigned)
        {
            if (fromDate.HasValue == false && toDate.HasValue == false && itemCustomerID.HasValue == false && string.IsNullOrEmpty(items))
            {
                return(null);
            }

            ItemTransactionSummaryList transactionsSummaryList = new ItemTransactionSummaryList();

            try
            {
                XPView itemsXPView = null;
                CriteriaOperatorCollection theCriteria = new CriteriaOperatorCollection();

                if (itemCustomerID.HasValue)
                {
                    theCriteria.Add(new BinaryOperator("ItemCustomerID", itemCustomerID.Value, BinaryOperatorType.Equal));
                }
                if (onlyAssigned)
                {
                    theCriteria.Add(new InOperator("ItemCustomerID", UsersCustomerBLL.GetAssignedCustomerIDs(XpoDefault.Session)));
                }
                if (string.IsNullOrEmpty(itemType) == false)
                {
                    theCriteria.Add(new BinaryOperator("ItemType", itemType, BinaryOperatorType.Equal));
                }
                if (string.IsNullOrEmpty(items) == false)
                {
                    theCriteria.Add(new InOperator("ItemID", items.Split('|')));
                }

                itemsXPView = new XPView(Session.DefaultSession, typeof(Items))
                {
                    Criteria = CriteriaOperator.And(theCriteria)
                };
                itemsXPView.Properties.Add(new ViewProperty("ItemID", SortDirection.None, "ItemID", false, true));

                foreach (ViewRecord item in itemsXPView)
                {
                    transactionSummary = new ItemTransactionSummary();
                    Items currentItem = Session.DefaultSession.GetObjectByKey <Items>(item["ItemID"]);
                    transactionSummary.CustomerName    = currentItem.ItemCustomerID.CustomerName;
                    transactionSummary.ItemCode        = currentItem.ItemCode;
                    transactionSummary.ItemDescription = currentItem.ItemDescription;
                    transactionSummary.ItemType        = ((currentItem.ItemType == "RM") ? "Raw Material" : ((currentItem.ItemType == "IG") ? "Intermediate Goods" : "Finished Goods")).ToString();
                    AddReceivingsToSumary(fromDate, toDate, currentItem.ItemID);
                    AddShippingsToSummary(fromDate, toDate, currentItem.ItemID);
                    AddAdjustmentsToSummary(fromDate, toDate, currentItem.ItemID);
                    AddProductionToSummary(fromDate, toDate, currentItem.ItemID);
                    AddUsedInProductiontoSummary(fromDate, toDate, currentItem.ItemID);
                    if (transactionSummary.Received != 0 || transactionSummary.Produced != 0 || transactionSummary.Adjusted != 0 || transactionSummary.Shipped != 0 || transactionSummary.UsedInProduction != 0)
                    {
                        transactionsSummaryList.Add(transactionSummary);
                    }
                }
            }
            catch (Exception 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);
            }

            return(transactionsSummaryList);
        }
        private static CriteriaOperatorCollection GetCriteria(this GridView gv)
        {
            var go = gv.ActiveFilterCriteria as GroupOperator;
            if (ReferenceEquals(go, null))
            {
                if (!ReferenceEquals(gv.ActiveFilterCriteria, null))
                {
                    var OpC = new CriteriaOperatorCollection();
                    OpC.Add(gv.ActiveFilterCriteria);
                    return OpC;
                }

                return null;
            }
            return go.Operands;
        }