コード例 #1
0
ファイル: OfficeCheckInOut.aspx.cs プロジェクト: pcstx/OA
        protected void Button1_Click(object sender, EventArgs e)
        {
            string RootPath = "J:/RD";
            string strTempPath = "FileTemp";
            string filePath = RootPath + "/" + strTempPath;
            string fileName = MyPath.Substring(MyPath.LastIndexOf("/") + 1);
            string CopyFilePath = "";
            string  folderName = MyPath.Substring(0, MyPath.LastIndexOf("/"));
            DocFileInfo _docFileInfo = DbHelper.GetInstance().GetFileInfoEntityByFileName(fileName, folderName);
            if (!File.Exists(filePath))
            {
                Directory.CreateDirectory(filePath);
            }
            CopyFilePath = filePath + "/" + fileName.Substring(0,fileName.LastIndexOf("."));
            DataTable dtEdition = DbHelper.GetInstance().GetFileEditionInfoByID(_docFileInfo.FileSerialID);

            if (fileEdtion == "EDITIONTEXTISNULL")
            {

                fileEdtion = (dtEdition.Rows.Count + 1).ToString() + ".0";
            }
            else
            {
                fileEdtion = fileEdtion  +"_" + (dtEdition.Rows.Count + 1).ToString() + ".0";
            }

            CopyFilePath = CopyFilePath + "_" + fileEdtion + fileName.Substring(fileName.LastIndexOf(".") );
            try {
                  File.Copy(MyPath, CopyFilePath);

            }catch(Exception ex)
            {

            }

            DocFileEdition _docFileEdition = new DocFileEdition();
            _docFileEdition.FileID = _docFileInfo.FileSerialID;
            _docFileEdition.FileEdition = fileEdtion;
            _docFileEdition.FileUrl = CopyFilePath;
            _docFileEdition.ModifyDate = DateTime.Now;
            _docFileEdition.ModifyUserName = userEntity.UserName;
            _docFileEdition.FileNote = "";
            _docFileEdition.FileName = fileName;
            DbHelper.GetInstance().AddFileEditionInfo(_docFileEdition);
        }
コード例 #2
0
ファイル: DbHelperHR.cs プロジェクト: pcstx/OA
        public string AddFileEditionInfo(DocFileEdition _DocFileEdition)
        {
            DbParameter[] pramsInsert = {

                                         MakeInParam("@FileID",(DbType)SqlDbType.Int,4,_DocFileEdition.FileID),

                                         MakeInParam("@FileEdition",(DbType)SqlDbType.VarChar,50,_DocFileEdition.FileEdition),
                                         MakeInParam("@ModifyDate",(DbType)SqlDbType.DateTime,10,_DocFileEdition.ModifyDate),
                                         MakeInParam("@ModifyUser",(DbType)SqlDbType.VarChar,50,_DocFileEdition.ModifyUserName),

                                         MakeInParam("@FileNote",(DbType)SqlDbType.VarChar,50,_DocFileEdition.FileNote),
                                          MakeInParam("@FileUrl",(DbType)SqlDbType.VarChar,50,_DocFileEdition.FileUrl),
                                         MakeInParam("@FileName",(DbType)SqlDbType.VarChar,50,_DocFileEdition.FileName),

                                             };
            StringBuilder sb = new StringBuilder();
            sb.Append("INSERT INTO [dbo].[Doc_FileEdition]");
            sb.Append("([FileID]");
            sb.Append(",[FileEdition]");
            sb.Append(",[ModifyUser]");
            sb.Append(",[ModifyDate]");
            sb.Append(",[FileNote]");
            sb.Append(",[FileUrl]");
            sb.Append(",[FileName]");
            sb.Append(")");
            sb.Append("VALUES");
            sb.Append("(@FileID");
            sb.Append(",@FileEdition");
            sb.Append(",@ModifyUser");
            sb.Append(",@ModifyDate");
            sb.Append(",@FileNote");
            sb.Append(",@FileUrl");
            sb.Append(",@FileName");
            sb.Append(")");
            sb.Append(" select @@identity;");

            return ExecuteScalar(CommandType.Text, sb.ToString(), pramsInsert).ToString();
        }