//public static Operation<List<PermissionMaster>> GetPermissionMasters() //{ // IServiceGate<List<PermissionMaster>> sw = GateHandler.GetServiceGate<List<PermissionMaster>>(); // string method = "GetPermissionMasters"; // Operation<List<PermissionMaster>> op_ = sw.Get(method); // return op_; //} //public static Operation<List<PermissionDetail>> GetPermissionDetailsByUserId(int UserId) //{ // IServiceGate<List<PermissionDetail>> sw = GateHandler.GetServiceGate<List<PermissionDetail>>(); // string method = "GetPermissionDetailsByUserId/{0}"; // method = string.Format(method, UserId); // Operation<List<PermissionDetail>> op_ = sw.Get(method); // return op_; //} public static Operation <CardFiche> PostCardFiche(CardFiche cardFiche) { ServiceClient client = new ServiceClient(); Dictionary <string, object> prms = new Dictionary <string, object>(); prms["cardFiche"] = cardFiche; Operation <CardFiche> operation = client.Post <CardFiche>("PostCardFiche", prms); return(operation); }
public Operation <CardFiche> GetCardFicheById(string Id) { Operation <CardFiche> op_fiche = new Operation <CardFiche>(); try { CardFiche fiche = connection.Get <CardFiche>(Id); fiche.Lines = connection.Query <CardFicheLine>("SELECT * FROM CardFicheLine WHERE CardFicheId = " + Id).ToList(); op_fiche.Value = fiche; op_fiche.Successful = true; } catch (Exception ex) { op_fiche.Fail = ex.Message; } return(op_fiche); }
private void btnOk_Click(object sender, EventArgs e) { cardFiche = ficheBindTool.DataObject; creditLine = creditLineBindTool.DataObject; debitLine = debitLineBindTool.DataObject; creditLine.SignType = -1; debitLine.SignType = 1; cardFiche.Lines = new List <CardFicheLine> { creditLine, debitLine }; Operation <CardFiche> postedCashTransaction = OperationHandler.PostCardFiche(cardFiche); if (postedCashTransaction.Successful) { this.Close(); } SetError(postedCashTransaction.Fail, false); }
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(); }
public Operation <CardFiche> PostCardFiche(CardFiche fiche) { using (IDbConnection dbConnection = connection) { Operation <CardFiche> operation = new Operation <CardFiche>(); try { if (fiche.Id == 0) { fiche.Ficheno = GetNewNumber(5); } DapperRepo dapper = new DapperRepo(); dapper.Post(fiche); if (fiche.Lines.Count > 0) { fiche.Lines[0].CardFicheId = fiche.Id; fiche.Lines[0].CurrencyId = GetCardById(fiche.Lines[0].CardId.ToString()).Value.CurrencyId; dapper.Post(fiche.Lines[0]); } if (fiche.Lines.Count > 1) { fiche.Lines[1].CardFicheId = fiche.Id; fiche.Lines[1].CurrencyId = GetCardById(fiche.Lines[1].CardId.ToString()).Value.CurrencyId; dapper.Post(fiche.Lines[1]); } operation.Value = fiche; operation.Successful = true; } catch (Exception ex) { operation.Fail = ex.Message; } return(operation); } }
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; //} }