예제 #1
0
        public DocumentProgressor()
        {
            bp = new BPSettings();
            var data = ProjectConfig.projectSettings["progress"];

            filedata = JObject.FromObject(data).ToObject <Dictionary <string, int> >();
        }
예제 #2
0
        public string createFinancialPackage()
        {
            string projectTitle = AppUtilities.mainData["step5"].ToString();

            projectPath = Path.Combine(ProjectConfig.projectBase, projectTitle + ProjectConfig.projectExtension);
            string   startDate     = AppUtilities.mainData["step4"].ToString();
            DateTime oDate         = DateTime.Parse(startDate);
            string   plan_type     = AppUtilities.mainData["step7"].ToString();
            int      plan_duration = 6;

            if (plan_type != "I would like a standard-term business plan.")
            {
                plan_duration = 12;
            }
            List <string> months = new List <string>();

            months.Add(oDate.ToString("MMMM", CultureInfo.CreateSpecificCulture("en")));
            for (int i = 1; i < plan_duration; i++)
            {
                months.Add(oDate.AddMonths(i).ToString("MMM", CultureInfo.InvariantCulture));
            }
            Dictionary <string, object> data = new Dictionary <string, object>();

            data["plan_duration"] = plan_duration;
            data["months"]        = months;
            data["currency"]      = getCurrency(AppUtilities.mainData["step2"]);
            data["is_startup"]    = AppUtilities.mainData["step3"].ToString() == "This business plan is for a startup." ? "yes" : "no";
            tempPath = Path.Combine(ProjectConfig.projectBase, "~temp_" + projectTitle);
            try
            {
                if (Directory.Exists(tempPath))
                {
                    Directory.Delete(tempPath, true);
                }
                DirectoryInfo di = Directory.CreateDirectory(tempPath);
                di.Attributes = FileAttributes.Directory | FileAttributes.Hidden;
                Dictionary <string, int> progress = new Dictionary <string, int>();
                BPSettings bp = new BPSettings();
                bp.AddSetting("Title", projectTitle);
                bp.AddSetting("PlanType", planType);
                bp.AddSetting("Currency", getCurrency(AppUtilities.mainData["step2"]));
                bp.AddSetting("StartUp", data["is_startup"]);
                bp.AddSetting("Duration", plan_duration);
                foreach (var d in documentList)
                {
                    if (d.Ftype == "rtf")
                    {
                        if (data["is_startup"].ToString() != "yes" && d.ItemName == "Start Up Investment")
                        {
                            continue;
                        }
                        if ((d.ItemName == "Product Summary" || d.ItemName == "Service Summary" || d.ItemName == "Product & Service Summary") && !getSellType().Equals(d.ItemName))
                        {
                            continue;
                        }
                        rtb.Rtf = "";
                        progress.Add(d.DocumentName, 0);
                        rtb.SaveFile(Path.Combine(tempPath, d.DocumentName));
                    }
                    else if (d.Ftype == "xls")
                    {
                        ExcelReader excelReader = new ExcelReader();
                        excelReader.createExcelFile(Path.Combine(tempPath, "data.xls"), data);
                    }
                }
                bp.AddSetting("progress", progress);
                bp.SaveSetting(Path.Combine(tempPath, "settings.json"));
                ZipFile.CreateFromDirectory(tempPath, projectPath);

                Debug.WriteLine("Project setup complete !");
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
            }
            finally
            {
                if (Directory.Exists(tempPath))
                {
                    Directory.Delete(tempPath, true);
                }
            }

            return(projectPath);
        }
예제 #3
0
        public string createQuickPackage()
        {
            string projectTitle = AppUtilities.mainData["step3"].ToString();

            projectPath = Path.Combine(ProjectConfig.projectBase, projectTitle + ProjectConfig.projectExtension);
            Dictionary <string, object> data = new Dictionary <string, object>();

            data["is_startup"] = AppUtilities.mainData["step2"].ToString() == "This business plan is for a startup." ? "yes" : "no";
            tempPath           = Path.Combine(ProjectConfig.projectBase, "~temp_" + projectTitle);
            try
            {
                if (Directory.Exists(tempPath))
                {
                    Directory.Delete(tempPath, true);
                }
                DirectoryInfo di = Directory.CreateDirectory(tempPath);
                di.Attributes = FileAttributes.Directory | FileAttributes.Hidden;
                Dictionary <string, int> progress = new Dictionary <string, int>();
                BPSettings bp = new BPSettings();
                bp.AddSetting("Title", projectTitle);
                bp.AddSetting("PlanType", planType);
                bp.AddSetting("StartUp", data["is_startup"]);
                bp.AddSetting("SWOT", isSWOT(AppUtilities.mainData["step4"]).ToString());
                bp.AddSetting("Website", isWeb(AppUtilities.mainData["step4"]).ToString());
                foreach (var d in documentList)
                {
                    if (d.Ftype == "rtf")
                    {
                        if (isSWOT(AppUtilities.mainData["step4"]) != 1 && (d.ItemName == "Strengths" || d.ItemName == "Weaknesses" || d.ItemName == "Opportunities" || d.ItemName == "Threats"))
                        {
                            continue;
                        }
                        if (isWeb(AppUtilities.mainData["step4"]) != 1 && (d.ItemName == "Website Strategy" || d.ItemName == "Developments Requirements"))
                        {
                            continue;
                        }
                        if (data["is_startup"].ToString() != "yes" && d.ItemName == "Start Up Investment")
                        {
                            continue;
                        }
                        if ((d.ItemName == "Product Summary" || d.ItemName == "Service Summary" || d.ItemName == "Product & Service Summary") && !getSellType().Equals(d.ItemName))
                        {
                            continue;
                        }
                        rtb.Rtf = "";
                        progress.Add(d.DocumentName, 0);
                        rtb.SaveFile(Path.Combine(tempPath, d.DocumentName));
                        Debug.WriteLine("Fcrea " + d.DocumentName);
                    }
                    else if (d.Ftype == "xls")
                    {
                        ExcelReader excelReader = new ExcelReader();
                        excelReader.createExcelFile(Path.Combine(tempPath, "data.xls"), data);
                    }
                }
                bp.AddSetting("progress", progress);
                bp.SaveSetting(Path.Combine(tempPath, "settings.json"));

                ZipFile.CreateFromDirectory(tempPath, projectPath);
                Debug.WriteLine("Project setup complete !");
            }
            catch (Exception e)
            {
                Debug.WriteLine("Erro foun " + e.Message);
            }
            finally
            {
                if (Directory.Exists(tempPath))
                {
                    Directory.Delete(tempPath, true);
                }
            }

            return(projectPath);
        }
예제 #4
0
        public static void loadSettings()
        {
            BPSettings bp = new BPSettings();

            projectSettings = ProjectConfig.convertToDict(bp.ReadSettings(ProjectConfig.projectPath + "//" + "settings.json"));
        }