private void btnRemoveFromList_Click(object sender, EventArgs e) { if (lst_GeneralChartOfAccountTypes.SelectedItems.Count == 0 || List_CashBoxTransactionType_GeneralChartOfAccountType == null) { return; } GeneralChartOfAccountType_cu selectedGerneralChartOfAccountType = (GeneralChartOfAccountType_cu)lst_GeneralChartOfAccountTypes.SelectedItem; if (selectedGerneralChartOfAccountType == null) { return; } if (List_SelectedGeneralChartOfAccountTypeToBedAdded.Exists( item => Convert.ToInt32(item.ID).Equals(Convert.ToInt32(selectedGerneralChartOfAccountType.ID)))) { List_SelectedGeneralChartOfAccountTypeToBedAdded.Remove(selectedGerneralChartOfAccountType); } CommonViewsActions.FillListBoxControl(lst_GeneralChartOfAccountTypes, List_SelectedGeneralChartOfAccountTypeToBedAdded); lst_GeneralChartOfAccountTypes.Refresh(); CashBoxTransactionType_GeneralChartOfAccountType_cu inventoryItemUnitMeasurment = List_CashBoxTransactionType_GeneralChartOfAccountType.Find( item => Convert.ToInt32(item.GeneralChartOfAccountType_CU_ID) .Equals(Convert.ToInt32(selectedGerneralChartOfAccountType.ID))); if (inventoryItemUnitMeasurment == null) { return; } List_CashBoxTransactionType_GeneralChartOfAccountType.Remove(inventoryItemUnitMeasurment); }
public override bool AfterSave() { GeneralChartOfAccountType_cu generalChartOfAccountType = (GeneralChartOfAccountType_cu)ActiveDBItem; if (generalChartOfAccountType == null) { return(false); } ChartOfAccount_GeneralChartOfAccountType_cu chartOfAccountGeneralChartOfAccount = DBCommon.CreateNewDBEntity <ChartOfAccount_GeneralChartOfAccountType_cu>(); if (chartOfAccountGeneralChartOfAccount == null) { return(false); } if (ChartOfAccount_CU_ID != null) { chartOfAccountGeneralChartOfAccount.ChartOfAccount_CU_ID = Convert.ToInt32(ChartOfAccount_CU_ID); } chartOfAccountGeneralChartOfAccount.GeneralChartOfAccountType_CU_ID = generalChartOfAccountType.ID; if (UserID != null) { chartOfAccountGeneralChartOfAccount.InsertedBy = Convert.ToInt32(UserID); } chartOfAccountGeneralChartOfAccount.IsOnDuty = true; switch (((IGeneralChartOfAccountTypeViewer)ActiveCollector.ActiveViewer).CommonTransactionType) { case DB_CommonTransactionType.DeleteExisting: chartOfAccountGeneralChartOfAccount.IsOnDuty = false; break; } chartOfAccountGeneralChartOfAccount.SaveChanges(); DB_CashBoxTransactionType privateGeneralChartOfAccountType = (DB_CashBoxTransactionType)generalChartOfAccountType.GeneralChartOfAccountType_P_ID; List <CashBoxTransactionType_GeneralChartOfAccountType_p> privateList = CashBoxTransactionType_GeneralChartOfAccountType_p.ItemsList.FindAll( item => Convert.ToInt32(item.GeneralChartOfAccountType_P_ID).Equals(Convert.ToInt32(privateGeneralChartOfAccountType))); if (privateList.Count == 0) { return(false); } CashBoxTransactionType_GeneralChartOfAccountType_cu cashBoxTransactionTypeGeneralChartOfAccountType = null; foreach (CashBoxTransactionType_GeneralChartOfAccountType_p cashBoxTransactionTypeGeneralChartOfAccountTypeP in privateList) { cashBoxTransactionTypeGeneralChartOfAccountType = DBCommon.CreateNewDBEntity <CashBoxTransactionType_GeneralChartOfAccountType_cu>(); if (cashBoxTransactionTypeGeneralChartOfAccountType == null) { return(false); } cashBoxTransactionTypeGeneralChartOfAccountType.CashBoxTransactionType_P_ID = cashBoxTransactionTypeGeneralChartOfAccountTypeP.CashBoxTransactionType_P_ID; cashBoxTransactionTypeGeneralChartOfAccountType.GeneralChartOfAccountType_CU_ID = generalChartOfAccountType.ID; if (UserID != null) { cashBoxTransactionTypeGeneralChartOfAccountType.InsertedBy = Convert.ToInt32(UserID); } cashBoxTransactionTypeGeneralChartOfAccountType.IsOnDuty = true; switch (((IGeneralChartOfAccountTypeViewer)ActiveCollector.ActiveViewer).CommonTransactionType) { case DB_CommonTransactionType.DeleteExisting: cashBoxTransactionTypeGeneralChartOfAccountType.IsOnDuty = false; break; } cashBoxTransactionTypeGeneralChartOfAccountType.SaveChanges(); } if (cashBoxTransactionTypeGeneralChartOfAccountType != null) { cashBoxTransactionTypeGeneralChartOfAccountType.LoadItemsList(); } return(true); }
private void gridView2_MouseUp(object sender, MouseEventArgs e) { SelectedGeneralChartOfAccountTypeFromGrid = CommonViewsActions.GetSelectedRowObject <GeneralChartOfAccountType_cu>((GridView)sender); }