public string StandAloneFrm_Save() { string frmID = this.GetRequestVal("FrmID"); //定义变量. string field = this.GetRequestVal("DDL_Fields"); field = frmID + "_" + field; int toNodeID = this.GetRequestValInt("ToNodeID"); int fk_Node = this.GetRequestValInt("FK_Node"); string oper = this.GetRequestVal("DDL_Operator"); string operVal = this.GetRequestVal("OperVal"); //节点,子线城,还是其他 CondType condTypeEnum = (CondType)this.GetRequestValInt("CondType"); //把其他的条件都删除掉. DBAccess.RunSQL("DELETE FROM WF_Cond WHERE (CondType=" + (int)condTypeEnum + " AND NodeID=" + this.FK_Node + " AND ToNodeID=" + toNodeID + ") AND DataFrom!=" + (int)ConnDataFrom.NodeForm); Cond cond = new Cond(); cond.HisDataFrom = ConnDataFrom.StandAloneFrm; cond.NodeID = fk_Node; cond.ToNodeID = toNodeID; cond.FK_Node = this.FK_Node; cond.FK_Operator = oper; cond.OperatorValue = operVal; //操作值. cond.FK_Attr = field; //字段属性. // cond.OperatorValueT = ""; // this.GetOperValText; cond.FK_Flow = this.FK_Flow; cond.HisCondType = condTypeEnum; ; //保存类型. if (this.GetRequestVal("SaveType").Equals("AND") == true) { cond.CondOrAnd = CondOrAnd.ByAnd; } else { cond.CondOrAnd = CondOrAnd.ByOr; } #region 方向条件,全部更新. Conds conds = new Conds(); QueryObject qo = new QueryObject(conds); qo.AddWhere(CondAttr.NodeID, this.FK_Node); qo.addAnd(); qo.AddWhere(CondAttr.DataFrom, (int)ConnDataFrom.StandAloneFrm); qo.addAnd(); qo.AddWhere(CondAttr.CondType, (int)condTypeEnum); if (toNodeID != 0) { qo.addAnd(); qo.AddWhere(CondAttr.ToNodeID, toNodeID); } int num = qo.DoQuery(); foreach (Cond item in conds) { item.CondOrAnd = cond.CondOrAnd; item.Update(); } #endregion /* 执行同步*/ string sqls = "UPDATE WF_Node SET IsCCFlow=0"; sqls += "@UPDATE WF_Node SET IsCCFlow=1 WHERE NodeID IN (SELECT NODEID FROM WF_Cond a WHERE a.NodeID= NodeID AND CondType=1 )"; BP.DA.DBAccess.RunSQLs(sqls); string sql = "UPDATE WF_Cond SET DataFrom=" + (int)ConnDataFrom.StandAloneFrm + " WHERE NodeID=" + cond.NodeID + " AND FK_Node=" + cond.FK_Node + " AND ToNodeID=" + toNodeID; switch (condTypeEnum) { case CondType.Flow: case CondType.Node: cond.MyPK = BP.DA.DBAccess.GenerOID().ToString(); //cond.NodeID + "_" + cond.FK_Node + "_" + cond.FK_Attr + "_" + cond.OperatorValue; cond.Insert(); BP.DA.DBAccess.RunSQL(sql); break; case CondType.Dir: // cond.MyPK = cond.NodeID +"_"+ this.Request.QueryString["ToNodeID"]+"_" + cond.FK_Node + "_" + cond.FK_Attr + "_" + cond.OperatorValue; cond.MyPK = BP.DA.DBAccess.GenerOID().ToString(); //cond.NodeID + "_" + cond.FK_Node + "_" + cond.FK_Attr + "_" + cond.OperatorValue; cond.ToNodeID = toNodeID; cond.Insert(); BP.DA.DBAccess.RunSQL(sql); break; case CondType.SubFlow: //启动子流程. cond.MyPK = BP.DA.DBAccess.GenerOID().ToString(); //cond.NodeID + "_" + cond.FK_Node + "_" + cond.FK_Attr + "_" + cond.OperatorValue; cond.ToNodeID = toNodeID; cond.Insert(); BP.DA.DBAccess.RunSQL(sql); break; default: throw new Exception("未设计的情况。" + condTypeEnum.ToString()); } return("保存成功!!"); }
public string CondByDept_Save() { int FK_MainNode = this.GetRequestValInt("FK_MainNode"); int ToNodeID = this.GetRequestValInt("ToNodeID"); CondType condType = (CondType)this.GetRequestValInt("CondType"); Cond cond = new Cond(); //把其他的条件都删除掉. DBAccess.RunSQL("DELETE FROM WF_Cond WHERE (CondType=" + (int)condType + " AND NodeID=" + this.FK_Node + " AND ToNodeID=" + this.GetRequestValInt("ToNodeID") + ") AND DataFrom!=" + (int)ConnDataFrom.Depts); string mypk = this.GetRequestValInt("FK_MainNode") + "_" + this.GetRequestValInt("ToNodeID") + "_" + condType.ToString() + "_" + ConnDataFrom.Depts.ToString(); cond.MyPK = mypk; if (cond.RetrieveFromDBSources() == 0) { cond.HisDataFrom = ConnDataFrom.Depts; cond.NodeID = this.GetRequestValInt("FK_MainNode"); cond.FK_Flow = this.FK_Flow; cond.ToNodeID = this.GetRequestValInt("ToNodeID"); cond.Insert(); } string val = this.GetRequestVal("depts").Replace(",", "@"); cond.OperatorValue = val; cond.SpecOperWay = (SpecOperWay)this.GetRequestValInt("DDL_SpecOperWay"); if (cond.SpecOperWay != SpecOperWay.CurrOper) { cond.SpecOperPara = this.GetRequestVal("TB_SpecOperPara"); } else { cond.SpecOperPara = string.Empty; } cond.HisDataFrom = ConnDataFrom.Depts; cond.FK_Flow = this.FK_Flow; cond.HisCondType = CondType.Dir; cond.FK_Node = FK_MainNode; cond.ToNodeID = ToNodeID; cond.Update(); return("保存成功!!"); }
public string CondByDept_Save() { int FK_MainNode = this.GetRequestValInt("FK_MainNode"); int ToNodeID = this.GetRequestValInt("ToNodeID"); CondType condType = (CondType)this.GetRequestValInt("CondType"); Cond cond = new Cond(); cond.Delete(CondAttr.NodeID, this.GetRequestValInt("FK_MainNode"), CondAttr.ToNodeID, this.GetRequestValInt("ToNodeID"), CondAttr.CondType, (int)condType); string mypk = this.GetRequestValInt("FK_MainNode") + "_" + this.GetRequestValInt("ToNodeID") + "_" + condType.ToString() + "_" + ConnDataFrom.Depts.ToString(); cond.MyPK = mypk; if (cond.RetrieveFromDBSources() == 0) { cond.HisDataFrom = ConnDataFrom.Depts; cond.NodeID = this.GetRequestValInt("FK_MainNode"); cond.FK_Flow = this.FK_Flow; cond.ToNodeID = this.GetRequestValInt("ToNodeID"); cond.Insert(); } string val = this.GetRequestVal("depts").Replace(",", "@"); cond.OperatorValue = val; cond.SpecOperWay = (SpecOperWay)this.GetRequestValInt("DDL_SpecOperWay"); if (cond.SpecOperWay != SpecOperWay.CurrOper) { cond.SpecOperPara = this.GetRequestVal("TB_SpecOperPara"); } else { cond.SpecOperPara = string.Empty; } cond.HisDataFrom = ConnDataFrom.Depts; cond.FK_Flow = this.FK_Flow; cond.HisCondType = CondType.Dir; cond.FK_Node = FK_MainNode; cond.ToNodeID = ToNodeID; cond.Update(); return("保存成功!!"); }