Exemplo n.º 1
0
        /// <summary>
        /// 物理文件注册
        /// </summary>
        /// <param name="fileType"></param>
        private void RegFile(DataType.FileType fileType)
        {
            string savePath = "";
            string savePathID = "";//保存的目标路径的id
            ListView listViewFile = null;
            AddFileFrm frm = new AddFileFrm();
            if (frm.ShowDialog() == DialogResult.OK)
            {
                //将需要添加的文件信息返回来
                //fileList
                //savePath
                listViewFile = frm.ListViewFile;
                savePath = frm.SaveFilepath; //从弹出窗体返回来的保存路径
                savePathID = frm.SavePathID;//保存的目标路径的id
                // MessageBox.Show(savePath);
                //   FileSockClient.UpLoadFileSocketClient sock = null;
                //DataEntityQuery<DOC_FILE_LIST> query = DataEntityQuery<DOC_FILE_LIST>.Create();
                DOC_FILE_LIST file = new DOC_FILE_LIST();
                String path = "";
                foreach (ListViewItem item in listViewFile.Items)
                {
                    // MessageBox.Show(item.Text.ToString());

                    //var path = ofdFile.FileName;
                    path = item.Text.ToString();

                    // IDocFileListService _fileService = ServiceContainer.GetService<DocFileListService>();
                    try
                    {
                        //FileSockClient.UpLoadFileSocketClient sock = new FileSockClient.UpLoadFileSocketClient(path, @"D:\\PDM文件服务器根目录");
                        FileSockClient.UpLoadFileSocketClient uploadSocket = new FileSockClient.UpLoadFileSocketClient(path, savePath);
                        if (!uploadSocket.AckStatus)
                        {
                            return;
                        }
                        // MessageBox.Show("文件添加成功==文件目录" + @"E:\\PDM文件服务器根目录");
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("文件添加失败==文件目录" + savePath + "===" + ex.Message.ToString());
                    }
                    finally
                    {

                    }
                    try
                    {
                        file.DFL_ID = Guid.NewGuid().ToString();
                        file.DFL_FILE_NAME = path.Substring(path.LastIndexOf(@"\") + 1);
                        file.DFL_FILE_EXTEND = path.Substring(path.LastIndexOf(@".") + 1);
                        file.DFL_FILE_CHILD_PATH = savePathID;
                        file.DEL_FLAG = "N";
                        //file.DFL_VER_LATEST = "V" + DateTime.Now.ToString("yyyyMMddHHmmss");
                        file.DFL_VER_LATEST = new HYDocumentMS.FileHelper().getNewVer("V");
                        file.DOCID = Document.DOCID; //与文档表关联主键
                        file.CREATEDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                        file.CREATEUSER = LoginInfo.LoginID;
                        file.LASTUPDATEDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                        file.LASTUPDATEUSER = LoginInfo.LoginID;
                        file.CHECKOUTFLG = "N";
                        file.CHECKINFLG = "Y";
                        // query.Save(file);
                        //query.Insert(file);
                        file.FILE_TYPE = fileType.ToString();
                        file.Save();
                        MessageBox.Show("文件注册成功,文件目录" + savePath, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("文件注册失败【注册到数据库失败】," + ex.Message.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                        return;
                    }

                    this.BindTreeData();
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 删除文件
        /// </summary>
        private void delFile(TreeGridView tgv,DataType.FileType fileType)
        {
            int rowIndex = tgv.CurrentCell.RowIndex;

            if (rowIndex <= 0)
            {
                MessageBox.Show("请选择文件", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            HYDocumentMS.IFileHelper file = new FileHelper();
            Boolean bl = file.isHasAuth(DataType.AuthParmsType.Delete, LoginInfo.LoginID, tgv.CurrentRow.Cells["DFL_ID"].Value.ToString());
            if (bl == false)
            {
                MessageBox.Show("你没有权限删除此文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (MessageBox.Show("所选择的文件将被删除,是否确定?", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
            {
                DataGridViewRow row = tgv.Rows[rowIndex];
                string dflID = row.Cells["DFL_ID"].Value.ToString();
                //var file = _physicalService.GetPhysicalFile(Id, "");
                // IDocFileListService serv = new DocFileListService();
                if (_docFileListService.delDocFileByDFLID(dflID))
                {
                    MessageBox.Show("删除成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                }
                else
                {
                    MessageBox.Show("删除失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                }
                this.BindTreeData();
                //serv.
                //file.Delete();
                //  MessageBox.Show("所选择的文件已被删除!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 文件下载
        /// </summary>
        private void downLoadFile(TreeGridView tgv, DataType.FileType fileType)
        {
            TreeGridNode node = null;//当前选择的节点
            String serverpath = "";
            node = new TreeGridNode();
            //node = this.tvFileList.CurrentNode;
            node = tgv.CurrentNode;
            int index = node.RowIndex;

            if (index <= 0)
            {
                MessageBox.Show("请选择需要下载的文件" + "(" + index + ")", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (tgv.CurrentRow == null)
            {
                MessageBox.Show("请选择需要下载的文件", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {

                HYDocumentMS.IFileHelper file = new FileHelper();
                Boolean bl = file.isHasAuth(DataType.AuthParmsType.DownLoad, LoginInfo.LoginID, tgv.CurrentRow.Cells["DFL_ID"].Value.ToString());
                if (bl == false)
                {
                    MessageBox.Show("你没有权限下载此文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                SaveFileDialog saveDialog = new SaveFileDialog();
                saveDialog.FileName = node.Cells[0].Value.ToString();
                //saveDialog.Filter = @"Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
                string suffix = node.Cells[0].Value.ToString().Substring(node.Cells[0].Value.ToString().LastIndexOf(@".") + 1);
                saveDialog.Filter = @"文件 (*." + suffix + ")|*." + suffix;
                DialogResult res = saveDialog.ShowDialog();

                //SaveFileDialog saveDialog = new SaveFileDialog();
                //saveDialog.FileName = node.Cells[0].Value.ToString();
                //saveDialog.Filter = @"Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
                //DialogResult res = saveDialog.ShowDialog();
                if (DialogResult.OK == res)
                {
                    string clientSaveFileAndPath = saveDialog.FileName.ToString();
                    //MessageBox.Show(clientSavepath);

                    // MessageBox.Show(index.ToString());
                    if (index > 0) //取消第一行
                    {
                        serverpath = node.Cells[1].Value.ToString() + node.Cells[0].Value.ToString();
                        //  MessageBox.Show(serverpath);

                        //FileSockClient.DownLoadFileSocketClient downSocket = new FileSockClient.DownLoadFileSocketClient(serverpath, @"C:\\" + node.Cells[0].Value.ToString());
                        FileSockClient.DownLoadFileSocketClient downSocket = new FileSockClient.DownLoadFileSocketClient(serverpath, clientSaveFileAndPath);
                        if (!downSocket.AckStatus)
                        {
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.Show("请选择需要下载的文件" + "(" + index + ")", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            //  this.tvFileList.CurrentRow
        }
Exemplo n.º 4
0
        /// <summary>
        /// 检出文件
        /// </summary>
        /// <param name="tgv"></param>
        /// <param name="fileType"></param>
        private void CheckOut(TreeGridView tgv, DataType.FileType fileType)
        {
            int rowIndex = tgv.CurrentCell.RowIndex;

            if (rowIndex <= 0)
            {
                MessageBox.Show("请选择文件", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            DataGridViewRow row = tgv.Rows[rowIndex];
            HYDocumentMS.IFileHelper file = new FileHelper();
            Boolean bl = file.isHasAuth(DataType.AuthParmsType.CheckOut, LoginInfo.LoginID, row.Cells["DFL_ID"].Value.ToString());
            if (bl == false)
            {
                MessageBox.Show("你没有权限检出此文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            String Id = row.Cells["DFL_ID"].Value.ToString();
            DOC_FILE_LIST docFileEntity = _docFileListService.GetDocFileEntityByDCID(Id);

            // HYPDM.Entities.PDM_PHYSICAL_FILE physicalfile = _physicalService.GetPhysicalFile(Id, "");
            if (docFileEntity == null) return;
            if (docFileEntity.CHECKOUTFLG == "Y")
            {
                MessageBox.Show("当前文档已被检出,不能再次检出,请等待检出人检入!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            DetectionForm form = new DetectionForm();
            form.DocFileEntity = docFileEntity;

            if (form.ShowDialog() == DialogResult.OK)
            {
                docFileEntity.CHECKOUTFLG = "Y";
                docFileEntity.CHECKINFLG = "N";
                docFileEntity.CHECKOUTDATE = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                docFileEntity.LASTUPDATEDATE = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                docFileEntity.LASTUPDATEUSER = LoginInfo.LoginID;
                docFileEntity.Save();

                try
                {
                    VersionSave("0", docFileEntity);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
                finally
                {
                    MessageBox.Show("文件检出成功!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 取消检出
        /// </summary>
        /// <param name="tgv"></param>
        /// <param name="fileType"></param>
        private void CheckOutCancel(TreeGridView tgv, DataType.FileType fileType)
        {
            int rowIndex = tgv.CurrentCell.RowIndex;

            if (rowIndex <= 0)
            {
                MessageBox.Show("请选择文件", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            DataGridViewRow row = tgv.Rows[rowIndex];
            String Id = row.Cells["DFL_ID"].Value.ToString();
            DOC_FILE_LIST docFileEntity = _docFileListService.GetDocFileEntityByDCID(Id);
            if (docFileEntity.CREATEUSER.ToString() != LoginInfo.LoginID.ToString())
            {
                MessageBox.Show("当前不为文件的检出用户,不能进行取消动作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                return;
            }

            if (docFileEntity == null) return;

            docFileEntity.CHECKOUTFLG = "N";
            docFileEntity.CHECKINFLG = "Y";
            docFileEntity.LASTUPDATEUSER = LoginInfo.LoginID;
            docFileEntity.LASTUPDATEDATE = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            try
            {
                docFileEntity.Save();
                VersionSave("qx", docFileEntity);
                MessageBox.Show("文件检出取消成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
                return;
            }
            finally
            {

            }
        }
Exemplo n.º 6
0
        private void BindProcessFileTreeData(TreeGridView tgv, DataType.FileType fileType)
        {
            //this.tvFileList.Nodes.Clear();
            tgv.Nodes.Clear();
            IDocFileListService service = ServiceContainer.GetService<IDocFileListService>();
            dtDocFile = service.GetDocFileDataTableByDCID(Document.DOCID, fileType.ToString());

            //  Font boldFont = new Font(tvFileList.DefaultCellStyle.Font, FontStyle.Bold);
            Font boldFont = new Font(tgv.DefaultCellStyle.Font, FontStyle.Bold);
            //    DataView dv = new DataView(dt);
            node = new TreeGridNode();
            // dv.RowFilter = "[PARENT]=" + parentId;
            //foreach (DataRowView dr in dv)
            //{
            //    if (parentId == "0")
            //    {
            // node = tvFileList.Nodes.Add(Document.DOCNO, "", "", "", "", "", "", "");
            node = tgv.Nodes.Add(Document.DOCNO, "", "", "", "", "", "", "");
            node.DefaultCellStyle.Font = boldFont;

            // BindChildNode(node, (string)dr["PHYSICALID"]);
            HYDocumentMS.IFileHelper file = new FileHelper();
            foreach (DataRow dr in dtDocFile.Rows)
            {
                node.Nodes.Add(dr["DFL_FILE_NAME"].ToString(), file.getDocumentAllPathByPathID(dr["DFL_FILE_CHILD_PATH"].ToString()),
                      dr["DFL_VER_LATEST"].ToString(),
                                          dr["CHECKINFLG"].ToString(), dr["CHECKINDATE"].ToString(), dr["CHECKOUTFLG"].ToString(),
                                          dr["CHECKOUTDATE"].ToString(), dr["DFL_ID"].ToString());
                node.Expand();
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// checkin文件
        /// </summary>
        /// <param name="tgv"></param>
        /// <param name="fileType"></param>
        private void CheckInFile(TreeGridView tgv, DataType.FileType fileType)
        {
            int rowIndex = tgv.CurrentCell.RowIndex;

            if (rowIndex <= 0)
            {
                MessageBox.Show("请选择文件", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            DataGridViewRow row = tgv.Rows[rowIndex];
            String Id = row.Cells["DFL_ID"].Value.ToString();
            DOC_FILE_LIST docFileEntity = _docFileListService.GetDocFileEntityByDCID(Id);
            // HYPDM.Entities.PDM_PHYSICAL_FILE physicalfile = _physicalService.GetPhysicalFile(Id, "");
            HYDocumentMS.IFileHelper file = new FileHelper();
            Boolean bl = file.isHasAuth(DataType.AuthParmsType.CheckIn, LoginInfo.LoginID, row.Cells["DFL_ID"].Value.ToString());
            if (bl == false)
            {
                MessageBox.Show("你没有权限检入此文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (docFileEntity == null) return;
            if (docFileEntity.CHECKOUTFLG == "N")
            {
                MessageBox.Show("文件名【" + docFileEntity.DFL_FILE_NAME + "】" + "\n" + "不为检出状态,不能进行检入操作!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else
            {
                CheckInForm form = new CheckInForm();
                form.DocFileEntity = docFileEntity;

                if (form.ShowDialog() == DialogResult.OK)
                {
                    docFileEntity.CHECKINFLG = "Y";
                    docFileEntity.CHECKINDATE = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    docFileEntity.CHECKOUTFLG = "N";
                    docFileEntity.DFL_VER_LATEST = "V" + DateTime.Now.ToString("yyyyMMddHHmmss");
                    docFileEntity.LASTUPDATEDATE = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    docFileEntity.LASTUPDATEUSER = LoginInfo.LoginID;
                    docFileEntity.Save();

                    VersionSave("1", docFileEntity);
                }
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// 查看文件
        /// </summary>
        /// <param name="tgv"></param>
        /// <param name="fileType"></param>
        private void ViewFile(TreeGridView tgv, DataType.FileType fileType)
        {
            int rowIndex = tgv.CurrentCell.RowIndex;

            if (rowIndex <= 0)
            {
                MessageBox.Show("请选择文件", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else
            {

                //  dr["DFL_FILE_NAME"].ToString()
                DataGridViewRow row = tgv.Rows[rowIndex];
                //   string ff = row.Cells[0].Value.ToString();

                HYDocumentMS.IFileHelper file = new FileHelper();
                Boolean bl = file.isHasAuth(DataType.AuthParmsType.View, LoginInfo.LoginID, row.Cells["DFL_ID"].Value.ToString());
                if (bl == false)
                {
                    MessageBox.Show("你没有权限查看此文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                String fileName = Path.ChangeExtension(row.Cells["DFL_FILE_NAME"].Value.ToString(), "swf");
                string viewPath = System.Configuration.ConfigurationManager.AppSettings["viewFilePath"].ToString();
                ViewFileFrm fileView = new ViewFileFrm();
                fileView.FileName = fileName;
                //fileView.ViewFilePathAndName = @"D:\swf\Java网络编程精解.swf";
                fileView.ViewFilePath = viewPath;
                fileView.ShowDialog();
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// 获取form
        /// </summary>
        /// <param name="RelationObjectType"></param>
        /// <param name="objectID"></param>
        /// <returns></returns>
        public static Form GetDetaiFrm(DataType.RelationObjectType RelationObjectType, string objectID)
        {
            Form FrmDetail = null;
            string tableName = DataType.GetTableName(RelationObjectType);
            switch (RelationObjectType)
            {
                case DataType.RelationObjectType.Document:
                    {
                        IDocumentService _docService = ServiceContainer.GetService<DocumentService>();
                        HYPDM.WinUI.Document.DocRegForm frm = new Document.DocRegForm(true);
                        frm.Document = _docService.GetDocListByID(objectID)[0];
                        frm.StartPosition = FormStartPosition.CenterParent;
                        FrmDetail = frm;
                        break;
                    }
                case DataType.RelationObjectType.File:
                    {
                        //tableName = "DOC_FILE_LIST";
                        break;
                    }
                case DataType.RelationObjectType.Material:
                    {
                        //tableName = "PDM_MATERAIL";

                        HYPDM.WinUI.ProductsAndParts.Material.MaterialConfForm frm = new ProductsAndParts.Material.MaterialConfForm(objectID, 1, true);  //2为半成品  1为成品
                        //IDocumentService _docService = ServiceContainer.GetService<DocumentService>();
                        //IAllProductService m_AllProductService = EAS.Services.ServiceContainer.GetService<IAllProductService>();
                        FrmDetail = frm;
                        frm.StartPosition = FormStartPosition.CenterParent;
                        break;
                    }
                case DataType.RelationObjectType.Product:
                    {
                        // tableName = "PDM_ALL_PRODUCT";  //PRODUCTLEVEL为1的时候表示是产品
                        HYPDM.WinUI.ProductsAndParts.Products.ProductsConfForm frm = new ProductsAndParts.Products.ProductsConfForm(objectID, 1, true);  //2为半成品  1为成品
                        //IDocumentService _docService = ServiceContainer.GetService<DocumentService>();
                        //IAllProductService m_AllProductService = EAS.Services.ServiceContainer.GetService<IAllProductService>();
                        FrmDetail = frm;
                        frm.StartPosition = FormStartPosition.CenterParent;

                        break;
                    }
                case DataType.RelationObjectType.SemiProduct:
                    {
                        //tableName = "PDM_ALL_PRODUCT"; //PRODUCTLEVEL为2的时候表示是半产品
                        HYPDM.WinUI.ProductsAndParts.Products.ProductsConfForm frm = new ProductsAndParts.Products.ProductsConfForm(objectID, 2, true);  //2为半成品  1为成品
                        //IDocumentService _docService = ServiceContainer.GetService<DocumentService>();
                        //IAllProductService m_AllProductService = EAS.Services.ServiceContainer.GetService<IAllProductService>();

                        //frm.Product = m_AllProductService.GetById(objectID);

                        frm.StartPosition = FormStartPosition.CenterParent;
                        FrmDetail = frm;
                        break;
                    }
                case DataType.RelationObjectType.Drawing:
                    {
                        IDRAWINGService _docService = ServiceContainer.GetService<DRAWINGService>();
                        HYPDM.WinUI.DrawingDocument.DrawRegForm frm = new DrawingDocument.DrawRegForm(true);
                        frm.Document = _docService.GetDrawObjectDCID(objectID);
                        frm.StartPosition = FormStartPosition.CenterParent;
                        FrmDetail = frm;
                        break;
                    }
                default:
                    {
                        // tableName = "";
                        break;
                    }
            }
            return FrmDetail;
        }
Exemplo n.º 10
0
 /// <summary>
 /// 获取设定流程对象的title名称
 /// </summary>
 /// <param name="relationObjectType">RelationObjectType</param>
 /// <returns></returns>
 public static string GetObjectTitle(DataType.RelationObjectType relationObjectType,string objectKey)
 {
     string tableName = DataType.GetTableName(relationObjectType);
     string objectTitle = "";
     switch (relationObjectType)
     {
         case DataType.RelationObjectType.Document:
             {
                 objectTitle = "【文档编号:" + CommonFuns.getDataTableBySql("DOCNO", "WHERE DOCID='" + objectKey+ "'", tableName).Rows[0][0].ToString() + "】";
                 break;
             }
         case DataType.RelationObjectType.File:
             {
                 objectTitle = "【文件名称:" + CommonFuns.getDataTableBySql("DFL_FILE_NAME", " WHERE DFL_ID='" + objectKey + "'", tableName).Rows[0][0].ToString() + "】";
                 break;
             }
         case DataType.RelationObjectType.Material:
             {
                 objectTitle = "【物料NO:" + CommonFuns.getDataTableBySql("MATERIALNO", " WHERE MATERIALID='" + objectKey + "'", tableName).Rows[0][0].ToString() + "】";
                 break;
             }
         case DataType.RelationObjectType.Product:
             {
                 objectTitle = "【产品NO:" + CommonFuns.getDataTableBySql("PRODUCTNO", "WHERE PRODUCTLEVEL=1 AND PRODUCTID='" + objectKey + "'", tableName).Rows[0][0].ToString() + "】"; //PRODUCTLEVEL为1的时候表示是产品
                 break;
             }
         case DataType.RelationObjectType.SemiProduct:
             {
                 objectTitle = "【半成品NO:" + CommonFuns.getDataTableBySql("PRODUCTNO", "WHERE PRODUCTLEVEL=2 AND PRODUCTID='" + objectKey + "'", tableName).Rows[0][0].ToString() + "】"; //PRODUCTLEVEL为2的时候表示是半产品
                 break;
             }
         case DataType.RelationObjectType.Drawing:
             {
                 objectTitle = "【图纸NO:" + CommonFuns.getDataTableBySql("DOCNO", "WHERE DOCID='" + objectKey + "'", tableName).Rows[0][0].ToString() + "】";
                 break;
             }
         default:
             {
                 tableName = "";
                 break;
             }
     }
     return objectTitle;
 }
Exemplo n.º 11
0
        /// <summary>
        /// 给定需要判定的权限类型,用户账号key,文件key值,获取对应权限
        /// </summary>
        /// <param name="authType">查询的权限参数,查看,编辑</param>
        /// <param name="userAccount">用户账户(KEY值)</param>
        /// <param name="fileKey">文件key值</param>
        /// <returns>boolean</returns>
        public Boolean isHasAuth(DataType.AuthParmsType authType, string userAccount, string fileKey)
        {
            Boolean bl = true;

            //            //*************************************************************************************************************************//
            //            //
            //            //                         1、判定需要判定权限的类型,如查看、编辑
            //            //                         2、给定权限类型、用户登录账号、文件KEY值,调用方法进行权限判定。
            //            //                         3、权限判定方法:
            //            //                            3.1  根据userAccount获取其归属群组:  SELECT ROLENAME  FROM  EAS_ACCOUNTGROUPING  WHERE LOGINID='PDM'
            //            //                            3.2  根据fileKey获取其归属文件夹: SELECT  DFL_FILE_CHILD_PATH FROM DOC_FILE_LIST  WHERE DFL_ID='5f0a9b8d-a291-43c4-966d-4d04d3457465'
            //            //                            3.3  查询出群组的群组关系:SELECT FAURR_TO_ROLE FROM FILE_AUTH_ROLE_ROLE WHERE FAURR_FROM_ROLE='FFFF' AND DEL_FLAG='N'
            //            //                            3.4  整合userAccount对该文件ACL:
            //            //                                      3.4.1 在File_Auth中查询出文件的ACl:
            //            //                                                SELECT * FROM [drugshop].[dbo].[FILE_AUTH] WHERE DEL_FLAG='N' AND DFL_ID='111111'
            //            //                                      3.5.1 遍历3.4.1ACL:
            //            //                                             3.5.1.1 如果FAU_OBJ_TYPE=AuthObjectType.SingleUser AND FAU_OBJ_VALUE='userAccount' ,
            //            //                                                     如果结果集>0表示有权限,否则没有权限
            //            //                                             3.5.1.2 如果FAU_OBJ_TYPE=AuthObjectType.UserRole  AND FAU_OBJ_VALUE IN ('角色1','角色2','角色3'),IN中为给定账号所属群组,
            //            //                                                     如果结果集>0说明有权限,否则没有权限
            //            //
            //            //
            //            //
            //           // *************************************************************************************************************************//
            string queryFields = ""; //对应权限字段名,供查询使用
            switch (authType)
            {
                case DataType.AuthParmsType.View:
                    {
                        queryFields = "FAU_VIEW";
                        break;
                    }
                case DataType.AuthParmsType.Edit:
                    {
                        queryFields = "FAU_EDIT";
                        break;
                    }
                case DataType.AuthParmsType.Delete:
                    {
                        queryFields = "FAU_DELETE";
                        break;
                    }
                case DataType.AuthParmsType.DownLoad:
                    {
                        queryFields = "FAU_DOWNLOAD";
                        break;
                    }
                case DataType.AuthParmsType.CheckIn:
                    {
                        queryFields = "FAU_CHECKIN";
                        break;
                    }
                case DataType.AuthParmsType.CheckOut:
                    {
                        queryFields = "FAU_CHECKOUT";
                        break;
                    }
                case DataType.AuthParmsType.UpLoad:
                    {
                        queryFields = "FAU_UPLOAD";  //如果为上传的话,传的是文件夹的ID,判定用户在此文件夹下可有上传文件的权限
                        break;
                    }
                case DataType.AuthParmsType.FolderCreate:
                    {
                        queryFields = "FOLDERCREATE";
                        break;
                    }
                case DataType.AuthParmsType.FolderDelete:
                    {
                        queryFields = "FOLDERDELETE";
                        break;
                    }
                case DataType.AuthParmsType.FolderEdit:
                    {
                        queryFields = "FOLDEREDIT";
                        break;
                    }
                default:
                    {
                        MessageBox.Show("判定权限类型不正确!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                        break;

                    }
            }
            if (authType == DataType.AuthParmsType.FolderEdit || authType == DataType.AuthParmsType.FolderDelete || authType == DataType.AuthParmsType.FolderCreate || authType == DataType.AuthParmsType.UpLoad)
            {
                //针对文件夹的权限判定
                bl = IsTrueFolderAuth(queryFields, fileKey, userAccount);
            }
            else
            {
                //针对文件的权限的判定
                bl = isTrue(queryFields, userAccount, fileKey);
            }
            return bl;
        }
Exemplo n.º 12
0
 /// <summary>
 /// 根据RelationObjectType类型获取对应的主表名称及form
 /// </summary>
 /// <param name="RelationObjectType"> DataType.RelationObjectTyp</param>
 /// <returns></returns>
 public static string GetTableName(DataType.RelationObjectType RelationObjectType)
 {
     string tableName = "";
     switch (RelationObjectType)
     {
         case DataType.RelationObjectType.Document:
             {
                 tableName = "PDM_DOCUMENT";
                 break;
             }
         case DataType.RelationObjectType.File:
             {
                 tableName = "DOC_FILE_LIST";
                 break;
             }
         case DataType.RelationObjectType.Material:
             {
                 tableName = "PDM_MATERAIL";
                 break;
             }
         case DataType.RelationObjectType.Product:
             {
                 tableName = "PDM_ALL_PRODUCT";  //PRODUCTLEVEL为1的时候表示是产品
                 break;
             }
         case DataType.RelationObjectType.SemiProduct:
             {
                 tableName = "PDM_ALL_PRODUCT"; //PRODUCTLEVEL为2的时候表示是半产品
                 break;
             }
         case DataType.RelationObjectType.Drawing:
             {
                 tableName = "PDM_DRAWING"; //图纸对象
                 break;
             }
         default:
             {
                 tableName = "";
                 break;
             }
     }
     return tableName;
 }