Пример #1
0
        private void DuplicateDetail_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            if (!ObjectSpace.IsModified)
            {
                genCon.showMsg("", "View Mode cannot proceed.", InformationType.Error);
                return;
            }
            if (((ListView)View).SelectedObjects.Count != 1)
            {
                genCon.showMsg("", "Please select only 1 item.", InformationType.Error);
                return;
            }

            IObjectSpace os = Application.CreateObjectSpace();

            if (typeof(ClassDocumentDetail).IsAssignableFrom(View.ObjectTypeInfo.Type))
            {
                foreach (ClassDocumentDetail dtl in ((ListView)View).SelectedObjects)
                {
                    if (View.ObjectTypeInfo.Type == typeof(PurchaseRequestDetail))
                    {
                        sDtl = dtl;
                    }
                    if (View.ObjectTypeInfo.Type == typeof(PurchaseOrderDetail))
                    {
                        sDtl = dtl;
                    }
                    if (View.ObjectTypeInfo.Type == typeof(PurchaseDeliveryDetail))
                    {
                        sDtl = dtl;
                    }
                    if (View.ObjectTypeInfo.Type == typeof(PurchaseReturnDetail))
                    {
                        sDtl = dtl;
                    }
                    if (View.ObjectTypeInfo.Type == typeof(PurchaseQuotationDetail))
                    {
                        sDtl = dtl;
                    }
                    //copyCon.copyClassDocumentDetail(dtl, sDtl, os);
                }
            }
            if (typeof(ClassStockTransferDocumentDetail).IsAssignableFrom(View.ObjectTypeInfo.Type))
            {
                foreach (ClassStockTransferDocumentDetail dtl in ((ListView)View).SelectedObjects)
                {
                    if (View.ObjectTypeInfo.Type == typeof(StockTransferRequestDetail))
                    {
                        sDtlS = dtl;
                    }
                    //copyCon.copyClassStockTransferDocumentDetail(dtl, sDtlS, os);
                }
            }
            NewObjectViewController newobjectcon = Frame.GetController <NewObjectViewController>();

            newobjectcon.NewObjectAction.DoExecute(newobjectcon.NewObjectAction.Items.FirstActiveItem);
        }
Пример #2
0
        public void copyClassStockTransferDocumentDetail(ClassStockTransferDocumentDetail dtl, ClassStockTransferDocumentDetail tDtl, IObjectSpace ios)
        {
            #region assign udf detail
            ClassUDFDetail sClassD = getUDFDetailClass(dtl);
            ClassUDFDetail tClassD = getUDFDetailClass(tDtl);
            AssignUDFDetailValues(ref sClassD, ref tClassD);
            #endregion

            tDtl.Quantity = dtl.Quantity;
            if (dtl.ItemCode != null)
            {
                tDtl.ItemCode = ios.FindObject <vwItemMasters>(CriteriaOperator.Parse("BoKey=?", dtl.ItemCode.BoKey));
            }
            tDtl.Dscription = dtl.Dscription;
            if (dtl.WhsCode != null)
            {
                tDtl.WhsCode = ios.FindObject <vwWarehouses>(CriteriaOperator.Parse("BoKey=?", dtl.WhsCode.BoKey));
            }
            if (dtl.OcrCode != null)
            {
                tDtl.OcrCode = ios.FindObject <vwDimension1>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode.BoKey));
            }
            if (dtl.OcrCode2 != null)
            {
                tDtl.OcrCode2 = ios.FindObject <vwDimension2>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode2.BoKey));
            }
            if (dtl.OcrCode3 != null)
            {
                tDtl.OcrCode3 = ios.FindObject <vwDimension3>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode3.BoKey));
            }
            if (dtl.OcrCode4 != null)
            {
                tDtl.OcrCode4 = ios.FindObject <vwDimension4>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode4.BoKey));
            }
            if (dtl.OcrCode5 != null)
            {
                tDtl.OcrCode5 = ios.FindObject <vwDimension5>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode5.BoKey));
            }
            if (dtl.PrjCode != null)
            {
                tDtl.PrjCode = ios.FindObject <vwProjects>(CriteriaOperator.Parse("BoKey=?", dtl.PrjCode.BoKey));
            }
            tDtl.UnitMsr = dtl.UnitMsr;

            tDtl.IsDuplicated = true;
        }
