Beispiel #1
0
 /// <summary>
 /// 新增信息
 /// </summary>
 /// <param name="_Workflow_OperatorConditionEntity"></param>
 /// <returns>返回string "-1"表示该已经存在,否则成功 </returns>
 public string AddWorkflow_OperatorCondition(Workflow_OperatorConditionEntity _Workflow_OperatorConditionEntity)
 {
     DbParameter[] pramsInsert = {
                                MakeInParam("@BatchSeq",(DbType)SqlDbType.Int,4,_Workflow_OperatorConditionEntity.BatchSeq ),
                                MakeInParam("@BranchBatchSeq",(DbType)SqlDbType.Int,4,_Workflow_OperatorConditionEntity.BranchBatchSeq ),
                                MakeInParam("@RuleID",(DbType)SqlDbType.Int,4,_Workflow_OperatorConditionEntity.RuleID ),
                                MakeInParam("@FieldID",(DbType)SqlDbType.Int,4,_Workflow_OperatorConditionEntity.FieldID ),
                                MakeInParam("@SymbolCode",(DbType)SqlDbType.VarChar,50,_Workflow_OperatorConditionEntity.SymbolCode ),
                                MakeInParam("@CompareToValue",(DbType)SqlDbType.VarChar,200,_Workflow_OperatorConditionEntity.CompareToValue ),
                                MakeInParam("@AndOr",(DbType)SqlDbType.VarChar,50,_Workflow_OperatorConditionEntity.AndOr ),
                                      };
     StringBuilder sb = new StringBuilder();
     sb.Append("INSERT INTO [dbo].[Workflow_OperatorCondition]");
     sb.Append("(");
     sb.Append(" [BatchSeq]");
     sb.Append(",[BranchBatchSeq]");
     sb.Append(",[RuleID]");
     sb.Append(",[FieldID]");
     sb.Append(",[SymbolCode]");
     sb.Append(",[CompareToValue]");
     sb.Append(",[AndOr]");
     sb.Append(") ");
     sb.Append(" VALUES (");
     sb.Append("@BatchSeq,");
     sb.Append("@BranchBatchSeq,");
     sb.Append("@RuleID,");
     sb.Append("@FieldID,");
     sb.Append("@SymbolCode,");
     sb.Append("@CompareToValue,");
     sb.Append("@AndOr )");
     sb.Append("select @@identity;");
     return ExecuteScalar(CommandType.Text, sb.ToString(), pramsInsert).ToString();
 }
Beispiel #2
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            DataTable dtConditonSeq = (DataTable)ViewState["dtConditonSeq"];
            Workflow_OperatorConditionEntity _NodeConditionEntity = new Workflow_OperatorConditionEntity();
            _NodeConditionEntity.RuleID = DNTRequest.GetInt("id", 0);
            DataTable dtMaxSeq = DbHelper.GetInstance().GetDBRecords("MaxBatchSeq=isnull(max(BatchSeq),0)+1", "Workflow_OperatorCondition", "RuleID=" + DNTRequest.GetString("id"), "");
            _NodeConditionEntity.BatchSeq = Convert.ToInt32(dtMaxSeq.Rows[0]["MaxBatchSeq"]);
            for (int i = 0; i < dtConditonSeq.Rows.Count; i++)
            {
                _NodeConditionEntity.BranchBatchSeq = Convert.ToInt32(dtConditonSeq.Rows[i]["BranchBatchSeq"]);
                _NodeConditionEntity.FieldID = Convert.ToInt32(dtConditonSeq.Rows[i]["FieldID"]);
                _NodeConditionEntity.SymbolCode = dtConditonSeq.Rows[i]["SymbolCode"].ToString();
                _NodeConditionEntity.CompareToValue = dtConditonSeq.Rows[i]["CompareToValue"].ToString();
                _NodeConditionEntity.AndOr = dtConditonSeq.Rows[i]["AndOr"].ToString();

                DbHelper.GetInstance().AddWorkflow_OperatorCondition(_NodeConditionEntity);
            }
            dtConditonSeq.Rows.Clear();
            DataRow dr = dtConditonSeq.NewRow();
            dr["BranchBatchSeq"] = 1;
            dr["FieldID"] = 0;
            dr["SymbolCode"] = "";
            dr["CompareToValue"] = "";
            dr["AndOr"] = "";
            dtConditonSeq.Rows.Add(dr);
            BindGridView();
            BindGridView2();
            UpdateSqlCondition();
        }