Exemple #1
0
        void OnSaveClick(object sender, EventArgs e)
        {
            if (PurchaseTransactionItems.Any())
            {
                _jewelCalculation.Calculate(CostingRate, PurchaseTransactionItems);

                var lookup = new TransactionLookup
                {
                    ContactName         = txtContactName.Text,
                    DocNumber           = txtDocNo.Text,
                    Remarks             = txtRemarks.Text,
                    TransactionDate     = dtCosting.Value,
                    TransactionPartyRef = ((Supplier)cboCustomer.SelectedItem).SupplierCode,
                    TransactionType     = TransactionType.PurchaseTransaction,
                    JewelTransactions   = PurchaseTransactionItems
                };

                var request = new JewelTransactionRequest
                {
                    TransactionLookup = lookup,
                };
                var response = _costingServices.CreateJewelTransaction(request);

                if (response.IsValid == false)
                {
                    MessageBox.Show(AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER);
                    return;
                }

                ShowManagedModalForm <frmCostingConfirmation>(Owner as frmCostingBase, response.TransactionLookup);
                Close();
            }
        }
        void onbtnSaveClick(object sender, EventArgs e)
        {
            TransactionLookup lookup;

            if (TryCreateJewelLookup(out lookup))
            {
                var request = new JewelTransactionRequest {
                    TransactionLookup = lookup
                };
                var response = _transactionServices.CreateJewelTransaction(request);

                ShowManagedModalForm <frmCostingConfirmation>(Owner as frmMDIParent, response.TransactionLookup);
                Close();
            }
        }
Exemple #3
0
        private void lnkRTS_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            var isYes = MessageBox.Show(Resources.frmManageTransaction_lnkRTS_LinkClicked_Are_you_sure_want_to_return_stock_into_account, Resources.frmManageTransaction_lnkRTS_LinkClicked_Return_To_Stock, MessageBoxButtons.OKCancel) == DialogResult.OK;

            if (isYes)
            {
                var transactionType = (TransactionType == TransactionType.MarketingTransaction) ? TransactionType.MarketingInReturnTransaction :
                                      (TransactionType == TransactionType.ApprovalTransaction ? TransactionType.ApprovalInReturnTransaction : TransactionType.NotSet);

                var request    = new JewelTransactionRequest();
                var memoNumber = (cboTran.SelectedValue as TransactionLookup).MemoNumber;

                var lookup  = _transactionServices.GetJewelTransactionsLookUp().Single(x => x.MemoNumber == memoNumber);
                var clookup = new TransactionLookup
                {
                    Remarks             = lookup.Remarks,
                    TransactionPartyRef = lookup.TransactionPartyRef,
                    ContactName         = lookup.ContactName,
                    DocNumber           = lookup.DocNumber,
                    TransactionLookupId = 0,
                    TransactionDate     = DateTime.Now,
                    TransactionType     = transactionType
                };

                foreach (object row in dgvJewel.Rows)
                {
                    var current = ((DataGridViewRow)(row));
                    if ((bool)current.Cells[_columnselectchk.ToLowerCaseColumnName()].Value)
                    {
                        var jewelno = current.Cells[_columnjewelnumber.ToLowerCaseColumnName()].Value;
                        var tran    = current.Cells[_columntrno.ToLowerCaseColumnName()].Value;
                        var jewel   = _transactionServices.GetJewelStockByJewelNo(jewelno.ToString());
                        var trans   = _transactionServices.GetJewelTransactionsById((Int32)tran);
                        if ((jewel.StockStatus == StockStatus.ItemLockedInStock && jewel.JewelState == JewelState.OnMarketing) ||
                            jewel.StockStatus == StockStatus.ItemOutOfStock && jewel.JewelState == JewelState.OnApproval)
                        {
                            var item = new JewelTransaction
                            {
                                CostingDetail     = trans.CostingDetail,
                                TransactionType   = transactionType,
                                MetalColor        = trans.MetalColor,
                                CStonePcs         = trans.CStonePcs,
                                CStoneWeight      = trans.CStoneWeight,
                                CertificateNumber = trans.CertificateNumber,
                                DesignCode        = trans.DesignCode,
                                StonePcs          = trans.StonePcs,
                                KT = trans.KT,
                                JewelItemCategory   = trans.JewelItemCategory,
                                JewelNumber         = trans.JewelNumber,
                                JewelType           = trans.JewelType,
                                TotalWeight         = trans.TotalWeight,
                                MetalWeight         = trans.MetalWeight,
                                StoneWeight         = trans.StoneWeight,
                                Properties          = trans.Properties,
                                TransactionPartyRef = trans.TransactionPartyRef,
                                TransactionDate     = DateTime.Today,
                                TotalAmount         = trans.TotalAmount
                            };
                            clookup.JewelTransactions.Add(item);
                        }
                    }
                }
                if (clookup.JewelTransactions.Any())
                {
                    request.TransactionLookup = clookup;
                    var response = _transactionServices.CreateJewelTransaction(request);
                    ShowManagedModalForm <frmCostingConfirmation>(Owner as frmMDIParent, response.TransactionLookup);
                }
                else
                {
                    MessageBox.Show(Resources.frmManageTransaction_lnkRTS_LinkClicked_no_item_available_to_be_returned_);
                    return;
                }

                btnGo_Click(new Object(), new EventArgs());
            }
        }
