Beispiel #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //需要加上验证权限,发起人,经办人,审核人可查看进程,只要任意一步骤有该权限
     userID = buser.GetLogin().UserID;
     if (function.isAjax())//处理AJAX
     {
         #region AJAX
         string action = Request.Form["action"];
         string value  = Request.Form["value"];
         string result = "0";
         switch (action)
         {
         case "PostDate":
             int      id   = Convert.ToInt32(value.Split(':')[0]);
             DateTime date = Convert.ToDateTime(value.Split(':')[1]);
             progBll.UpdateDate(userID, id, date);
             result = "1";
             break;
         }
         Response.Write(result); Response.Flush(); Response.End();
         #endregion
     }
     DataTable dt = buser.SelByUserID(userID);//用于验证是否有主办或经办权限,已改为与角色绑定,可以不需要使用dt
     oaMod = oaBll.SelReturnModel(appID);
     if (oaMod.Status == (int)ZLEnum.ConStatus.Filed)
     {
         Response.Redirect("FlowView.aspx?action=filed&appid=" + appID);
     }
     if (!IsPostBack)
     {
         #region 权限检测
         M_UserInfo sendmu = buser.GetSelect(oaMod.UserID);
         M_UserInfo mu     = buser.GetLogin();
         ascx = proceBll.SelReturnModel(oaMod.ProID).FlowTlp;
         //回退权限
         if (CurrentStep.HToption > 0)
         {
             if (oaMod.CurStepNum == 0)//如果为起始步,则不管是否有权限都不显示
             {
             }
             else
             {
                 rollBackSpan.Visible = true;
                 rollBackBtn.Visible  = true;
                 if (CurrentStep.HToption == 1)
                 {
                     rollBackDP.Items.Insert(0, new ListItem("回退至上一步", "-1"));
                 }
                 else if (CurrentStep.HToption == 2)
                 {
                     FreeDPDataBind();
                     rollBackDP.Items.Insert(0, new ListItem("回退至上一步", "-1"));
                 }
             }
         }
         //转交权限
         if (CurrentStep.Qzzjoption > 0)
         {
             if (stepBll.IsLastStep(CurrentStep))//如果是最后一步,则也不显示
             {
             }
             else
             {
                 zjSpan.Visible = true;
                 ZJDataBind();
                 zjDP.Items.Insert(0, new ListItem("下一步", "-1"));
             }
         }
         #region 签章
         DataTable signDT = signBll.SelByUserID(buser.GetLogin().UserID);
         if (oaMod.IsComplete)
         {
             signTr.Visible = false;
         }
         else if (signDT != null && signDT.Rows.Count > 0)
         {
             SignRadioBind(signDT);
         }
         else
         {
             signTrRemind.Visible = true;
         }
         SignImgBind();
         #endregion
         //-------------------经办,审阅等权限
         #region 是否是经办,抄送或发起人
         if (CurrentStep.Auth(M_MisProLevel.AuthEnum.Refer, dt))
         {
             //拥有经办权限
             agreeBtn.Visible  = true;
             rejectBtn.Visible = true;
             //检测用户有无修改编号或表单的权限,如果有的话,则显示修改表单栏
             SaveForm_Btn.Visible = true;
             //formop_tr.Visible = true;
         }
         else if (CurrentStep.Auth(M_MisProLevel.AuthEnum.CCUser, dt))
         {
             //拥有抄送权限
             DisAllAuth();
             signTr.Visible  = true;
             ccOPBar.Visible = true;
             if (progBll.CheckApproval(buser.GetLogin().UserID, CurrentStep.stepNum, oaMod.ID))
             {
                 signTr.Visible     = false;
                 ccUser_Btn.Visible = false;
                 ccUser_Lab.Visible = true;
             }
         }
         else if (oaMod.UserID == userID)//发起人查看文件
         {
             DisAllAuth();
         }
         else
         {
             function.WriteErrMsg("你当前无权限批复该公文!!");
         }
         #endregion
         //附件删除权限,拥有权限和附件的时候才显示
         if (CurrentStep.PublicAttachOption > 0 && !string.IsNullOrEmpty(oaMod.PublicAttach))
         {
             //delAttachBtn.Visible = true;
         }
         //显示附件
         if (!string.IsNullOrEmpty(oaMod.PublicAttach))
         {
             function.Script(this, "ZL_Webup.AddReadOnlyLi('" + oaMod.PublicAttach + "');");
         }
         //会签
         if (CurrentStep.HQoption > 0)
         {
             string ids = progBll.SelHQUserID(appID, CurrentStep.stepNum);
             hqTr.Visible = true;
             hqL.Text     = buser.GetUserNameByIDS(ids);
             //如果用户已会签,则不显示拒绝与同意
             if (ids.Split(',').Select(p => p).Contains(buser.GetLogin().UserID.ToString()))
             {
                 opBar.Visible = false;
             }
             //显示未会签人
             string[] allUser = CurrentStep.ReferUser.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
             string   ids2    = StrHelper.RemoveRepeat(allUser, ids.Split(','));//未会签用户
             if (string.IsNullOrEmpty(ids2.Replace(",", "")))
             {
                 unHql.Text = "(办理完成!!!)";
             }
             else
             {
                 unHql.Text = "(尚未办理:" + buser.GetUserNameByIDS(ids2) + ")";
             }
         }
         if (oaMod.Status == -1 || oaMod.Status == 99 || oaMod.Status == 98)
         {
             //如果当前流程已完成,或已被拒绝
             //opBar.Visible = false;
             //delAttachBtn.Visible = false;
         }
         //该栏与上一栏只能显示一个
         if (oaMod.Status == 98 && freeBll.IsLastFreeStep(CurrentStep))//是自由流程,已同意,并且是最后一步时,显示该栏
         {
             if (oaMod.ProType == (int)M_MisProcedure.ProTypes.Free)
             {
                 Free_OP_Tr.Visible = HasNextAuth(CurrentStep, oaMod, mu);
             }
             else if (oaMod.ProType == (int)M_MisProcedure.ProTypes.AdminFree)
             {
                 AdminFree_OP_Tr.Visible = HasNextAuth(CurrentStep, oaMod, mu);
             }
         }
         #region 数据绑定
         //ProceName_L.Text = oaMod.Title;
         ////titleL.Text = oaMod.Title;
         if (!string.IsNullOrEmpty(oaMod.PrivateAttach))
         {
             function.Script(this, "ShowWord();");
         }
         SendMan_L.Text         = sendmu.HoneyName;
         stepNameL.Text         = CurrentStep.stepName;
         OAFormUI.SendDate_ASCX = oaMod.SendDate.ToString();
         createTimeL.Text       = oaMod.SendDate.ToString("yyyy年MM月dd日 HH:mm");
         //txt_Content.Text = oaCom.ReplaceHolder(oaMod);
         ModelID = Convert.ToInt32(proceBll.SelReturnModel(oaMod.ProID).FormInfo);
         DataTable dtContent = conBll.GetContent(Convert.ToInt32(oaMod.Content));
         OAFormUI.InitControl(ViewState, ModelID);
         if (dtContent != null && dtContent.Rows.Count > 0)
         {
             OAFormUI.dataRow = dtContent.Rows[0];
             OAFormUI.MyBind();
         }
         OAFormUI.Title_ASCX = oaMod.Title;
         OAFormUI.NO_ASCX    = oaMod.No;
         DataTable authDT = perBll.SelAuthByRoles(mu.UserRole);
         OAFormUI.No_ASCX_T.Enabled = perBll.CheckAuth(authDT, "oa_pro_no");
         DataBind();
         #endregion
         #endregion
     }
 }
        /*
         *第一步,则不显示回退
         *最后一步,不允许转交
         *一切以CurStepNum为准,必须维护好这个数值
         */
        protected void Page_Load(object sender, EventArgs e)
        {
            userID = buser.GetLogin().UserID;
            if (function.isAjax())//处理AJAX
            {
                string action = Request.Form["action"];
                string value  = Request.Form["value"];
                string result = "0";
                switch (action)
                {
                case "PostDate":
                    int      id   = Convert.ToInt32(value.Split(':')[0]);
                    DateTime date = Convert.ToDateTime(value.Split(':')[1]);
                    try
                    {
                        progBll.UpdateDate(userID, id, date);
                        result = "1";
                    }
                    catch { }
                    break;
                }
                Response.Write(result); Response.Flush(); Response.End();
            }
            EGV.txtFunc = txtPageFunc;
            appID       = DataConverter.CLng(Request.QueryString["AppID"]);
            DataTable dt = buser.SelByUserID(buser.GetLogin().UserID);

            oaMod = oaBll.SelReturnModel(appID);
            if (!IsPostBack)
            {
                M_UserInfo mu = buser.GetSelect(oaMod.UserID);
                //回退权限
                if (CurrentStep.HToption > 0)
                {
                    if (oaMod.CurStepNum == 0)//如果为起始步,则不管是否有权限都不显示
                    {
                    }
                    else
                    {
                        rollBackSpan.Visible = true;
                        rollBackBtn.Visible  = true;
                        if (CurrentStep.HToption == 1)
                        {
                            rollBackDP.Items.Insert(0, new ListItem("回退至上一步", "-1"));
                        }
                        else if (CurrentStep.HToption == 2)
                        {
                            if (oaMod.IsFreePro)
                            {
                                FreeDPDataBind();
                            }
                            else
                            {
                                DPDataBind();
                            }
                            rollBackDP.Items.Insert(0, new ListItem("回退至上一步", "-1"));
                        }
                    }
                }
                //转交权限
                if (CurrentStep.Qzzjoption > 0)
                {
                    if (stepBll.IsLastStep(CurrentStep))//如果是最后一步,则也不显示
                    {
                    }
                    else
                    {
                        zjSpan.Visible = true;
                        ZJDataBind();
                        zjDP.Items.Insert(0, new ListItem("下一步", "-1"));
                    }
                }
                #region 签章
                DataTable signDT = signBll.SelByUserID(buser.GetLogin().UserID);
                if (oaMod.IsComplete)
                {
                    signTr.Visible = false;
                }
                else if (signDT != null && signDT.Rows.Count > 0)
                {
                    SignRadioBind(signDT);
                }
                else
                {
                    signTrRemind.Visible = true;
                }
                SignImgBind();
                #endregion
                //-------------------经办,审阅等权限
                if (CurrentStep.Auth(M_MisProLevel.AuthEnum.Refer, dt))
                {
                    //拥有经办权限
                    agreeBtn.Visible  = true;
                    rejectBtn.Visible = true;
                }
                else if (CurrentStep.Auth(M_MisProLevel.AuthEnum.CCUser, dt))
                {
                    //拥有抄送权限
                    DisAllAuth();
                    signTr.Visible  = true;
                    ccOPBar.Visible = true;
                    if (progBll.CheckApproval(buser.GetLogin().UserID, CurrentStep.stepNum, oaMod.ID))
                    {
                        signTr.Visible     = false;
                        ccUser_Btn.Visible = false;
                        ccUser_Lab.Visible = true;
                    }
                }
                else if (oaMod.UserID == userID)
                {
                    //发起人查看文件
                    DisAllAuth();
                }
                else
                {
                    function.WriteErrMsg("你当前无权限批复该公文!!");
                }
                //附件删除权限,拥有权限和附件的时候才显示
                if (CurrentStep.PublicAttachOption > 0 && !string.IsNullOrEmpty(oaMod.PublicAttach))
                {
                    //delAttachBtn.Visible = true;
                }
                //显示附件
                if (!string.IsNullOrEmpty(oaMod.PublicAttach))
                {
                    string[] af = oaMod.PublicAttach.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    string   h  = "";
                    for (int i = 0; i < af.Length; i++)
                    {
                        h += "<span class='disupFile'>";
                        h += GroupPic.GetShowExtension(GroupPic.GetExtName(af[i]));
                        string filename = Path.GetExtension(af[i]).ToLower().Replace(".", "");
                        if (filename == "docx" || filename == "doc" || filename == "xls" || filename == "xlsx")
                        {
                            h += af[i].Split('/')[(af[i].Split('/').Length - 1)] + "</a><a class='filea' href='/Common/ShowFlash.aspx?path=" + Server.UrlEncode(af[i]) + "&type=1' target='_blank'>(预览)</a><a href='" + af[i] + "'>(下载)</span>";
                        }
                        else
                        {
                            h += "<a href='" + af[i] + "' title='点击下载'>" + af[i].Split('/')[(af[i].Split('/').Length - 1)] + "</a></span>";
                        }
                    }
                    publicAttachTD.InnerHtml = h;
                }
                //会签
                if (CurrentStep.HQoption > 0)
                {
                    string ids = progBll.SelHQUserID(appID, CurrentStep.stepNum);
                    hqTr.Visible = true;
                    hqL.Text     = buser.GetUserNameByIDS(ids);
                    //如果用户已会签,则不显示拒绝与同意
                    if (ids.Split(',').Select(p => p).Contains(buser.GetLogin().UserID.ToString()))
                    {
                        opBar.Visible = false;
                    }
                    //显示未会签人
                    string[] allUser = CurrentStep.ReferUser.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    string   ids2    = RemoveRepeat(allUser, ids.Split(','));//未会签用户
                    if (string.IsNullOrEmpty(ids2.Replace(",", "")))
                    {
                        unHql.Text = "(会签完成!!!)";
                    }
                    else
                    {
                        unHql.Text = "(尚未会签:" + buser.GetUserNameByIDS(ids2) + ")";
                    }
                }
                if (oaMod.Status == -1 || oaMod.Status == 99 || oaMod.Status == 98)
                {
                    //如果当前流程已完成,或已被拒绝
                    //opBar.Visible = false;
                    //delAttachBtn.Visible = false;
                }
                //该栏与上一栏只能显示一个,逻辑上问题,当前是第三步,但第三步未处理完
                if (oaMod.IsFreePro && oaMod.Status == 98 && freeBll.IsLastStep(oaMod, CurrentStep))//是自由流程,已同意,并且是最后一步时,显示该栏
                {
                    Free_OP_Tr.Visible = true;
                }
                titleL.Text      = oaMod.Title;
                sendManL.Text    = mu.HoneyName;
                stepNameL.Text   = CurrentStep.stepName;
                createTimeL.Text = oaMod.CreateTime.ToString("yyyy年MM月dd日 HH:mm");
                if (oaMod.UserID == userID)//签名占位符同样筛选后输出
                {
                    txt_Content.Text = oaCom.ReplaceHolder(oaMod);
                }
                else
                {
                    txt_Content.Text = oaCom.ReplaceHolder(oaMod, "ApproveID =" + userID);
                }
                DataBind();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //需要加上验证权限,发起人,经办人,审核人可查看进程,只要任意一步骤有该权限
            userID = buser.GetLogin().UserID;
            if (function.isAjax())//处理AJAX
            {
                string action = Request.Form["action"];
                string value  = Request.Form["value"];
                string result = "0";
                switch (action)
                {
                case "PostDate":
                    int      id   = Convert.ToInt32(value.Split(':')[0]);
                    DateTime date = Convert.ToDateTime(value.Split(':')[1]);
                    progBll.UpdateDate(userID, id, date);
                    result = "1";
                    break;
                }
                Response.Write(result); Response.Flush(); Response.End();
            }
            DataTable dt = buser.SelByUserID(buser.GetLogin().UserID);

            oaMod = oaBll.SelReturnModel(appID);
            if (!IsPostBack)
            {
                M_UserInfo mu = buser.GetSelect(oaMod.UserID);
                //回退权限
                if (CurrentStep.HToption > 0)
                {
                    if (oaMod.CurStepNum == 0)//如果为起始步,则不管是否有权限都不显示
                    {
                    }
                    else
                    {
                        rollBackSpan.Visible = true;
                        rollBackBtn.Visible  = true;
                        if (CurrentStep.HToption == 1)
                        {
                            rollBackDP.Items.Insert(0, new ListItem("回退至上一步", "-1"));
                        }
                        else if (CurrentStep.HToption == 2)
                        {
                            if (oaMod.IsFreePro)
                            {
                                FreeDPDataBind();
                            }
                            else
                            {
                                DPDataBind();
                            }
                            rollBackDP.Items.Insert(0, new ListItem("回退至上一步", "-1"));
                        }
                    }
                }
                //转交权限
                if (CurrentStep.Qzzjoption > 0)
                {
                    if (stepBll.IsLastStep(CurrentStep))//如果是最后一步,则也不显示
                    {
                    }
                    else
                    {
                        zjSpan.Visible = true;
                        ZJDataBind();
                        zjDP.Items.Insert(0, new ListItem("下一步", "-1"));
                    }
                }
                #region 签章
                DataTable signDT = signBll.SelByUserID(buser.GetLogin().UserID);
                if (oaMod.IsComplete)
                {
                    signTr.Visible = false;
                }
                else if (signDT != null && signDT.Rows.Count > 0)
                {
                    SignRadioBind(signDT);
                }
                else
                {
                    signTrRemind.Visible = true;
                }
                SignImgBind();
                #endregion
                //-------------------经办,审阅等权限
                if (CurrentStep.Auth(M_MisProLevel.AuthEnum.Refer, dt))
                {
                    //拥有经办权限
                    agreeBtn.Visible  = true;
                    rejectBtn.Visible = true;
                }
                else if (CurrentStep.Auth(M_MisProLevel.AuthEnum.CCUser, dt))
                {
                    //拥有抄送权限
                    DisAllAuth();
                    signTr.Visible  = true;
                    ccOPBar.Visible = true;
                    if (progBll.CheckApproval(buser.GetLogin().UserID, CurrentStep.stepNum, oaMod.ID))
                    {
                        signTr.Visible     = false;
                        ccUser_Btn.Visible = false;
                        ccUser_Lab.Visible = true;
                    }
                }
                else if (oaMod.UserID == userID)//发起人查看文件
                {
                    DisAllAuth();
                }
                else
                {
                    function.WriteErrMsg("你当前无权限批复该公文!!");
                }
                //附件删除权限,拥有权限和附件的时候才显示
                if (CurrentStep.PublicAttachOption > 0 && !string.IsNullOrEmpty(oaMod.PublicAttach))
                {
                    //delAttachBtn.Visible = true;
                }
                //显示附件
                if (!string.IsNullOrEmpty(oaMod.PublicAttach))
                {
                    function.Script(this, "ZL_Webup.AddReadOnlyLi('" + oaMod.PublicAttach + "');");
                }
                //会签
                if (CurrentStep.HQoption > 0)
                {
                    string ids = progBll.SelHQUserID(appID, CurrentStep.stepNum);
                    hqTr.Visible = true;
                    hqL.Text     = buser.GetUserNameByIDS(ids);
                    //如果用户已会签,则不显示拒绝与同意
                    if (ids.Split(',').Select(p => p).Contains(buser.GetLogin().UserID.ToString()))
                    {
                        opBar.Visible = false;
                    }
                    //显示未会签人
                    string[] allUser = CurrentStep.ReferUser.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    string   ids2    = StrHelper.RemoveRepeat(allUser, ids.Split(','));//未会签用户
                    if (string.IsNullOrEmpty(ids2.Replace(",", "")))
                    {
                        unHql.Text = "(会签完成!!!)";
                    }
                    else
                    {
                        unHql.Text = "(尚未会签:" + buser.GetUserNameByIDS(ids2) + ")";
                    }
                }
                if (oaMod.Status == -1 || oaMod.Status == 99 || oaMod.Status == 98)
                {
                    //如果当前流程已完成,或已被拒绝
                    //opBar.Visible = false;
                    //delAttachBtn.Visible = false;
                }
                //该栏与上一栏只能显示一个,逻辑上问题,当前是第三步,但第三步未处理完
                if (oaMod.IsFreePro && oaMod.Status == 98 && freeBll.IsLastStep(oaMod, CurrentStep))//是自由流程,已同意,并且是最后一步时,显示该栏
                {
                    Free_OP_Tr.Visible = true;
                }
                ProceName_L.Text = oaMod.Title;
                //titleL.Text = oaMod.Title;
                sendManL.Text    = mu.UserName;
                stepNameL.Text   = CurrentStep.stepName;
                createTimeL.Text = oaMod.CreateTime.ToString("yyyy年MM月dd日 HH:mm");
                //txt_Content.Text = oaCom.ReplaceHolder(oaMod);
                ShowPage(oaMod);
                DataBind();
            }
        }