private void tsAcceptCashTran_Click(object sender, EventArgs e) { if (gvData.GetFocusedRow() is CardFicheLineView lineView) { DialogResult dialogResult = XtraMessageBox.Show("Əminsinizmi?", "Kassa Tranzaksiya", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { CardFiche cardFiche = OperationHandler.GetCardFicheById(lineView.CardFicheId).Value; cardFiche.StatusId = 12; var oper = OperationHandler.PostCardFiche(cardFiche); if (oper.Successful) { XtraMessageBox.Show("Təhvil alındı"); } else { XtraMessageBox.Show("Səhvlik oldu " + oper.Fail); } } } RefreshData(); }
private void Manp_CardTransaction_Shown(object sender, EventArgs e) { if (!IsEditMode) { foreach (Control c in grpCenter.Controls) { c.Enabled = false; } btnOk.Enabled = false; } List <IBaseOperation> loadOperations = new List <IBaseOperation>(); IBaseOperation baseOperation = dataHolder.LoadEnumData(); loadOperations.Add(baseOperation); Operation <List <CardView> > op_CardMaster = OperationHandler.GetCardsByUserId(StaticData.CurrentUserId); loadOperations.Add(op_CardMaster); if (Id != 0) { Operation <CardFiche> op_ExistingCardFiche = OperationHandler.GetCardFicheById(Id); loadOperations.Add(op_ExistingCardFiche); cardFiche = op_ExistingCardFiche.Value; creditLine = cardFiche.Lines.Where(x => x.SignType < 0).FirstOrDefault(); debitLine = cardFiche.Lines.Where(x => x.SignType > 0).FirstOrDefault(); } else { cardFiche = new CardFiche(); cardFiche.CreatedDate = DateTime.Now; cardFiche.CreatedBy = StaticData.CurrentUserId; cardFiche.StatusId = 11; } foreach (IBaseOperation ibop in loadOperations) { if (!ibop.Successful) { SetError(ibop.Fail); return; } } Cards = op_CardMaster.Value; CashTypes = dataHolder.CashTypes; lookUpCashType.Properties.DataSource = CashTypes; searchLookUpSourceCard.Properties.DataSource = Cards; searchLookUpDestCard.Properties.DataSource = Cards; ficheBindTool.BindControl(lookUpCashType, nameof(cardFiche.CashTypeId)); ficheBindTool.BindControl(txtNote, nameof(cardFiche.Note)); ficheBindTool.BindControl(txtFicheno, nameof(cardFiche.Ficheno)); if (creditLine == null) { creditLine = new CardFicheLine(); } creditLineBindTool.BindControl(searchLookUpSourceCard, nameof(creditLine.CardId)); creditLineBindTool.BindControl(sourceCurrencyRate, nameof(creditLine.CurrencyRate)); creditLineBindTool.BindControl(sourceAmount, nameof(creditLine.Total)); if (debitLine == null) { debitLine = new CardFicheLine(); } debitLineBindTool.BindControl(searchLookUpDestCard, nameof(debitLine.CardId)); debitLineBindTool.BindControl(destCurrencyRate, nameof(debitLine.CurrencyRate)); debitLineBindTool.BindControl(destAmount, nameof(debitLine.Total)); ficheBindTool.DataObject = cardFiche; creditLineBindTool.DataObject = creditLine; debitLineBindTool.DataObject = debitLine; txtDate.Text = cardFiche.CreatedDate.ToString(StaticData.DateTimeFromatStr); ControlCurrencies(); //if (injected) //{ // //CardView sourceCard = Cards.Where(x => x.Id == sourceCardId).FirstOrDefault(); // //lookUpCurrency.EditValue = sourceCard?.CurrencyId; // //searchLookUpSourceCard.EditValue = sourceCard?.Id; // //searchLookUpDestCard.EditValue = destCardId; // //sourceAmount.EditValue = amount; // //txtNote.Text = note; // ////lookUpCurrency.ReadOnly = true; // //cashTransaction.ConnectedFicheId = connectedInvoiceId; //} }