Esempio n. 1
0
    private void CreateProjects()
    {
        if (IsGetNewProject)
        {
            Response.Write(GetProjectContent(new ProjectParameter().ToXml(), "Create", "ProjectExec('txtProject',1);"));
            Response.End();
        }
        else
        {
            try
            {
                ProjectParameter st = new ProjectParameter();
                st = st.FormXml(Content);
                string filePath = string.Concat(ProjectParameter.GetSettingsPath(CurrentSession.UserCode), st.ProjectName);
                if (System.IO.File.Exists(filePath))
                {
                    Response.Write(string.Concat("The project \"", st.ProjectName, "\" already existed."));
                }
                else
                {
                    System.IO.File.WriteAllText(ProjectParameter.GetSettingsPath(CurrentSession.UserCode) + st.ProjectName, st.ToXml());
                    Response.Write("OK");
                }

            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
    }
Esempio n. 2
0
 private void EditProjects()
 {
     if (IsGetNewProject)
     {
         try { Response.Write(GetProjectContent(ProjectParameter.GetSettingsByProjectName(CurrentSession.UserCode, ProjectName, CurrentSession.ShareUserCode).ToXml(), "Save", "ProjectExec('txtProject',2);")); }
         catch (Exception ex) { Response.Write(ex.Message); }
         Response.End();
     }
     else
     {
         try
         {
             ProjectParameter pj = new ProjectParameter();
             pj = pj.FormXml(Content);
             string filePath = string.Concat(ProjectParameter.GetSettingsPath(CurrentSession.UserCode), pj.ProjectName);
             System.IO.File.WriteAllText(ProjectParameter.GetSettingsPath(CurrentSession.UserCode) + pj.ProjectName, pj.ToXml());
             Response.Write("OK");
         }
         catch (Exception ex)
         {
             Response.Write(ex.Message);
         }
     }
 }