Beispiel #1
0
        /// <summary>
        /// 文件删除校验
        /// </summary>
        /// <returns></returns>
        bool CheckCorrectDelete()
        {
            bool tempDeleteNoLimite = SysConvert.ToBoolean(UCFileUPParamSet.GetIntValueByID(7203)); //文件管理的文件删除权限不做限制
            int  tempDeleteHours    = UCFileUPParamSet.GetIntValueByID(7204);                       //文件管理的文件删除限制在多少小时内,除非是管理员

            if (tempDeleteHours == 0)
            {
                tempDeleteHours = 24;//默认24小时
            }

            if (!tempDeleteNoLimite) //限制本人或管理员
            {
                if (!UCMangerFlag)   //如果不是管理员
                {
                    if (SysConvert.ToString(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "UploadOPID")) != UCUploadOPID)
                    {
                        this.ShowMessage("上传人不是本人,不允许删除");
                        return(false);
                    }
                }
            }

            if (tempDeleteHours > 0)//校验删除时效性
            {
                DateTime uploadTime = SysConvert.ToDateTime(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "UploadTime"));
                TimeSpan ts         = UCFileUPParamSet.ServerTime - uploadTime;
                if (ts.TotalHours > tempDeleteHours)
                {
                    this.ShowMessage("超过时效性(" + tempDeleteHours + "小时),不允许删除");
                    return(false);
                }
            }
            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// 换行改变事件
        /// </summary>
        /// <param name="sender"></param>
        private void gridViewRowChanged3(object sender)
        {
            try
            {
                ColumnView view = sender as ColumnView;

                saveFileID   = SysConvert.ToInt32(view.GetRowCellValue(view.FocusedRowHandle, "ID"));
                saveFileName = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "FileName"));
                saveFileExe  = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "FileExe"));
                string tempExe = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "FileExe")).ToLower();

                if (tempExe == ".jpg" || tempExe == ".gif" || tempExe == ".bmp")//如果是图片
                {
                    bool autoshowPic = SysConvert.ToBoolean(UCFileUPParamSet.GetIntValueByID(7206));
                    if (autoshowPic)//自动显示图片
                    {
                        groupControlBRight.Visible = true;
                        PictureSet(saveFileID);
                    }
                    else
                    {
                        groupControlBRight.Visible = false;
                    }
                }
                else
                {
                    groupControlBRight.Visible = false;
                }
            }
            catch (Exception E)
            {
                this.ShowMessage(E.Message);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="sqlTrans">事务类</param>
        public int RAdd(byte[] p_File, int winListID, int headtype, int subtype, int dataid, int dataSeq, string fileName, string filetitle, string fileExec, string p_Remark, string p_FileProt1, string p_FileProt2, decimal fileSize, string LoginID, string LoginName, int loginLogID, IDBTransAccess sqlTrans)
        {
            try
            {
                int sysEntityID = UCFileUPParamSet.GetIntValueByID(7201);//获得文件管理实体ID
                if (sysEntityID == 0)
                {
                    sysEntityID = 45;//默认是45
                }
                int    maxID = (int)EntityIDTable.GetID(sysEntityID, (int)DBSort.Default, sqlTrans);
                string sql   = string.Empty;
                //sql = "SELECT ISNULL(MAX(Seq),0)+1 MSeq FROM Pro_TecFile WHERE TecID=" + SysString.ToDBString(tecID);
                //int maxSeq = 0;// SysConvert.ToInt32(sqlTrans.Fill(sql).Rows[0][0]);
                sql  = "INSERT INTO Data_WinListAttachFile(ID,WinListID,HeadType,SubType,HTDataID,HTDataSeq,FileName,FileContext,FileSize";
                sql += ",UploadTime,UploadOPID,UploadOPName,UploadLoginLogID,FileExe,Remark,FileProt1,FileProt2)";
                sql += "VALUES(" + maxID + "," + winListID + "," + headtype + "," + subtype + "," + dataid + "," + dataSeq + "," + SysString.ToDBString(fileName) + ",@Context," + SysString.ToDBString(fileSize);
                sql += ",GetDate()," + SysString.ToDBString(LoginID) + "," + SysString.ToDBString(LoginName) + "," + SysString.ToDBString(loginLogID);
                sql += "," + SysString.ToDBString(fileExec) + "," + SysString.ToDBString(p_Remark) + "," + SysString.ToDBString(p_FileProt1) + "," + SysString.ToDBString(p_FileProt2);
                sql += ")";

                object[,] obja = new object[2, 1];
                obja[0, 0]     = "@Context";
                obja[1, 0]     = p_File;
                sqlTrans.ExecuteNonQuery(sql, obja);
                return(maxID);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }