Exemplo n.º 1
0
        private void InitOffice(bool isMenu)
        {
            bool isCompleate = false;

            BP.WF.Node node = new BP.WF.Node();
            node.NodeID = int.Parse(this.FK_Node);
            node.RetrieveFromDBSources();
            try
            {
                WorkFlow workFlow = new WorkFlow(node.FK_Flow, Int64.Parse(PKVal));
                isCompleate = workFlow.IsComplete;
            }
            catch (Exception)
            {
                try
                {
                    Flow  fl  = new Flow(node.FK_Flow);
                    GERpt rpt = fl.HisGERpt;
                    rpt.OID = Int64.Parse(PKVal);
                    rpt.Retrieve();

                    if (rpt != null)
                    {
                        if (rpt.WFState == WFState.Complete)
                        {
                            isCompleate = true;
                        }
                    }
                }
                catch
                {
                }
            }
            if (!isCompleate)
            {
                try
                {
                    isCompleate = !BP.WF.Dev2Interface.Flow_IsCanDoCurrentWork(node.FK_Flow, node.NodeID, Int64.Parse(PKVal), WebUser.No);
                    //WorkFlow workFlow = new WorkFlow(node.FK_Flow, Int64.Parse(PKVal));
                    //isCompleate = !workFlow.IsCanDoCurrentWork(WebUser.No);
                }
                catch
                {
                }
            }

            FrmAttachment attachment = new FrmAttachment();
            int           result     = 0;

            //表单编号与节点不为空
            if (this.FK_MapData != null && this.FK_Node != null)
            {
                BP.En.QueryObject objInfo = new BP.En.QueryObject(attachment);
                objInfo.AddWhere(FrmAttachmentAttr.FK_MapData, this.FK_MapData);
                objInfo.addAnd();
                objInfo.AddWhere(FrmAttachmentAttr.FK_Node, this.FK_Node);
                objInfo.addAnd();
                objInfo.AddWhere(FrmAttachmentAttr.NoOfObj, this.NoOfObj);
                result = objInfo.DoQuery();
                //result = attachment.Retrieve(FrmAttachmentAttr.FK_MapData, this.FK_MapData,
                //                            FrmAttachmentAttr.FK_Node, this.FK_Node, FrmAttachmentAttr.NoOfObj, this.DelPKVal);
            }
            if (result == 0) /*如果没有定义,就获取默认的.*/
            {
                attachment.MyPK = this.FK_FrmAttachment;
                attachment.Retrieve();
            }
            if (!isCompleate)
            {
                if (attachment.IsWoEnableReadonly)
                {
                    ReadOnly = true;
                }
                if (attachment.IsWoEnableCheck)
                {
                    IsCheck = true;
                }
                IsMarks = attachment.IsWoEnableMarks;
            }
            else
            {
                if (attachment.IsWoEnableReadonly)
                {
                    ReadOnly = true;
                }
            }
            if (isMenu && !isCompleate)
            {
                #region 初始化按钮
                if (attachment.IsWoEnableViewKeepMark)
                {
                    divMenu.InnerHtml = "<select id='marks' onchange='ShowUserName()'  style='width: 100px'><option value='1'>显示留痕</option><option value='2'>隐藏留痕</option><select>";
                }

                if (attachment.IsWoEnableTemplete)
                {
                    AddBtn("openTempLate", "打开模板", "OpenTempLate");
                }
                if (attachment.IsWoEnableSave)
                {
                    AddBtn("saveFile", "保存", "saveOffice");
                }
                if (attachment.IsWoEnableRevise)
                {
                    AddBtn("accept", "接受修订", "acceptOffice");
                    AddBtn("refuse", "拒绝修订", "refuseOffice");
                }

                if (attachment.IsWoEnableOver)
                {
                    AddBtn("over", "套红文件", "overOffice");
                }


                if (attachment.IsWoEnableSeal)
                {
                    AddBtn("seal", "签章", "sealOffice");
                }
                if (attachment.IsWoEnableInsertFlow)
                {
                    AddBtn("flow", "插入流程图", "InsertFlow");
                }
                if (attachment.IsWoEnableInsertFlow)
                {
                    AddBtn("fegnxian", "插入风险点", "InsertFengXian");
                }

                #endregion
            }

            #region   初始化文件

            FrmAttachmentDB downDB = new FrmAttachmentDB();

            downDB.MyPK = this.DelPKVal;
            downDB.Retrieve();
            fileName.Text = downDB.FileName;
            fileType.Text = downDB.FileExts;
            RealFileName  = downDB.FileName;
            FileFullName  = downDB.FileFullName;
            FileSavePath  = attachment.SaveTo;

            #endregion
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string action = Request["action"];

            string name = null;

            if (BP.Web.WebUser.No == "Guest")
            {
                name = BP.Web.GuestUser.Name;
            }
            else
            {
                name = BP.Web.WebUser.Name;
            }
            TB_User.Value = name;


            FrmAttachmentDB downDB = new FrmAttachmentDB();

            if (DoType.Equals("EditOffice"))
            {
                if (!string.IsNullOrEmpty(DelPKVal))
                {
                    downDB.MyPK = this.DelPKVal;
                    downDB.Retrieve();
                    TB_FilePath.Value = downDB.FileFullName;
                    TB_FileType.Value = downDB.FileExts;
                }
                if (!string.IsNullOrEmpty(this.FK_FrmAttachment))
                {
                    FrmAttachment attachment = new FrmAttachment();
                    int           result     = 0;
                    //表单编号与节点不为空
                    if (this.FK_MapData != null && this.FK_Node != null)
                    {
                        BP.En.QueryObject objInfo = new BP.En.QueryObject(attachment);
                        objInfo.AddWhere(FrmAttachmentAttr.FK_MapData, this.FK_MapData);
                        objInfo.addAnd();
                        objInfo.AddWhere(FrmAttachmentAttr.FK_Node, this.FK_Node);
                        objInfo.addAnd();
                        objInfo.AddWhere(FrmAttachmentAttr.NoOfObj, this.NoOfObj);
                        result = objInfo.DoQuery();
                        //result = attachment.Retrieve(FrmAttachmentAttr.FK_MapData, this.FK_MapData,
                        //                            FrmAttachmentAttr.FK_Node, this.FK_Node, FrmAttachmentAttr.NoOfObj, this.DelPKVal);
                    }
                    if (result == 0) /*如果没有定义,就获取默认的.*/
                    {
                        attachment.MyPK = this.FK_FrmAttachment;
                        attachment.Retrieve();
                    }

                    if (!attachment.IsWoEnableSave)
                    {
                        Btn_Save.Visible = false;
                    }
                    if (attachment.IsWoEnableReadonly)
                    {
                        TB_IsReadOnly.Value = "1";
                    }
                    else
                    {
                        TB_IsReadOnly.Value = "0";
                    }

                    if (!attachment.IsWoEnableRevise)
                    {
                        Btn_AttachDoc.Visible   = false;
                        Btn_UnAttachDoc.Visible = false;
                    }

                    if (!attachment.IsWoEnablePrint)
                    {
                        TB_IsPrint.Value = "0";
                    }
                    else
                    {
                        TB_IsPrint.Value = "1";
                    }

                    if (!attachment.IsWoEnableViewKeepMark)
                    {
                        sShowName.Visible = false;
                    }
                }
            }

            if (!string.IsNullOrEmpty(action))
            {
                if (action.Equals("SaveFile"))
                {
                    SaveFile();
                }
                else if (action.Equals("LoadFile"))
                {
                    LoadFile();
                }
                else if (action.Equals("LoadFlow"))
                {
                    GetFlow();
                }
            }
        }