Beispiel #1
0
        public virtual UploadfileDomain CreateUploadfileDomain()
        {
            UploadfileEntity entity = new UploadfileEntity();
            entity.FileId = Guid.NewGuid().ToString();

            return new UploadfileDomain(entity);
        }
Beispiel #2
0
        private void SaveSingleFile(FileUpload fileup1)
        {
            string strAttachmentPath = string.Empty;
            string strFileName = string.Empty;
            string fileFullName = string.Empty;
            string fileType = string.Empty;
            string fileName = string.Empty;


            UploadfileEntity upLoadFileEntity = new UploadfileEntity();
            strAttachmentPath = Server.MapPath("~/UploadFile/UnlockRequest/");
            strFileName = fileup1.PostedFile.FileName;

            fileFullName = strFileName.Substring(strFileName.LastIndexOf("\\") + 1);
            fileType = strFileName.Substring(strFileName.LastIndexOf(".") + 1);
            fileName = fileFullName.Substring(0, fileFullName.LastIndexOf("."));

            string newFileFullName = Guid.NewGuid().ToString() + "." + fileType;

            upLoadFileEntity.FileId = Guid.NewGuid().ToString();
            upLoadFileEntity.ActionNo = "0";
            upLoadFileEntity.Target = "UnlockRequest";
            upLoadFileEntity.CategoryId = "0";
            upLoadFileEntity.Filename = fileName;
            upLoadFileEntity.Filetype = fileType;
            upLoadFileEntity.Filepath = "UploadFile/UnlockRequest/" + newFileFullName;
            upLoadFileEntity.UploadDate = DateTime.Now;
            upLoadFileEntity.UploadUserId = UserID;


            bool flag = MainService.UploadfileBLLService.Insert(upLoadFileEntity);
            if (flag)
            {
                fileup1.SaveAs(strAttachmentPath + newFileFullName);
                AlertAndClose("Upload succeed, please wait admin to unlock.");
            }
            else
            {
                AlertMessage("Upload failure");
            }
        }
Beispiel #3
0
 public UploadfileDomain(UploadfileEntity entity)
     : base(entity)
 {
     masterEntity = entity;
 }
Beispiel #4
0
        public virtual bool SaveCriminalReport(UploadfileEntity uploadFileEntity)
        {
            // step1 : save upload file
            // step2 : update the normal raid status
            using (DataAccessBroker objBroker = DataAccessFactory.Instance())
            {
                objBroker.BeginTransaction();
                try
                {
                    bool result = false;
                    result = SaveUpLoadFile(uploadFileEntity, objBroker);
                    if (!result)
                    {
                        objBroker.RollBack();
                        return false;
                    }

                    //Criminal的ActionNo在NormalRaid中肯的存在的,所以是否能修改的标记存在NormalRaid中
                    NormalRaidEntity normalraidEntity = MainService.NormalRaidBLLService.GetNormalRaidEntityById(uploadFileEntity.ActionNo);
                    if (normalraidEntity == null)
                    {
                        objBroker.RollBack();
                        return false;
                    }

                    //上传文件后,不再允许修改Action
                    normalraidEntity.Allowcriminal = BPSC.Common.YesOrNo.No.GetHashCode().ToString();

                   
                    DataAccess.Update(normalraidEntity, objBroker);

                    objBroker.Commit();
                    return true;
                }
                catch
                {
                    objBroker.RollBack();
                    return false;
                }
            }
        }
Beispiel #5
0
        public  bool SaveUpLoadFile(UploadfileEntity upLoadFileEntity)
        {

            string fileID = string.Empty;
            string actionNO = string.Empty;
            string target = string.Empty;
            string categoryID = string.Empty;
            string fileName = string.Empty;
            string fileType = string.Empty;
            string filePath = string.Empty;
            string uploadUserID = string.Empty;

            Suzsoft.Smart.EntityCore.DataAccessParameterCollection dpc = new Suzsoft.Smart.EntityCore.DataAccessParameterCollection();
            dpc.AddWithValue("@fileID", upLoadFileEntity.FileId);
            dpc.AddWithValue("@actionNO", upLoadFileEntity.ActionNo);
            dpc.AddWithValue("@target", upLoadFileEntity.Target);
            dpc.AddWithValue("@categoryID", upLoadFileEntity.CategoryId);
            dpc.AddWithValue("@fileName", upLoadFileEntity.Filename);
            dpc.AddWithValue("@fileType", upLoadFileEntity.Filetype);
            dpc.AddWithValue("@filePath", upLoadFileEntity.Filepath);
            dpc.AddWithValue("@uploadUserID", upLoadFileEntity.UploadUserId);

            string strSql = @" INSERT INTO UploadFile 
                   ( File_ID,Action_NO,Target,Category_ID,FileName,FileType,FilePath,Upload_User_ID,Upload_Date ) 
                    Values (@fileID ,@actionNO,@target,@categoryID,@fileName,@fileType,@filePath,
                    @uploadUserID,'" + upLoadFileEntity.UploadDate + "' ) ";

            using (DataAccessBroker objBroker = DataAccessFactory.Instance())
            {
                try
                {
                    objBroker.ExecuteSQL(strSql, dpc);
                    return true;
                }
                catch 
                {
                    return false;
                }
            }
        }
