コード例 #1
0
ファイル: ProjectBAL.cs プロジェクト: fredcool/GitDB
        public CreateProjectResponse CreateProject(CreateProjectRequest request)
        {
            CreateProjectResponse response = new CreateProjectResponse();
            LogDAL logDAL      = new LogDAL();
            string projectPath = ProjectBasePath + request.project.ProjectName;
            string result      = null;

            logDAL.InsertLog(request.project.ToString());
            logDAL.InsertLog(projectPath);

            try
            {
                if (!Directory.Exists(projectPath))
                {
                    result = Repository.Init(projectPath);
                    if (!string.IsNullOrWhiteSpace(result))
                    {
                        Repository repo = new Repository(projectPath);
                        //Create README.md file
                        File.WriteAllText(projectPath + "\\README.md", request.project.ProjectName);

                        //Create _Db.config file
                        File.WriteAllText(projectPath + "\\_Db.config", ProjectDomainHelper.ToFileContent(request.project));

                        //Git add
                        Commands.Stage(repo, "*");

                        // Create the committer's signature and commit
                        Signature author    = new Signature(Properties.AuthorName, Properties.AuthorEmail, DateTime.Now);
                        Signature committer = new Signature(Properties.CommitterName, Properties.CommitterEmail, DateTime.Now);

                        repo.Commit("Project Initialization", author, committer);
                    }
                    else
                    {
                        response.StatusCode    = StatusCodes.Status_Error;
                        response.StatusMessage = "Unable to create project";
                    }
                }
                else
                {
                    logDAL.InsertLog("Project already exists");
                    response.StatusCode    = StatusCodes.Status_Error;
                    response.StatusMessage = "Project already exists";
                }
            }
            catch (Exception e)
            {
                logDAL.InsertLog(e.ToString());
            }

            response.Result = result;
            return(response);
        }
コード例 #2
0
ファイル: LogDALTest.cs プロジェクト: fredcool/GitDB
 public void TestInsertLog()
 {
     LogDAL dal = new LogDAL();
     dal.InsertLog("Test");
 }
コード例 #3
0
ファイル: LogBUS.cs プロジェクト: KimPhiJSCDVLP/SoHoa_V1
        public ReturnResult <Log> InsertLog(Log log)
        {
            var rs = logDAL.InsertLog(log);

            return(rs);
        }