예제 #1
0
        public static void _SA_Delete(PROJECT ProjectRecord)
        {
            if (!ProjectLedger.repo.SelfInfo.Exists())
            {
                ProjectLedger._SA_Invoke();
            }

            if (ProjectLedger.repo.SelectRecord.SelectedItemText != ProjectRecord.name)
            {
                ProjectLedger._SA_Open(ProjectRecord);
            }

            //ProjectLedger.repo.ClickRemove(); // remove method to be updated

            //SimplyMessage.Instance._SA_HandleMessage(SimplyMessage.YES_LOC, SimplyMessage._MSG_AREYOUSUREYOUWANTTOREMOVE_LOC, true);
        }
예제 #2
0
        public static void _SA_Create(PROJECT ProjectRecord, bool bSave, bool bEdit)
        {
            if (!Variables.bUseDataFiles && !bEdit)
            {
                ProjectLedger._SA_MatchDefaults(ProjectRecord);
            }

            if (!ProjectLedger.repo.SelfInfo.Exists())
            {
                ProjectLedger._SA_Invoke();
            }

            if (bEdit)
            {
                if (ProjectLedger.repo.SelectRecord.SelectedItemText != ProjectRecord.name)
                {
                    ProjectLedger._SA_Open(ProjectRecord);
                }

                if (Functions.GoodData(ProjectRecord.nameEdit))
                {
                    ProjectLedger.repo.Project.ProjectName.TextValue = ProjectRecord.nameEdit;
                    ProjectRecord.name = ProjectRecord.nameEdit;
                }

                // print to log or results
                Ranorex.Report.Info(String.Format("Modifying project {0}", ProjectRecord.name));
            }
            else
            {
                ProjectLedger.repo.CreateANewToolButton.Click();
                ProjectLedger.repo.Project.ProjectName.TextValue = ProjectRecord.name;
                Ranorex.Report.Info(String.Format("Creating project {0}", ProjectRecord.name));
            }

            // Project tab
            ProjectLedger.repo.Project.Tab.Click();
            if (Functions.GoodData(ProjectRecord.startDate))
            {
                ProjectLedger.repo.Project.StartDate.TextValue = ProjectRecord.startDate;
            }

            if (Functions.GoodData(ProjectRecord.endDate))
            {
                ProjectLedger.repo.Project.EndDate.TextValue = ProjectRecord.endDate;
            }

            if (Functions.GoodData(ProjectRecord.revenue))
            {
                ProjectLedger.repo.Project.Revenue.TextValue = ProjectRecord.revenue;
            }

            if (Functions.GoodData(ProjectRecord.expense))
            {
                ProjectLedger.repo.Project.Expense.TextValue = ProjectRecord.expense;
            }

            if (ProjectRecord.status != 0)
            {
                ProjectLedger.repo.Project.Status.Items[((int)ProjectRecord.status)].Select();
            }

            if (Functions.GoodData(ProjectRecord.inactiveCheckBox))
            {
                ProjectLedger.repo.InactiveProject.SetState(ProjectRecord.inactiveCheckBox);
            }

            // check if budget tab exists, will take a long time since object times are acccumalitive
            if (ProjectLedger.repo.Budget.TabInfo.Exists())
            {
                ProjectLedger.repo.Budget.Tab.Click();

                if (Functions.GoodData(ProjectRecord.budgetCheckBox))
                {
                    ProjectLedger.repo.Budget.BudgetThisProject.SetState(ProjectRecord.budgetCheckBox);

                    // Budget details
                    if (ProjectLedger.repo.Budget.BudgetThisProject.Enabled)
                    {
                        int BUDGET_REVENUE_COLUMN  = 2;
                        int BUDGET_EXPENSES_COLUMN = 3;

                        ProjectLedger.repo.Budget.BudgetContainer.ClickFirstCell();

                        for (int x = 0; x < ProjectRecord.Budgets.Count; x++)
                        {
                            if (Functions.GoodData(ProjectRecord.Budgets[x].revenue))
                            {
                                ProjectLedger.repo.Budget.BudgetContainer.MoveToField(x, BUDGET_REVENUE_COLUMN);
                                ProjectLedger.repo.Budget.BudgetContainer.SetText(ProjectRecord.Budgets[x].revenue);
                            }

                            if (Functions.GoodData(ProjectRecord.Budgets[x].expense))
                            {
                                ProjectLedger.repo.Budget.BudgetContainer.MoveToField(x, BUDGET_EXPENSES_COLUMN);
                                ProjectLedger.repo.Budget.BudgetContainer.SetText(ProjectRecord.Budgets[x].expense);
                            }
                        }
                    }
                }
            }


            // Additional info
            ProjectLedger.repo.AdditionalInfo.Tab.Click();

            if (ProjectLedger.repo.AdditionalInfo.Additional1Info.Exists())
            {
                if (Functions.GoodData(ProjectRecord.additional1))
                {
                    ProjectLedger.repo.AdditionalInfo.Additional1.TextValue = ProjectRecord.additional1;
                }

                if (Functions.GoodData(ProjectRecord.addCheckBox1))
                {
                    ProjectLedger.repo.AdditionalInfo.AddCheckBox1.SetState(ProjectRecord.addCheckBox1);
                }
            }

            if (ProjectLedger.repo.AdditionalInfo.Additional2Info.Exists())
            {
                if (Functions.GoodData(ProjectRecord.additional2))
                {
                    ProjectLedger.repo.AdditionalInfo.Additional2.TextValue = ProjectRecord.additional2;
                }

                if (Functions.GoodData(ProjectRecord.addCheckBox2))
                {
                    ProjectLedger.repo.AdditionalInfo.AddCheckBox2.SetState(ProjectRecord.addCheckBox2);
                }
            }

            if (ProjectLedger.repo.AdditionalInfo.Additional3Info.Exists())
            {
                if (Functions.GoodData(ProjectRecord.additional3))
                {
                    ProjectLedger.repo.AdditionalInfo.Additional3.TextValue = ProjectRecord.additional3;
                }

                if (Functions.GoodData(ProjectRecord.addCheckBox3))
                {
                    ProjectLedger.repo.AdditionalInfo.AddCheckBox3.SetState(ProjectRecord.addCheckBox3);
                }
            }

            if (ProjectLedger.repo.AdditionalInfo.Additional4Info.Exists())
            {
                if (Functions.GoodData(ProjectRecord.additional4))
                {
                    ProjectLedger.repo.AdditionalInfo.Additional4.TextValue = ProjectRecord.additional4;
                }

                if (Functions.GoodData(ProjectRecord.addCheckBox4))
                {
                    ProjectLedger.repo.AdditionalInfo.AddCheckBox2.SetState(ProjectRecord.addCheckBox4);
                }
            }

            if (ProjectLedger.repo.AdditionalInfo.Additional5Info.Exists())
            {
                if (Functions.GoodData(ProjectRecord.additional5))
                {
                    ProjectLedger.repo.AdditionalInfo.Additional5.TextValue = ProjectRecord.additional5;
                }

                if (Functions.GoodData(ProjectRecord.addCheckBox5))
                {
                    ProjectLedger.repo.AdditionalInfo.AddCheckBox2.SetState(ProjectRecord.addCheckBox5);
                }
            }

            if (bSave)
            {
                ProjectLedger.repo.Save.Click();
            }
        }
