private void Manp_CurrencyByDate_Shown(object sender, EventArgs e) { dataHolder.LoadEnumData(); dateOfCurrency.DateTime = DateTime.Today; lookUpCurrency.Properties.DataSource = dataHolder.Currencies; bindTool.BindControl(dateOfCurrency, nameof(currencyByDate.Date)); bindTool.BindControl(lookUpCurrency, nameof(currencyByDate.CurrencyId)); bindTool.BindControl(spRate, nameof(currencyByDate.Rate)); }
private void Manp_Cards_Shown(object sender, EventArgs e) { dataHolder.LoadEnumData(); lookUpCardType.Properties.DataSource = dataHolder.CardTypes; lookUpCurrency.Properties.DataSource = dataHolder.Currencies; if (Id == 0) { card = new Card(); chkActive.Checked = true; } else { // GET DATA Operation <Card> op_card = OperationHandler.GetCardById(Id); if (!op_card.Successful) { OnLoadError(op_card.Fail); return; } card = op_card.Value; lookUpCardType.Enabled = false; lookUpCurrency.Enabled = false; } bindTool.BindControl(lookUpCardType, nameof(card.CardTypeId)); bindTool.BindControl(txtCardCode, nameof(card.CardNumber)); bindTool.BindControl(txtCardName, nameof(card.CardName)); bindTool.BindControl(lookUpCurrency, nameof(card.CurrencyId)); bindTool.BindControl(txtTel1, nameof(card.Phone1)); bindTool.BindControl(txtTel2, nameof(card.Phone2)); bindTool.BindControl(txtTel3, nameof(card.Phone3)); bindTool.BindControl(txtTaxCode, nameof(card.TaxCode)); bindTool.BindControl(txtCountry, nameof(card.Country)); bindTool.BindControl(txtCity, nameof(card.City)); bindTool.BindControl(txtTown, nameof(card.Town)); bindTool.BindControl(txtDistrict, nameof(card.District)); bindTool.BindControl(txtLocationAddress, nameof(card.LocationAddress)); bindTool.BindControl(spDebtLimit, nameof(card.DebtLimit)); bindTool.BindControl(chkActive, nameof(card.IsActive)); bindTool.DataObject = card; }
private void Manp_Items_Shown(object sender, EventArgs e) { DataHolder dataHolder = new DataHolder(); IBaseOperation loadOperation = dataHolder.LoadEnumData(); if (!loadOperation.Successful) { OnLoadError(loadOperation.Fail); return; } lookUpItemType.Properties.DataSource = dataHolder.ItemTypes; lookupPriceCalcType.Properties.DataSource = dataHolder.LineCalcTypes; if (Id == 0) { Item = new Item(); } else { // GET DATA Operation <Item> op_item = OperationHandler.GetItemById(Id); if (!op_item.Successful) { OnLoadError(op_item.Fail); return; } Item = op_item.Value; lookUpItemType.Enabled = false; } bindTool.BindControl(txtGroup1, nameof(Item.Group1)); bindTool.BindControl(txtGroup2, nameof(Item.Group2)); bindTool.BindControl(txtGroup3, nameof(Item.Group3)); bindTool.BindControl(txtGroup4, nameof(Item.Group4)); bindTool.BindControl(txtItemCode, nameof(Item.ItemCode)); bindTool.BindControl(txtItemName, nameof(Item.ItemName)); bindTool.BindControl(lookUpItemType, nameof(Item.ItemTypeId)); bindTool.BindControl(lookupPriceCalcType, nameof(Item.LineCalcTypeId)); bindTool.BindControl(spLength, nameof(Item.Length)); bindTool.BindControl(spWidth, nameof(Item.Width)); bindTool.BindControl(chkIsLineService, nameof(Item.IsLineService)); bindTool.DataObject = Item; }
private void Manp_FichesNew_Shown(object sender, EventArgs e) { btnAddCashTran.Enabled = btnDistributeExpences.Enabled = btnOk.Enabled = searchLookUpCard.Enabled = lookUpWarehouse.Enabled = IsEditMode; dataHolder = new DataHolder(); IBaseOperation loadOper = dataHolder.LoadEnumData(); if (!loadOper.Successful) { SetError(loadOper.Fail); return; } loadOper = dataHolder.LoadMasterData(); if (!loadOper.Successful) { SetError(loadOper.Fail); return; } searchLookUpCard.Properties.DataSource = dataHolder.Cards; rpLookupItem.DataSource = dataHolder.Items; rpLookupItem.DisplayMember = "ItemName"; rpLookupItem.ValueMember = "Id"; lookUpWarehouse.Properties.DataSource = dataHolder.Warehouses; foreach (ItemView item in dataHolder.Items.Where(x => x.IsLineService)) { ToolStripMenuItem menuItem = new ToolStripMenuItem(); menuItem.Tag = item.Id; menuItem.Text = item.ItemName; menuItem.Click += SrvBlukMenuItem_Click; tsBulkAddServices.DropDownItems.Add(menuItem); } if (isNew) { Fiche = new FicheMasterView(); Fiche.Lines = new List <FicheLineView>(); } else { Operation <FicheMasterView> op_ExistingFiche = OperationHandler.GetFicheById(Id); if (!op_ExistingFiche.Successful) { SetError(op_ExistingFiche.Fail); return; } Fiche = op_ExistingFiche.Value; txtDate.Text = Fiche.CreatedDate.ToString("dd.MM.yyyy"); DocumentType = dataHolder.DocumentTypes.Where(x => x.Id == Fiche.DocTypeId).First(); if (CreateInvoiceFromOrderFiche) { Fiche.SourceDocument = Fiche.Ficheno; Id = Fiche.Id = 0; Fiche.DocTypeId = 2; btnOk.Text = "Fakturala"; } } if (DocumentType.Id == 1 || DocumentType.Id == 2) { gvLines.Columns["LineExpense"].Visible = false; tabNavigationExpencesPage.PageVisible = false; } else { gvLines.Columns["LineServicesTotal"].Visible = false; gvLines.Columns["IsCustomerItem"].Visible = false; gvLines.Columns["IsSketched"].Visible = false; gvLines.Columns["IsTemplated"].Visible = false; gcServicesOfLine.Visible = false; gcLines.ContextMenuStrip = null; tabNavigationExpencesPage.PageVisible = true; } bindTool.BindControl(searchLookUpCard, nameof(Fiche.CardId)); bindTool.BindControl(lookUpWarehouse, nameof(Fiche.SourceWarehouse)); bindTool.BindControl(txtFicheno, nameof(Fiche.Ficheno)); bindTool.BindControl(txtNote1, nameof(Fiche.Note1)); bindTool.BindControl(txtNote2, nameof(Fiche.Note2)); bindTool.BindControl(txtNote3, nameof(Fiche.Note3)); bindTool.BindControl(txtNote4, nameof(Fiche.Note4)); bindTool.BindControl(txtSourceDoc, nameof(Fiche.SourceDocument)); bindTool.BindControl(spCurrencyRate, nameof(Fiche.CurrencyRate)); bindTool.DataObject = Fiche; if (dataHolder.Warehouses.Count > 0) { lookUpWarehouse.EditValue = dataHolder.Warehouses.First().Number; } gcLines.DataSource = null; gcLines.DataSource = Fiche.Lines; // gcLines.DataSource = Fiche.FicheLines; //cmbItemType.SelectedIndex = 0; RefreshCashTrans(); }
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; //} }