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(); }