예제 #1
0
파일: ETLLogBO.cs 프로젝트: ewin66/dev
        public ETLBusinessObject GetETLBusinessObject(Session session, Guid jobId, Int64 ObjectId)
        {
            ETLBusinessObject etlBusinessObject = null;

            try
            {
                ETLJob job = session.GetObjectByKey <ETLJob>(jobId);
                if (job == null)
                {
                    return(null);
                }

                BusinessObject businessObject = session.GetObjectByKey <BusinessObject>(ObjectId);
                if (businessObject == null)
                {
                    return(null);
                }

                CriteriaOperator criteria_0 = new BinaryOperator("ETLJobId", job, BinaryOperatorType.Equal);
                CriteriaOperator criteria_1 = new BinaryOperator("BusinessObjectId", businessObject, BinaryOperatorType.Equal);
                CriteriaOperator criteria_2 = new BinaryOperator("RowStatus", 0, BinaryOperatorType.GreaterOrEqual);
                CriteriaOperator criteria   = GroupOperator.Combine(GroupOperatorType.And, criteria_0, criteria_1, criteria_2);

                etlBusinessObject = session.FindObject <ETLBusinessObject>(criteria);
            }
            catch (Exception)
            {
                throw;
            }
            return(etlBusinessObject);
        }
예제 #2
0
파일: ETLLogBO.cs 프로젝트: ewin66/dev
        public XPCollection <ETLBusinessObject> GetNewerETLBusinessObject(Session session, Guid jobId, DateTime time)
        {
            XPCollection <ETLBusinessObject> etlBusinessObjectCollection = null;

            try
            {
                ETLJob job = session.GetObjectByKey <ETLJob>(jobId);
                if (job == null)
                {
                    return(null);
                }

                CriteriaOperator criteria_0 = new BinaryOperator("ETLJobId", job, BinaryOperatorType.Equal);
                CriteriaOperator criteria_1 = new BinaryOperator("RowStatus", 0, BinaryOperatorType.GreaterOrEqual);
                CriteriaOperator criteria_2 = new BinaryOperator("BusinessObjectIssuedDateTimeStamp", time, BinaryOperatorType.GreaterOrEqual);
                CriteriaOperator criteria   = GroupOperator.Combine(GroupOperatorType.And, criteria_0, criteria_1, criteria_2);

                etlBusinessObjectCollection = new XPCollection <ETLBusinessObject>(session, criteria);
            }
            catch (Exception)
            {
                throw;
            }
            return(etlBusinessObjectCollection);
        }
예제 #3
0
        public bool IsExistETLEntryObjectHistory(Session session, Guid jobId, Int64 objectEntryLogId)
        {
            bool result = false;

            try
            {
                ETLJob         job            = session.GetObjectByKey <ETLJob>(jobId);
                ObjectEntryLog objectEntryLog = session.GetObjectByKey <ObjectEntryLog>(objectEntryLogId);

                CriteriaOperator criteria_0 = new BinaryOperator(new OperandProperty("ETLBusinessObjectId.ETLJobId.ETLJobId"), job.ETLJobId, BinaryOperatorType.Equal);
                CriteriaOperator criteria_1 = new BinaryOperator("ObjectEntryLogId", objectEntryLog, BinaryOperatorType.Equal);
                CriteriaOperator criteria_2 = new BinaryOperator("RowStatus", 1, BinaryOperatorType.GreaterOrEqual);
                CriteriaOperator criteria   = GroupOperator.Combine(GroupOperatorType.And, criteria_0, criteria_1, criteria_2);

                ETLEntryObjectHistory etlEntryObjectHistory = session.FindObject <ETLEntryObjectHistory>(criteria);
                if (etlEntryObjectHistory != null)
                {
                    result = true;
                }
            }catch (Exception)
            {
                throw;
            }
            return(result);
        }
예제 #4
0
        protected override void OnChanged(string propertyName, object oldValue, object newValue)
        {
            base.OnChanged(propertyName, oldValue, newValue);

            if (propertyName == "ItemPurchaseOrder")
            {
                ItemPurchaseOrder itemPO = Session.FindObject <ItemPurchaseOrder>(new BinaryOperator(propertyName, newValue));
                if (itemPO != null)
                {
                    this.Vendor = itemPO.Vendor;
                }
            }

            if (propertyName == "ItemNumber" && this.PONumber != null && UnitCost == 0)
            {
                CriteriaOperator op = GroupOperator.Combine(GroupOperatorType.And,
                                                            new BinaryOperator("PurchaseOrder", this.PONumber),
                                                            new BinaryOperator("ItemNumber", newValue));
                ItemPurchaseOrderLine itemPOl = Session.FindObject <ItemPurchaseOrderLine>(op);
                this.UnitCost = itemPOl.UnitCost;
            }
            if (this.PONumber != null && this.ItemNumber != null)
            {
                this.ReceiverStatus = ItemReceiverStatus.WaitingDocumentation;
            }
        }
