Exemplo n.º 1
0
        public int AddpHoteInfo(HttpPostedFile postedFile, IntendancePhotoList annexInfo)
        {
            FileUpload upload = new FileUpload {
                FileSize   = 0x800000,
                UploadPath = "/UploadFiles/Image/PhotosCheckIn/"
            };

            if (upload.UploadValidator(postedFile))
            {
                annexInfo.PhotoName = postedFile.FileName.Substring(postedFile.FileName.LastIndexOf(@"\") + 1);
                string fileName = "";
                fileName            = ((DateTime.Today.Year.ToString() + DateTime.Today.Month.ToString().PadLeft(2, '0') + DateTime.Today.Day.ToString().PadLeft(2, '0')) + "_" + DateTime.Now.ToLongTimeString().Replace(":", "")) + annexInfo.PhotoName;
                annexInfo.PhotoName = fileName;
                annexInfo.PhotoPath = "/UploadFiles/Image/PhotosCheckIn/" + fileName.Substring(0, 6) + "/";
                string str2 = "";
                str2 = "insert into OPM_EPCM_IntendancePhotoList(noteId,InfoGuid,PhotoNumber,PhotoExplain,PhotoPath,PhotoName,OPyhdm,PhotoType)";
                object obj2 = str2;
                if (publicDbOpClass.ExecSqlString(string.Concat(new object[] {
                    obj2, " values('", annexInfo.NoteId, "','", annexInfo.InfoGuid, "','", annexInfo.PhotoNumber.ToString(), "','", annexInfo.PhotoExplain.ToString(), "','", annexInfo.PhotoPath.ToString(), "','", annexInfo.PhotoName.ToString(), "','", annexInfo.UserCode.ToString(), "','",
                    annexInfo.PhotoType, "')"
                })) != 1)
                {
                    return(-2);
                }
                if (upload.Upload(postedFile, fileName, true))
                {
                    return(1);
                }
            }
            return(-1);
        }
Exemplo n.º 2
0
        public int AddAnnexs(HttpPostedFile postedFile, AnnexInfo annexInfo, AnnexModuleSettingsInfo settingsInfo)
        {
            FileUpload upload = new FileUpload {
                ExtName    = settingsInfo.ExtName,
                FileSize   = settingsInfo.FileSize,
                UploadPath = settingsInfo.FilePath + annexInfo.AnnexType.ToString() + "/"
            };

            if (upload.UploadValidator(postedFile))
            {
                annexInfo.OriginalName = postedFile.FileName.Substring(postedFile.FileName.LastIndexOf(@"\") + 1);
                string fileName = "";
                fileName            = ((DateTime.Today.Year.ToString() + DateTime.Today.Month.ToString().PadLeft(2, '0') + DateTime.Today.Day.ToString().PadLeft(2, '0')) + "_" + DateTime.Now.ToLongTimeString().Replace(":", "")) + annexInfo.OriginalName;
                annexInfo.AnnexName = fileName;
                annexInfo.FilePath  = settingsInfo.FilePath + annexInfo.AnnexType.ToString() + "/" + fileName.Substring(0, 6) + "/";
                annexInfo.FileSize  = postedFile.ContentLength;
                string str2 = "";
                str2 = "insert into XPM_Basic_AnnexList(AnnexCode,ModuleID,RecordCode,AnnexType,FileCode,AnnexName,OriginalName,FilePath,FileSize,AddDate,State,HumanCode,Remark)";
                string str3 = str2;
                object obj2 = str3 + " values('" + annexInfo.AnnexCode.ToString() + "'," + annexInfo.ModuleID.ToString() + ",'" + annexInfo.RecordCode.ToString() + "'," + annexInfo.AnnexType.ToString() + ",'" + annexInfo.FileCode + "',";
                string str4 = string.Concat(new object[] { obj2, "'", annexInfo.AnnexName, "','", annexInfo.OriginalName, "','", annexInfo.FilePath, "',", annexInfo.FileSize, ",'", annexInfo.AddDate.ToShortDateString(), "'," });
                if (publicDbOpClass.ExecSqlString(str4 + "-1,'" + annexInfo.HumanCode + "','" + annexInfo.Remark + "') ") != 1)
                {
                    return(-2);
                }
                if (upload.Upload(postedFile, fileName, true))
                {
                    return(publicDbOpClass.ExecSqlString("update XPM_Basic_AnnexList set State = 1 where AnnexCode = '" + annexInfo.AnnexCode.ToString() + "'"));
                }
            }
            return(-1);
        }