private void OpenChartOfAccount() { DateTime fromDate = DateTime.MinValue, toDate = DateTime.MinValue; var budgetMaster = this.master as GLBudget; if (budgetMaster != null) { fromDate = budgetMaster._FromDate; toDate = budgetMaster._ToDate; } CWBudgetLineDialog objCWBudgetLineDialog = new CWBudgetLineDialog(api, fromDate, toDate); objCWBudgetLineDialog.Closed += delegate { if (objCWBudgetLineDialog.DialogResult == true) { var Cache = api.GetCache(typeof(Uniconta.DataModel.GLAccount)); if (Cache == null) { return; } var fromAccount = objCWBudgetLineDialog.fromAccount; if (fromAccount == null) { fromAccount = string.Empty; } var toAccount = objCWBudgetLineDialog.toAccount; if (toAccount == string.Empty) { toAccount = null; } var gridData = (IEnumerable <GLBudgetLine>)dgGLBudgetLine.ItemsSource; if (gridData.Count() == 1) { dgGLBudgetLine.SelectedItem = gridData.FirstOrDefault(); dgGLBudgetLine.DeleteRow(); } foreach (var acc in (Uniconta.DataModel.GLAccount[])Cache.GetKeyStrRecords) { var Account = acc._Account; if (string.Compare(Account, fromAccount) >= 0 && (toAccount == null || string.Compare(Account, toAccount) <= 0)) { var objGLBudgetLineClient = new GLBudgetLineClient(); StreamingManager.Copy(objCWBudgetLineDialog.editrow, objGLBudgetLineClient); objGLBudgetLineClient._Account = Account; dgGLBudgetLine.AddRow(objGLBudgetLineClient, -1, false); } } } }; objCWBudgetLineDialog.Show(); }
static GLBudgetLineClient createPost(GLBudgetLine rec, CrudAPI api) { var post = new GLBudgetLineClient(); post.SetMaster(api.CompanyEntity); post._BudgetId = rec._BudgetId; post._Account = rec._Account; post._Comment = rec._Comment; post._Dim1 = rec._Dim1; post._Dim2 = rec._Dim2; post._Dim3 = rec._Dim3; post._Dim4 = rec._Dim4; post._Dim5 = rec._Dim5; return(post); }