예제 #1
0
        private void CreateTaskFromTask()
        {
            var cwCreateTask = new CWCreateTaskFromTask(api);

#if !SILVERLIGHT
            cwCreateTask.DialogTableId = 2000000105;
#endif
            cwCreateTask.Closed += async delegate
            {
                if (cwCreateTask.DialogResult == true)
                {
                    var       projLst   = dgProjectGrid.GetVisibleRows() as IList <Uniconta.DataModel.Project>;
                    BudgetAPI budgetApi = new BudgetAPI(api);
                    var       result    = await budgetApi.CreateTaskFromTask(CWCreateTaskFromTask.FromPrWorkSpace, CWCreateTaskFromTask.ToPrWorkSpace, CWCreateTaskFromTask.ProjectTemplate, CWCreateTaskFromTask.AddYear, projLst);

                    if (result != ErrorCodes.Succes)
                    {
                        UtilDisplay.ShowErrorCode(result);
                    }
                    else
                    {
                        UnicontaMessageBox.Show(string.Concat(Uniconta.ClientTools.Localization.lookup("Tasks"), " ", Uniconta.ClientTools.Localization.lookup("Created").ToLower()),
                                                Uniconta.ClientTools.Localization.lookup("Information"), MessageBoxButton.OK);
                    }
                }
            };
            cwCreateTask.Show();
        }
        private void CreateTaskFromTask()
        {
            var cwCreateTask = new CWCreateTaskFromTask(api, proj?._Number);

            cwCreateTask.DialogTableId = 2000000104;
            cwCreateTask.Closed       += async delegate
            {
                if (cwCreateTask.DialogResult == true)
                {
                    var taskLst = (IEnumerable <Uniconta.DataModel.ProjectTask>)dgProjectTaskGrid.GetVisibleRows();

                    BudgetAPI budgetApi = new BudgetAPI(api);
                    var       result    = await budgetApi.CreateTaskFromTask(CWCreateTaskFromTask.FromPrWorkSpace, CWCreateTaskFromTask.ToPrWorkSpace, cwCreateTask.ToProject, cwCreateTask.BudgetTaskDatePrincip, cwCreateTask.NewDate, CWCreateTaskFromTask.AddYear, taskLst);

                    if (result != ErrorCodes.Succes)
                    {
                        UtilDisplay.ShowErrorCode(result);
                    }
                    else
                    {
                        UnicontaMessageBox.Show(string.Concat(Uniconta.ClientTools.Localization.lookup("Tasks"), " ", Uniconta.ClientTools.Localization.lookup("Created").ToLower()),
                                                Uniconta.ClientTools.Localization.lookup("Information"), MessageBoxButton.OK);
                    }
                }
            };
            cwCreateTask.Show();
        }