예제 #5
0
        private int AddToSerialNumber(string itemnumber, string lot, string serialnumber, string expdate, string scan)
        {
            IObjectSpace objectspace = this.ObjectSpace.CreateNestedObjectSpace();

            // InventoryItemBatchItems iiBi = this.ObjectSpace.GetObject<InventoryItemBatchItems>();

            ItemInventoryBatch iib = objectToShow;

            // Find the item in the item list
            // bool found = false;
            Session session;

            session = objectToShow.Session;
            CriteriaOperator op = GroupOperator.Combine(GroupOperatorType.And,
                                                        new BinaryOperator("ItemInventoryBatch", iib.Oid),
                                                        new BinaryOperator("NDC", itemnumber),
                                                        new BinaryOperator("Lot", lot),
                                                        new BinaryOperator("SerialNumber", serialnumber));

            ItemInventoryBatchSerialNo itemToUpdate = (ItemInventoryBatchSerialNo)session.FindObject(typeof(ItemInventoryBatchSerialNo),
                                                                                                     op, true);


            if (itemToUpdate != null)
            {
                return(-1);
            }
            else
            {
                ItemInventoryBatchSerialNo iibi;

                iibi = objectspace.CreateObject <ItemInventoryBatchSerialNo>();


                iibi.ItemInventoryBatch = objectspace.GetObject <ItemInventoryBatch>((ItemInventoryBatch)this.View.CurrentObject);


                iibi.NDC          = itemnumber;
                iibi.Lot          = lot;
                iibi.Barcode      = scan;
                iibi.SerialNumber = serialnumber;
                DateTime result;
                if (DateTime.TryParse(expdate, out result))
                {
                    iibi.ExpDate = result;
                }
                iibi.Save();
                objectspace.CommitChanges();
                //  objectspace.Refresh();
            }
            objectToShow.Item.Reload();
            //jectSpace.ReloadObject();

            this.View.ObjectSpace.CommitChanges();
            this.View.ObjectSpace.Refresh();


            return(1);
        }
예제 #6
0
    protected void FilterOutNonSelectedRows(ASPxGridView gridView, bool selectedRows)
    {
        CriteriaOperator selectionCriteria = new InOperator(gridView.KeyFieldName, gridView.GetSelectedFieldValues(gridView.KeyFieldName));

        if (!selectedRows)
        {
            selectionCriteria = selectionCriteria.Not();
        }
        gridView.FilterExpression = (GroupOperator.Combine(GroupOperatorType.And, selectionCriteria)).ToString();
    }
        void showReportWithParameters_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
        {
            var parameters            = e.PopupWindow.View.CurrentObject as ReportParameters;
            CriteriaOperator criteria = new BinaryOperator("Deadline", parameters.DeadlineBefore, BinaryOperatorType.Less);

            if (!string.IsNullOrEmpty(parameters.SubjectContains))
            {
                criteria = GroupOperator.Combine(GroupOperatorType.And, criteria,
                                                 CriteriaOperator.Parse("Contains([Subject], ?)", parameters.SubjectContains));
            }
            var dataSource = Application.CreateObjectSpace().CreateCollection(typeof(Task), criteria);
            var report     = new TaskReport();

            report.DataSource = dataSource;
            report.ShowPreview();
        }