예제 #3
0
        public static PROJECT _SA_Read(string sIDToRead)
        {
            PROJECT ProjectRecord = new PROJECT();

            if (Functions.GoodData(sIDToRead))
            {
                ProjectRecord.name = sIDToRead;
                if (ProjectLedger.repo.SelectRecord.SelectedItemText != ProjectRecord.name)
                {
                    ProjectLedger._SA_Open(ProjectRecord);
                }
            }

            ProjectLedger.repo.Project.Tab.Click();
            ProjectRecord.startDate        = ProjectLedger.repo.Project.StartDate.TextValue;
            ProjectRecord.endDate          = ProjectLedger.repo.Project.EndDate.TextValue;
            ProjectRecord.revenue          = ProjectLedger.repo.Project.Revenue.TextValue;
            ProjectRecord.expense          = ProjectLedger.repo.Project.Expense.TextValue;
            ProjectRecord.status           = (PROJECT_STATUS)ProjectLedger.repo.Project.Status.SelectedItemIndex;
            ProjectRecord.inactiveCheckBox = ProjectLedger.repo.InactiveProject.Checked;

            if (ProjectLedger.repo.Budget.TabInfo.Exists())
            {
                ProjectLedger.repo.Budget.Tab.Click();
                ProjectRecord.budgetCheckBox = ProjectLedger.repo.Budget.BudgetThisProject.Checked;
                // Read grid
                if (ProjectRecord.budgetCheckBox == true)
                {
                    //ProjectLedger.repo.Budget.BudgetContainer.InitializeTable();

                    List <List <string> > lsContents = ProjectLedger.repo.Budget.BudgetContainer.GetContents();
                    for (int i = 0; i < lsContents.Count; i++)
                    {
                        PROJECT_BUDGET PB = new PROJECT_BUDGET();
                        PB.revenue = lsContents[i][i];
                        PB.expense = lsContents[1][2];

                        ProjectRecord.Budgets.Add(PB);
                    }
                }
            }

            ProjectLedger.repo.AdditionalInfo.Tab.Click();
            if (ProjectLedger.repo.AdditionalInfo.Additional1Info.Exists())
            {
                ProjectRecord.additional1 = ProjectLedger.repo.AdditionalInfo.Additional1.TextValue;
            }

            if (ProjectLedger.repo.AdditionalInfo.AddCheckBox1Info.Exists())
            {
                ProjectRecord.addCheckBox1 = ProjectLedger.repo.AdditionalInfo.AddCheckBox1.Checked;
            }

            if (ProjectLedger.repo.AdditionalInfo.Additional2Info.Exists())
            {
                ProjectRecord.additional2 = ProjectLedger.repo.AdditionalInfo.Additional2.TextValue;
            }

            if (ProjectLedger.repo.AdditionalInfo.AddCheckBox2Info.Exists())
            {
                ProjectRecord.addCheckBox2 = ProjectLedger.repo.AdditionalInfo.AddCheckBox2.Checked;
            }

            if (ProjectLedger.repo.AdditionalInfo.Additional3Info.Exists())
            {
                ProjectRecord.additional3 = ProjectLedger.repo.AdditionalInfo.Additional3.TextValue;
            }

            if (ProjectLedger.repo.AdditionalInfo.AddCheckBox3Info.Exists())
            {
                ProjectRecord.addCheckBox3 = ProjectLedger.repo.AdditionalInfo.AddCheckBox3.Checked;
            }

            if (ProjectLedger.repo.AdditionalInfo.Additional4Info.Exists())
            {
                ProjectRecord.additional4 = ProjectLedger.repo.AdditionalInfo.Additional4.TextValue;
            }

            if (ProjectLedger.repo.AdditionalInfo.AddCheckBox4Info.Exists())
            {
                ProjectRecord.addCheckBox4 = ProjectLedger.repo.AdditionalInfo.AddCheckBox4.Checked;
            }

            if (ProjectLedger.repo.AdditionalInfo.Additional5Info.Exists())
            {
                ProjectRecord.additional5 = ProjectLedger.repo.AdditionalInfo.Additional5.TextValue;
            }

            if (ProjectLedger.repo.AdditionalInfo.AddCheckBox5Info.Exists())
            {
                ProjectRecord.addCheckBox5 = ProjectLedger.repo.AdditionalInfo.AddCheckBox5.Checked;
            }

            return(ProjectRecord);
        }