Beispiel #6
0
        public  bool SaveNormalRaidReport(UploadfileEntity uploadFileEntity)
        {
            // step1 : save upload file
            // step2 : update the normal raid status
            using (DataAccessBroker objBroker = DataAccessFactory.Instance())
            {
                objBroker.BeginTransaction();
                try
                {
                    bool result = false;
                    result = SaveUpLoadFile(uploadFileEntity, objBroker);
                    if (!result)
                    {
                        objBroker.RollBack();
                        return false;
                    }

                    NormalRaidEntity normalraidEntity = MainService.NormalRaidBLLService.GetNormalRaidEntityById(uploadFileEntity.ActionNo);
                    if (normalraidEntity == null)
                    {
                        objBroker.RollBack();
                        return false;
                    }

                    //上传文件后,不再允许修改Action
                    normalraidEntity.Allowchangeraid = BPSC.Common.YesOrNo.No.GetHashCode().ToString();

                    switch (uploadFileEntity.CategoryId)
                    {
                        case RAID_REPORT_KYQD_ID:
                            normalraidEntity.StatusReportKyqd += 1;
                            break;
                        case RAID_REPORT_XDBG_ID:
                            normalraidEntity.StatusReportXdbg += 1;
                            break;
                        case RAID_REPORT_XHZM_ID:
                            normalraidEntity.StatusReportXhzm += 1;
                            break;
                        case RAID_REPORT_CFJDS_ID:
                            normalraidEntity.StatusReportCfjds += 1;
                            break;
                        case RAID_REPORT_XRZL_ID:
                            normalraidEntity.StatusReportXrzl += 1;
                            break;
                        case RAID_REPORT_JDBG_ID:
                            normalraidEntity.StatusReportJdbg += 1;
                            break;
                        case CRIMINAL_REPORT_XSAJZJBG_ID:

                            break;
                        case CRIMINAL_REPORT_XSPJS_ID:

                            break;
                        default:
                            objBroker.RollBack();
                            return false;
                    }

                    DataAccess.Update(normalraidEntity, objBroker);

                    objBroker.Commit();
                    return true;
                }
                catch
                {
                    objBroker.RollBack();
                    return false;
                }
            }
        }
Beispiel #7
0
 public virtual void UpdateUploadfileEntity(UploadfileEntity entity, DataAccessBroker broker)
 {
     DataAccess.Update(entity, broker);
 }
Beispiel #8
0
 public virtual void InsertUploadfileEntity(UploadfileEntity entity, DataAccessBroker broker)
 {
     DataAccess.Insert(entity, broker);
 }
Beispiel #9
0
        private void SaveSingleFile(FileUpload fileup1, string fileCategory)
        {
            string strAttachmentPath = string.Empty;
            string strFileName = string.Empty;
            string fileFullName = string.Empty;
            string fileType = string.Empty;
            string fileName = string.Empty;


            UploadfileEntity upLoadFileEntity = new UploadfileEntity();
            strAttachmentPath = Server.MapPath("~/UploadFile/NormalRaid/");
            strFileName = fileup1.PostedFile.FileName;

            fileFullName = strFileName.Substring(strFileName.LastIndexOf("\\") + 1);
            fileType = strFileName.Substring(strFileName.LastIndexOf(".") + 1);
            fileName = fileFullName.Substring(0, fileFullName.LastIndexOf("."));

            string newFileFullName = Guid.NewGuid().ToString() + "." + fileType;

            upLoadFileEntity.FileId = Guid.NewGuid().ToString();
            upLoadFileEntity.ActionNo = this.txtActionNo.Text.Trim();
            upLoadFileEntity.Target = "Upload_File_For_Raid";
            upLoadFileEntity.CategoryId = fileCategory;
            upLoadFileEntity.Filename = fileName;
            upLoadFileEntity.Filetype = fileType;
            upLoadFileEntity.Filepath = "UploadFile/NormalRaid/" + newFileFullName;
            upLoadFileEntity.UploadDate = DateTime.Now;
            upLoadFileEntity.UploadUserId = CurrentUser.SecUserEntity.UserId;


            bool flag = MainService.UploadfileBLLService.SaveNormalRaidReport(upLoadFileEntity);
            if (flag)
            {
                fileup1.SaveAs(strAttachmentPath + newFileFullName);
                //UIHelper.Alert(this, "Save succeed");
            }
            else
            {
                //UIHelper.Alert(this, "Save failure");
            }
        }