Exemple #4
0
        private void CancelTransaction(int lookupid)
        {
            var isYes = MessageBox.Show(Resources.frmManageTransaction_lnkRTS_LinkClicked_Are_you_sure_want_to_return_stock_into_account, Resources.frmManageTransaction_lnkRTS_LinkClicked_Return_To_Stock, MessageBoxButtons.OKCancel) == DialogResult.OK;

            if (isYes)
            {
                var request = new JewelTransactionRequest();

                var lookup  = _transactionService.GetJewelTransactionsLookUp().Single(x => x.TransactionLookupId == lookupid);
                var clookup = new TransactionLookup
                {
                    Remarks             = lookup.Remarks,
                    TransactionPartyRef = lookup.TransactionPartyRef,
                    ContactName         = lookup.ContactName,
                    ReferenceMemoNumber = lookup.MemoNumber,
                    DocNumber           = lookup.DocNumber,
                    TransactionType     = TransactionType.SalesInReturnTransaction,
                    TransactionLookupId = 0,
                    TransactionDate     = DateTime.Now
                };

                foreach (var trans in lookup.JewelTransactions)
                {
                    var item = new JewelTransaction
                    {
                        CostingDetail     = trans.CostingDetail,
                        TransactionType   = TransactionType.SalesInReturnTransaction,
                        MetalColor        = trans.MetalColor,
                        CStonePcs         = trans.CStonePcs,
                        CStoneWeight      = trans.CStoneWeight,
                        CertificateNumber = trans.CertificateNumber,
                        DesignCode        = trans.DesignCode,
                        StonePcs          = trans.StonePcs,
                        KT = trans.KT,
                        JewelItemCategory   = trans.JewelItemCategory,
                        JewelNumber         = trans.JewelNumber,
                        JewelType           = trans.JewelType,
                        TotalWeight         = trans.TotalWeight,
                        MetalWeight         = trans.MetalWeight,
                        StoneWeight         = trans.StoneWeight,
                        Properties          = trans.Properties,
                        TransactionPartyRef = trans.TransactionPartyRef,
                        TransactionDate     = DateTime.Today,
                        TotalAmount         = trans.TotalAmount
                    };
                    clookup.JewelTransactions.Add(item);
                }

                if (clookup.JewelTransactions.Any())
                {
                    request.TransactionLookup = clookup;
                    var response = _transactionService.CreateJewelTransaction(request);
                    ShowManagedModalForm <frmCostingConfirmation>(Owner as frmMDIParent, response.TransactionLookup);
                }
                else
                {
                    MessageBox.Show(Resources.frmManageTransaction_lnkRTS_LinkClicked_no_item_available_to_be_returned_);
                    return;
                }

                FindTransaction();
            }
        }