예제 #8
0
파일: ETLLogBO.cs 프로젝트: ewin66/dev
        public void CreateETLBusinessObject(Session session, Guid ETLJobId, Int64 ObjectId)
        {
            try
            {
                ETLJob job = session.GetObjectByKey <ETLJob>(ETLJobId);
                if (job == null)
                {
                    return;
                }

                BusinessObject businessObject = session.GetObjectByKey <BusinessObject>(ObjectId);
                if (businessObject == null)
                {
                    return;
                }

                CriteriaOperator criteria_0 = new BinaryOperator("ETLJobId", job, BinaryOperatorType.Equal);
                CriteriaOperator criteria_1 = new BinaryOperator("BusinessObjectId", businessObject, BinaryOperatorType.Equal);
                CriteriaOperator criteria_2 = new BinaryOperator("RowStatus", 0, BinaryOperatorType.GreaterOrEqual);
                CriteriaOperator criteria   = GroupOperator.Combine(GroupOperatorType.And, criteria_0, criteria_1, criteria_2);

                ETLBusinessObject etlBusinessObject = session.FindObject <ETLBusinessObject>(criteria);

                if (etlBusinessObject != null)
                {
                    etlBusinessObject.RowStatus = Constant.ROWSTATUS_ACTIVE;
                    etlBusinessObject.BusinessObjectIssuedDateTimeStamp = businessObject.ObjectIssueDate;
                    etlBusinessObject.Save();
                    return;
                }

                etlBusinessObject = new ETLBusinessObject(session);
                etlBusinessObject.BusinessObjectId = businessObject;
                etlBusinessObject.ETLJobId         = job;
                etlBusinessObject.RowStatus        = Constant.ROWSTATUS_ACTIVE;
                etlBusinessObject.BusinessObjectIssuedDateTimeStamp = businessObject.ObjectIssueDate;
                etlBusinessObject.Save();
                ETLBusinessObject LastETLBusinessObject = GetNearestETLBusinessObject(session, ETLJobId, ObjectId);
                etlBusinessObject.PreviousETLBusinessObjectId = LastETLBusinessObject;
                etlBusinessObject.Save();
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #9
0
        public bool NeedToBeProcessed(Session session, Int64 ObjectId, Guid jobId)
        {
            bool           result         = false;
            BusinessObject businessObject = session.GetObjectByKey <BusinessObject>(ObjectId);

            if (businessObject == null)
            {
                return(false);
            }

            ETLJob etlJob = session.GetObjectByKey <ETLJob>(jobId);

            if (etlJob == null)
            {
                return(false);
            }

            CriteriaOperator criteria_0 = new BinaryOperator("ETLJobId", etlJob, BinaryOperatorType.Equal);
            CriteriaOperator criteria_1 = new BinaryOperator("BusinessObjectId", businessObject, BinaryOperatorType.Equal);
            CriteriaOperator criteria_2 = new BinaryOperator("RowStatus", 0, BinaryOperatorType.Greater);
            CriteriaOperator criteria   = GroupOperator.Combine(GroupOperatorType.And, criteria_0, criteria_1, criteria_2);

            ETLBusinessObject etlBusinessObject = session.FindObject <ETLBusinessObject>(criteria);

            if (etlBusinessObject == null)
            {
                return(true);
            }
            ObjectEntryLogBO objectEntryLogBO = new ObjectEntryLogBO();
            ObjectEntryLog   objectEntryLog   = objectEntryLogBO.GetNewestObjectEntryLog(session, businessObject.BusinessObjectId);

            if (objectEntryLog == null)
            {
                objectEntryLogBO.CreateObjectEntryLog(session, businessObject);
                objectEntryLog = objectEntryLogBO.GetNewestObjectEntryLog(session, businessObject.BusinessObjectId);
            }

            if (!IsExistETLEntryObjectHistory(session, jobId, objectEntryLog.ObjectEntryLogId))
            {
                return(true);
            }

            return(result);
        }
예제 #10
0
    public void gridView_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
    {
        if (e.Parameters != "ValueChanged")
        {
            return;
        }

        ASPxGridView grid           = sender as ASPxGridView;
        var          selectedValues = glCategories.GridView.GetSelectedFieldValues(glCategories.KeyFieldName);

        if (selectedValues.Count == 0)
        {
            selectedValues.Add(-1);
        }
        CriteriaOperator selectionCriteria = new InOperator(glCategories.KeyFieldName, selectedValues);

        adsProducts.FilterExpression = (GroupOperator.Combine(GroupOperatorType.And, selectionCriteria)).ToString();
        Session["FilterExpression"]  = adsProducts.FilterExpression;
        grid.DataSource = adsProducts;
        grid.DataBind();
    }
예제 #11
0
        public ETLEntryObjectHistory GetETLEntryObjectHistory(Session session, Guid jobId, Int64 businessObjectId)
        {
            ETLEntryObjectHistory etlEntryObjectHistory = null;

            try
            {
                ETLJob job = session.GetObjectByKey <ETLJob>(jobId);
                if (job == null)
                {
                    return(null);
                }

                BusinessObject businessObject = session.GetObjectByKey <BusinessObject>(businessObjectId);
                if (businessObject == null)
                {
                    return(null);
                }

                ObjectEntryLogBO objectEntryLogBO     = new ObjectEntryLogBO();
                ETLLogBO         etlLogBO             = new ETLLogBO();
                ObjectEntryLog   newestObjectEntryLog = objectEntryLogBO.GetNewestObjectEntryLog(session, businessObjectId);

                ETLBusinessObject etlBusinessObject = etlLogBO.GetETLBusinessObject(session, jobId, businessObjectId);
                if (etlBusinessObject == null)
                {
                    return(null);
                }

                CriteriaOperator criteria_0 = new BinaryOperator("ETLBusinessObjectId", etlBusinessObject, BinaryOperatorType.Equal);
                CriteriaOperator criteria_1 = new BinaryOperator(new OperandProperty("ObjectEntryLogId.BusinessObjectId.BusinessObjectId"), businessObject.BusinessObjectId, BinaryOperatorType.Equal);
                CriteriaOperator criteria   = GroupOperator.Combine(GroupOperatorType.And, criteria_0, criteria_1);

                etlEntryObjectHistory = session.FindObject <ETLEntryObjectHistory>(criteria);
            }
            catch (Exception)
            {
                throw;
            }
            return(etlEntryObjectHistory);
        }
예제 #12
0
        protected override CriteriaOperator ToCriteria(INode node)
        {
            var result = base.ToCriteria(node);

            if (ReferenceEquals(SqlFilterCriteria, null))
            {
                return(result);
            }

            if (ReferenceEquals(result, null))
            {
                return(SqlFilterCriteria);
            }

            try
            {
                var coresult = GroupOperator.Combine(GroupOperatorType.And, result, SqlFilterCriteria);
                return(coresult);
            }
            catch
            {
                return(result);
            }
        }
예제 #13
0
 protected override void ApplyCriteriaCore(CriteriaOperator criteria)
 {
     ((XPView)originalCollection).Criteria = GroupOperator.Combine(GroupOperatorType.And, _fixedCriteria,
                                                                   criteria);
 }
예제 #14
0
        private int AddToItems(object sender, string itemnumber, string lot, string expdate, string scan)
        {
            // this counts for non serialized numbers


            // editor1 = ((DetailView)View).FindItem("Items") as ListPropertyEditor;
            IObjectSpace objectspace = this.ObjectSpace.CreateNestedObjectSpace();

            // InventoryItemBatchItems iiBi = this.ObjectSpace.GetObject<InventoryItemBatchItems>();

            ItemInventoryBatch iib = objectToShow;

            // Find the item in the item list
            // bool found = false;
            Session session;

            session = objectToShow.Session;
            CriteriaOperator op = GroupOperator.Combine(GroupOperatorType.And,
                                                        new BinaryOperator("InventoryBatch", iib.Oid),
                                                        new BinaryOperator("NDC", itemnumber),
                                                        new BinaryOperator("Lot", lot));

            InventoryItemBatchItems itemToUpdate = (InventoryItemBatchItems)session.FindObject(typeof(InventoryItemBatchItems),
                                                                                               op, true);


            if (itemToUpdate != null)
            {
                itemToUpdate.Qty++;
                itemToUpdate.Save();
                session.CommitTransaction();
            }
            else
            {
                InventoryItemBatchItems iibi;

                iibi = objectspace.CreateObject <InventoryItemBatchItems>();


                iibi.InventoryBatch = objectspace.GetObject <ItemInventoryBatch>((ItemInventoryBatch)this.View.CurrentObject);
                //iibi.InventoryBatch.Oid = iib.Oid;

                iibi.NDC = itemnumber;
                iibi.Lot = lot;
                iibi.Qty = 1;
                DateTime result;
                if (DateTime.TryParse(expdate, out result))
                {
                    iibi.ExpirationDate = result;
                }
                iibi.Save();
                objectspace.CommitChanges();
                // objectspace.Refresh();
            }

            objectToShow.Save();
            this.View.ObjectSpace.CommitChanges();
            objectToShow.ItemInventoryBatchS.Reload();
            objectToShow.Item.Reload();
            //jectSpace.ReloadObject();

            this.View.ObjectSpace.Refresh();
            return(1);
        }