Exemple #1
0
    private void save(string str)
    {
        try
        {
            if (this.isSecValidate == "1" && !FlowAuditAction.CheckAuditPwd(this.UserCode, this.txtAuditPwd.Text.Trim()))
            {
                this.JS.Text = "alert('审核密码不正确!');";
            }
            else
            {
                string auditInfo     = this.txtAuditInfo.Value.Trim();
                string value         = this.hdnType.Value;
                string insertAuditor = string.Empty;
                if (value == "前插")
                {
                    insertAuditor = this.hdnFrontPerson.Value;
                }
                if (value == "后插")
                {
                    insertAuditor = this.hdnAfterPerson.Value;
                }
                if (value == "前插" || value == "后插")
                {
                    if ((value == "前插" && this.txtFrontPerson.Text == "") || (value == "后插" && this.txtAfterPerson.Text == ""))
                    {
                        base.RegisterScript("alert('请选择" + value + "审核人');");
                    }
                    else
                    {
                        string value2 = this.txtAuditRemark.Value;
                        FlowAuditAction.InsertNode(this.InstanceID, this.UserCode, value, this.IsAllPass, insertAuditor, true, auditInfo, value2);
                        this.SendSMS(this.InstanceID);
                        System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                        if (str == "pc")
                        {
                            stringBuilder.Append("top.ui.refreshDesktop(); \n");
                            stringBuilder.Append("top.ui.show('" + value + "节点成功!'); \n");
                            stringBuilder.Append("top.ui.closeTab();\n");
                        }
                        else
                        {
                            stringBuilder.Append("alert('添加成功');");
                            stringBuilder.Append("parent.location.reload();");
                        }

                        this.JS.Text = stringBuilder.ToString();
                    }
                }
                else
                {
                    int num = System.Convert.ToInt32(this.RBLRoleType.SelectedValue);
                    if (!FlowAuditAction.GetNextOperator(this.InstanceID) && this.txtnextperson.Text == "" && num == 1)
                    {
                        this.JS.Text = "alert('请选择流程下一个审核人');";
                    }
                    else
                    {
                        if (!FlowAuditAction.GetNextOperator(this.InstanceID) && this.txtnextperson.Text != "" && num == 1)
                        {
                            string project = FlowAuditAction.GetProject(this.BusinessCode, this.InstanceCode);
                            if (!FlowAuditAction.SelectNextOperate(this.InstanceID, this.hdnNextPerson.Value.Trim(), int.Parse(this.NodeType.Value), this.UserCode, project))
                            {
                                this.JS.Text = "alert('请找管理员设置" + this.txtnextperson.Text + "的流程负责人');";
                                return;
                            }
                        }
                        if (num == -3 || num == -2)
                        {
                            string[] allFront = FlowAuditAction.GetAllFront(this.InstanceID);
                            for (int i = 0; i < allFront.Length; i++)
                            {
                                this.AddMsg(allFront[i]);
                            }
                            this.DealAgent();
                        }
                        if (num == 1)
                        {
                            this.SendSMS(this.InstanceID);
                        }
                        this.RecieveMsgAdd();
                        FlowAuditAction.ProcessFlow(this.InstanceID, this.IsAllPass, this.UserCode, num, auditInfo);
                        string maxSing = FlowAuditAction.GetMaxSing(this.InstanceID);
                        WFBusinessCodeService wFBusinessCodeService = new WFBusinessCodeService();
                        WFBusinessCode        byId = wFBusinessCodeService.GetById(this.BusinessCode);
                        string path     = base.Server.MapPath("~/SelfEventInfo.xml");
                        string typeName = SelfEventAction.GetTypeName(path, byId.LinkTable, byId.StateField);
                        if (!string.IsNullOrWhiteSpace(typeName))
                        {
                            ISelfEvent selfEvent = (ISelfEvent)System.Reflection.Assembly.Load("PmBusinessLogic").CreateInstance(typeName);
                            if (selfEvent != null)
                            {
                                if (num == 1 && maxSing == "1")
                                {
                                    selfEvent.CommitEvent(this.InstanceCode.ToString());
                                }
                                if (num == -2)
                                {
                                    selfEvent.RefuseEvent(this.InstanceCode.ToString());
                                }
                                if (num == -3)
                                {
                                    selfEvent.RestatedEvent(this.InstanceCode.ToString());
                                }
                            }
                        }
                        if (this.BusinessCode == "089")
                        {
                            PTPrjInfoZTB byId2 = this.ptInfoZTbSer.GetById(this.InstanceCode);
                            if (maxSing == "1" && num == 1)
                            {
                                this.ptInfoZTbSer.UpdatePrjState(byId2, new int?(2));
                            }
                        }
                        else
                        {
                            if (this.BusinessCode == "100")
                            {
                                if (maxSing == "1" && num == 1)
                                {
                                    PrjMember.AddLimit(this.InstanceCode);
                                }
                            }
                            else
                            {
                                if (this.BusinessCode == "107")
                                {
                                    if (maxSing == "1" && num == 1)
                                    {
                                        Progress.UpdateLatest(this.InstanceCode.ToString());
                                    }
                                }
                                else
                                {
                                    if (this.BusinessCode == "108" && maxSing == "1" && num == 1)
                                    {
                                        cn.justwin.BLL.ProgressManagement.Version.UpdateLatest(this.InstanceCode.ToString());
                                    }
                                }
                            }
                        }
                        if (maxSing == "1")
                        {
                            this.MsgOrganiger();
                        }
                        this.Session.Remove("HumanCode");
                        this.Session.Remove("HumanName");
                        this.JS.Text = "auditSuccess();";
                    }
                }
            }
        }
        catch
        {
            base.RegisterScript("alert('系统提示:\\n\\n此审核数据已经失效!')");
        }
    }