Exemplo n.º 1
0
 public static void _SA_Open(PROJECT ProjectRecord)
 {
     if (!ProjectLedger.repo.SelfInfo.Exists())
     {
         ProjectLedger._SA_Invoke();
     }
     ProjectLedger.repo.SelectRecord.Select(ProjectRecord.name);
 }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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();
            }
        }
Exemplo n.º 4
0
        // DataFile
        public static void DataFile_ReadFile(string sDataLocation, string fileCounter)
        {
            StreamReader FileHDR; // File handle for Project tab info
            StreamReader FileDT1; // File handle for the Additional Info tab info
            StreamReader FileCNT; // File handle for the Additional Info tab info
            StreamReader FileDT2; // File handle for the Additional Info tab info

            string dataLine;      // Stores the current field data from file
            string dataPath;      // The name and path to the data files location

            dataPath = sDataLocation + "PL" + fileCounter;

            List <PROJECT> lProjects = new List <PROJECT>();

            FileHDR = new StreamReader(Functions.FileOpen(dataPath + EXTENSION_HEADER, "FM_READ"));
            while ((dataLine = FileHDR.ReadLine()) != null)
            {
                PROJECT Proj = new PROJECT();

                // Set header info
                Proj = DataFile_setDataStructure(EXTENSION_HEADER, dataLine, Proj);

                // Only open budget details file exists
                if (File.Exists(dataPath + EXTENSION_BUDGET))
                {
                    using (FileDT1 = new StreamReader(Functions.FileOpen(dataPath + EXTENSION_BUDGET, "FM_READ")))
                    {
                        while ((dataLine = FileDT1.ReadLine()) != null)
                        {
                            Proj = DataFile_setDataStructure(EXTENSION_BUDGET, dataLine, Proj);
                        }
                    }
                }

                // Only open budget container file exists
                if (File.Exists(dataPath + EXTENSION_BUDGET_TABLE))
                {
                    using (FileCNT = new StreamReader(Functions.FileOpen(dataPath + EXTENSION_BUDGET_TABLE, "FM_READ")))
                    {
                        while ((dataLine = FileCNT.ReadLine()) != null)
                        {
                            Proj = DataFile_setDataStructure(EXTENSION_BUDGET_TABLE, dataLine, Proj);
                        }
                    }
                }

                // Open Additional file and set structure
                if (File.Exists(dataPath + EXTENSION_ADDITIONAL_INFO))
                {
                    using (FileDT2 = new StreamReader(Functions.FileOpen(dataPath + EXTENSION_ADDITIONAL_INFO, "FM_READ")))
                    {
                        while ((dataLine = FileDT2.ReadLine()) != null)
                        {
                            Proj = DataFile_setDataStructure(EXTENSION_ADDITIONAL_INFO, dataLine, Proj);
                        }
                    }
                }

                lProjects.Add(Proj);
            }
            FileHDR.Close();

            foreach (PROJECT pj in lProjects)
            {
                switch (pj.action)
                {
                case "A":
                    ProjectLedger._SA_Create(pj);
                    break;

                case "B":
                    ProjectLedger._SA_Create(pj, true, true);
                    break;

                case "D":
                    ProjectLedger._SA_Delete(pj);
                    break;

                default:
                {
                    Functions.Verify(false, true, "Valid action sent for record");
                    break;
                }
                }
            }
            ProjectLedger._SA_Close();
        }
Exemplo n.º 5
0
        // need to add repository first
        // public static ProjectLedgerResFolders

        public static void _SA_Invoke()
        {
            ProjectLedger._SA_Invoke(true);
        }
Exemplo n.º 6
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);
        }