예제 #1
0
        public static PROJECT DataFile_setDataStructure(string extension, string dataLine, PROJECT Proj)
        {
            PROJECT ProjectRecord = Proj;

            switch (extension.ToUpper())
            {
            case EXTENSION_HEADER:
                ProjectRecord.action           = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 1));
                ProjectRecord.name             = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 2));
                ProjectRecord.startDate        = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 3));
                ProjectRecord.revenue          = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 4));
                ProjectRecord.expense          = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 5));
                ProjectRecord.inactiveCheckBox = ConvertFunctions.StringToBool(Functions.GetField(dataLine, ",", 6));
                ProjectRecord.endDate          = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 7));

                switch (Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 8)))
                {
                case "Pending":
                    ProjectRecord.status = PROJECT_STATUS.PROJECT_PENDING;
                    break;

                case "In Progress":
                    ProjectRecord.status = PROJECT_STATUS.PROJECT_IN_PROGRESS;
                    break;

                case "Cancelled":
                    ProjectRecord.status = PROJECT_STATUS.PROJECT_CANCELLED;
                    break;

                case "Completed":
                    ProjectRecord.status = PROJECT_STATUS.PROJECT_COMPLETED;
                    break;

                default:
                {
                    Functions.Verify(false, true, "Valid value for project status");
                    break;
                }
                }
                ProjectRecord.nameEdit = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 9));
                break;

            case EXTENSION_BUDGET:
                if (ProjectRecord.name == Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 1)))
                {
                    ProjectRecord.budgetCheckBox = ConvertFunctions.StringToBool(Functions.GetField(dataLine, ",", 2));
                }
                break;

            case EXTENSION_BUDGET_TABLE:
                if (ProjectRecord.name == Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 1)))
                {
                    PROJECT_BUDGET PB = new PROJECT_BUDGET();
                    PB.revenue = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 3));
                    PB.expense = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 4));
                    if (Functions.GoodData(ProjectRecord.Budgets))
                    {
                        ProjectRecord.Budgets.Add(PB);
                    }
                    else
                    {
                        ProjectRecord.Budgets = new List <PROJECT_BUDGET> {
                            PB
                        };
                    }
                }
                break;

            case EXTENSION_ADDITIONAL_INFO:
                if (ProjectRecord.name == Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 1)))
                {
                    ProjectRecord.additional1  = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 2));
                    ProjectRecord.additional2  = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 3));
                    ProjectRecord.additional3  = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 4));
                    ProjectRecord.additional4  = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 5));
                    ProjectRecord.additional5  = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 6));
                    ProjectRecord.addCheckBox1 = ConvertFunctions.StringToBool(Functions.GetField(dataLine, ",", 7));
                    ProjectRecord.addCheckBox2 = ConvertFunctions.StringToBool(Functions.GetField(dataLine, ",", 8));
                    ProjectRecord.addCheckBox3 = ConvertFunctions.StringToBool(Functions.GetField(dataLine, ",", 9));
                    ProjectRecord.addCheckBox4 = ConvertFunctions.StringToBool(Functions.GetField(dataLine, ",", 10));
                    ProjectRecord.addCheckBox5 = ConvertFunctions.StringToBool(Functions.GetField(dataLine, ",", 11));
                }
                break;

            default:
            {
                Functions.Verify(false, true, "Valid value of extension sent to function");
                break;
            }
            }
            return(ProjectRecord);
        }
예제 #2
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);
        }