Пример #3
0
        private void Controller_ObjectCreated(object sender, ObjectCreatedEventArgs e)
        {
            ListView lv = ((ListView)View);

            if (lv.CollectionSource is PropertyCollectionSource)
            {
                PropertyCollectionSource collectionSource = (PropertyCollectionSource)lv.CollectionSource;
                if (collectionSource.MasterObject != null)
                {
                    int minvalue    = 0;
                    int maxvisorder = 0;

                    if (collectionSource.MasterObjectType == typeof(StockTransferRequest) && e.CreatedObject.GetType() == typeof(StockTransferRequestDetail))
                    {
                        StockTransferRequest       masterobject  = (StockTransferRequest)collectionSource.MasterObject;
                        StockTransferRequestDetail currentobject = (StockTransferRequestDetail)e.CreatedObject;

                        copyCon.GetStockDetailClassVisOrder(masterobject, ref minvalue, ref maxvisorder);

                        currentobject.Oid      = minvalue;
                        currentobject.VisOrder = maxvisorder;

                        if (sDtlS != null)
                        {
                            copyCon.copyClassStockTransferDocumentDetail(sDtlS, currentobject, e.ObjectSpace);
                        }
                    }
                    else if (collectionSource.MasterObjectType == typeof(PurchaseOrder))
                    {
                        PurchaseOrder       masterobject  = (PurchaseOrder)collectionSource.MasterObject;
                        PurchaseOrderDetail currentobject = (PurchaseOrderDetail)e.CreatedObject;

                        copyCon.GetDetailClassVisOrder(masterobject, ref minvalue, ref maxvisorder);

                        currentobject.Oid      = minvalue;
                        currentobject.VisOrder = maxvisorder;
                        currentobject.DocCur   = currentobject.Session.GetObjectByKey <vwCurrency>(masterobject.DocCur.BoKey);

                        if (sDtl != null)
                        {
                            copyCon.copyClassDocumentDetail(sDtl, currentobject, e.ObjectSpace);
                        }
                    }
                    else if (collectionSource.MasterObjectType == typeof(PurchaseRequest))
                    {
                        PurchaseRequest       masterobject  = (PurchaseRequest)collectionSource.MasterObject;
                        PurchaseRequestDetail currentobject = (PurchaseRequestDetail)e.CreatedObject;

                        copyCon.GetDetailClassVisOrder(masterobject, ref minvalue, ref maxvisorder);

                        currentobject.Oid      = minvalue;
                        currentobject.VisOrder = maxvisorder;

                        if (masterobject.DocCur != null)
                        {
                            currentobject.DocCur = currentobject.Session.GetObjectByKey <vwCurrency>(masterobject.DocCur.BoKey);
                        }

                        if (sDtl != null)
                        {
                            copyCon.copyClassDocumentDetail(sDtl, currentobject, e.ObjectSpace);
                        }
                    }
                    else if (collectionSource.MasterObjectType == typeof(PurchaseDelivery))
                    {
                        PurchaseDelivery       masterobject  = (PurchaseDelivery)collectionSource.MasterObject;
                        PurchaseDeliveryDetail currentobject = (PurchaseDeliveryDetail)e.CreatedObject;

                        copyCon.GetDetailClassVisOrder(masterobject, ref minvalue, ref maxvisorder);

                        currentobject.Oid      = minvalue;
                        currentobject.VisOrder = maxvisorder;

                        if (masterobject.DocCur != null)
                        {
                            currentobject.DocCur = currentobject.Session.GetObjectByKey <vwCurrency>(masterobject.DocCur.BoKey);
                        }

                        if (sDtl != null)
                        {
                            copyCon.copyClassDocumentDetail(sDtl, currentobject, e.ObjectSpace);
                        }
                    }
                    else if (collectionSource.MasterObjectType == typeof(PurchaseReturn))
                    {
                        PurchaseReturn       masterobject  = (PurchaseReturn)collectionSource.MasterObject;
                        PurchaseReturnDetail currentobject = (PurchaseReturnDetail)e.CreatedObject;

                        copyCon.GetDetailClassVisOrder(masterobject, ref minvalue, ref maxvisorder);

                        currentobject.Oid      = minvalue;
                        currentobject.VisOrder = maxvisorder;

                        if (masterobject.DocCur != null)
                        {
                            currentobject.DocCur = currentobject.Session.GetObjectByKey <vwCurrency>(masterobject.DocCur.BoKey);
                        }

                        if (sDtl != null)
                        {
                            copyCon.copyClassDocumentDetail(sDtl, currentobject, e.ObjectSpace);
                        }
                    }
                    else if (collectionSource.MasterObjectType == typeof(PurchaseQuotation))
                    {
                        PurchaseQuotation       masterobject  = (PurchaseQuotation)collectionSource.MasterObject;
                        PurchaseQuotationDetail currentobject = (PurchaseQuotationDetail)e.CreatedObject;

                        copyCon.GetDetailClassVisOrder(masterobject, ref minvalue, ref maxvisorder);

                        currentobject.Oid      = minvalue;
                        currentobject.VisOrder = maxvisorder;

                        if (masterobject.DocCur != null)
                        {
                            currentobject.DocCur = currentobject.Session.GetObjectByKey <vwCurrency>(masterobject.DocCur.BoKey);
                        }

                        if (sDtl != null)
                        {
                            copyCon.copyClassDocumentDetail(sDtl, currentobject, e.ObjectSpace);
                        }
                    }
                }
            }

            sDtl  = null;
            sDtlS = null;
        }