Пример #1
0
    private void BtnAdd_Click(object sender, System.EventArgs e)
    {
        string text     = StringHelper.FilterSpecial(this.txtNodeName.Text.Trim());
        string arg_21_0 = this.hdnOperater.Value;
        string pStr     = "";

        if (this.rbSingle.Checked)
        {
            pStr = "1";
        }
        if (this.rbMilti.Checked)
        {
            pStr = "2";
        }
        if (this.rbGroup.Checked)
        {
            pStr = "3";
        }
        if (this.rbItem.Checked)
        {
            pStr = "4";
        }
        if (this.rbDept.Checked)
        {
            pStr = "5";
        }
        string pStr2 = "1";
        string pStr3;

        if (this.rbIsAllPass1.Checked)
        {
            pStr3 = "1";
        }
        else
        {
            pStr3 = "0";
        }
        string pStr4;

        if (this.CkbIsSec.Checked)
        {
            pStr4 = "1";
            userManageDb userManageDb = new userManageDb();
            string[]     array        = this.hdnOperater.Value.Split(new char[44]);
            if (array.Length > 0)
            {
                for (int i = 0; i < array.Length; i++)
                {
                    DataTable auditPwd = userManageDb.GetAuditPwd(array[i]);
                    if (auditPwd.Rows.Count > 0)
                    {
                        auditPwd.Rows[0]["AuditPwd"].ToString();
                        if (string.IsNullOrEmpty(auditPwd.Rows[0]["AuditPwd"].ToString()))
                        {
                            userManageDb.updateUserAuditPwd(array[i], "easy");
                        }
                    }
                }
            }
        }
        else
        {
            pStr4 = "0";
        }
        string pStr5;

        if (this.CkbIsSelReceiver.Checked)
        {
            pStr5 = "1";
        }
        else
        {
            pStr5 = "0";
        }
        string text2 = this.txtRemark.Text;
        string value = this.hdnFrontNode.Value;

        System.Collections.Hashtable hashtable = new System.Collections.Hashtable();
        hashtable.Add("TemplateID", this.TemplateID.ToString());
        hashtable.Add("NodeName", SqlStringConstructor.GetQuotedString(text));
        hashtable.Add("Operater", SqlStringConstructor.GetQuotedString(this.hdnOperater.Value));
        hashtable.Add("AuditorType", SqlStringConstructor.GetQuotedString(pStr));
        hashtable.Add("IsSendMsg", SqlStringConstructor.GetQuotedString(pStr2));
        hashtable.Add("IsAllPass", SqlStringConstructor.GetQuotedString(pStr3));
        hashtable.Add("ConditionDescription", SqlStringConstructor.GetQuotedString(text2));
        hashtable.Add("During", this.txtDuring.Text.Trim());
        hashtable.Add("FrontNode", SqlStringConstructor.GetQuotedString(value));
        hashtable.Add("IsSecValidate", SqlStringConstructor.GetQuotedString(pStr4));
        hashtable.Add("IsSelReceiver", SqlStringConstructor.GetQuotedString(pStr5));
        hashtable.Add("AuditMain", SqlStringConstructor.GetQuotedString(this.txtAuditMain.Text));
        hashtable.Add("DueMode", SqlStringConstructor.GetQuotedString(this.RbDueMode.SelectedValue));
        hashtable.Add("DepCode", SqlStringConstructor.GetQuotedString(this.hfldDep.Value));
        hashtable.Add("Id", SqlStringConstructor.GetQuotedString(System.Guid.NewGuid().ToString()));
        string pos = this.hdnPos.Value.ToString();

        if (!this.CkbIsSelReceiver.Checked)
        {
            if (text != "" && this.hdnOperater.Value.ToString().Trim() != "" && this.txtDuring.Text.ToString().Trim() != "")
            {
                if (this.NodeID != 0)
                {
                    string where = " Where NodeID = " + this.NodeID.ToString();
                    if (FlowTemplateAction.UpdNode(hashtable, where) && FlowChartAction.UpdateFlowChart(this.xpos, this.ypos, pos, this.FrontNodeOld, value, this.NodeID, this.TemplateID, text, text2, this.types))
                    {
                        base.RegisterScript("top.ui.winSuccess({ parentName: '_flowchart' });");
                        return;
                    }
                }
                else
                {
                    object obj = FlowTemplateAction.AddNode(hashtable);
                    if (obj != null)
                    {
                        int    num       = System.Convert.ToInt32(obj);
                        string sqlString = string.Concat(new object[]
                        {
                            "SELECT * FROM WF_TemplateNode WHERE FrontNode='",
                            value,
                            "' AND TemplateID=",
                            this.TemplateID,
                            " AND NodeID !=",
                            num,
                            " "
                        });
                        DataTable dataTable = publicDbOpClass.DataTableQuary(sqlString);
                        if (dataTable.Rows.Count > 0)
                        {
                            string sqlString2 = string.Concat(new object[]
                            {
                                " UPDATE WF_TemplateNode SET FrontNode=",
                                num,
                                " WHERE FrontNode='",
                                value,
                                "' AND TemplateID=",
                                this.TemplateID,
                                " AND NodeID !=",
                                num,
                                " "
                            });
                            bool flag = publicDbOpClass.NonQuerySqlString(sqlString2);
                            if (flag && FlowChartAction.CreateNewFlowChart(this.xpos, this.ypos, this.FrontNode.ToString(), num, this.TemplateID, text, this.types))
                            {
                                base.RegisterScript("top.ui.winSuccess({ parentName: '_flowchart' });");
                                return;
                            }
                        }
                        else
                        {
                            if (FlowChartAction.CreateNewFlowChart(this.xpos, this.ypos, this.FrontNode.ToString(), num, this.TemplateID, text, this.types))
                            {
                                base.RegisterScript("top.ui.winSuccess({ parentName: '_flowchart' });");
                                return;
                            }
                        }
                    }
                }
            }
        }
        else
        {
            if (text != "" && this.txtDuring.Text.ToString().Trim() != "")
            {
                if (this.NodeID != 0)
                {
                    string where2 = " Where NodeID = " + this.NodeID.ToString();
                    if (FlowTemplateAction.UpdNode(hashtable, where2) && FlowChartAction.UpdateFlowChart(this.xpos, this.ypos, pos, this.FrontNodeOld, value, this.NodeID, this.TemplateID, text, text2, this.types))
                    {
                        base.RegisterScript("top.ui.winSuccess({ parentName: '_flowchart' });");
                        return;
                    }
                }
                else
                {
                    object obj2 = FlowTemplateAction.AddNode(hashtable);
                    if (obj2 != null)
                    {
                        int num2 = System.Convert.ToInt32(obj2);
                        value.IndexOf(",");
                        string sqlString3 = string.Concat(new object[]
                        {
                            "SELECT * FROM WF_TemplateNode WHERE FrontNode='",
                            value,
                            "' AND TemplateID=",
                            this.TemplateID,
                            " AND NodeID !=",
                            num2,
                            " "
                        });
                        DataTable dataTable2 = publicDbOpClass.DataTableQuary(sqlString3);
                        if (dataTable2.Rows.Count > 0)
                        {
                            string sqlString4 = string.Concat(new object[]
                            {
                                " UPDATE WF_TemplateNode SET FrontNode=",
                                num2,
                                " WHERE FrontNode='",
                                value,
                                "' AND TemplateID=",
                                this.TemplateID,
                                " AND NodeID !=",
                                num2,
                                " "
                            });
                            bool flag2 = publicDbOpClass.NonQuerySqlString(sqlString4);
                            if (flag2 && FlowChartAction.CreateNewFlowChart(this.xpos, this.ypos, this.FrontNode.ToString(), num2, this.TemplateID, text, this.types))
                            {
                                base.RegisterScript("top.ui.winSuccess({ parentName: '_flowchart' });");
                                return;
                            }
                        }
                        else
                        {
                            if (FlowChartAction.CreateNewFlowChart(this.xpos, this.ypos, this.FrontNode.ToString(), num2, this.TemplateID, text, this.types))
                            {
                                base.RegisterScript("top.ui.winSuccess({ parentName: '_flowchart' });");
                            }
                        }
                    }
                }
            }
        }
    }