/// <summary> /// 新增信息 /// </summary> /// <param name="_Workflow_NodeTriggerConditionEntity"></param> /// <returns>返回string "-1"表示该已经存在,否则成功 </returns> public string AddWorkflow_NodeTriggerCondition(Workflow_NodeTriggerConditionEntity _Workflow_NodeTriggerConditionEntity) { DbParameter[] pramsInsert = { MakeInParam("@ConditionID",(DbType)SqlDbType.Int,4,_Workflow_NodeTriggerConditionEntity.ConditionID ), MakeInParam("@BatchSeq",(DbType)SqlDbType.TinyInt ,1,_Workflow_NodeTriggerConditionEntity.BatchSeq ), MakeInParam("@BranchBatchSeq",(DbType)SqlDbType.TinyInt,1,_Workflow_NodeTriggerConditionEntity.BranchBatchSeq ), MakeInParam("@TriggerID",(DbType)SqlDbType.Int,4,_Workflow_NodeTriggerConditionEntity.TriggerID ), MakeInParam("@FieldID",(DbType)SqlDbType.Int,4,_Workflow_NodeTriggerConditionEntity.FieldID ), MakeInParam("@SymbolCode",(DbType)SqlDbType.VarChar,50,_Workflow_NodeTriggerConditionEntity.SymbolCode ), // MakeInParam("@CompareFieldID",(DbType)SqlDbType.Int,4,_Workflow_NodeTriggerConditionEntity. ), MakeInParam("@CompareToValue",(DbType)SqlDbType.VarChar,200,_Workflow_NodeTriggerConditionEntity.CompareToValue ), MakeInParam("@AndOr",(DbType)SqlDbType.VarChar,20,_Workflow_NodeTriggerConditionEntity.AndOr ) }; StringBuilder sb = new StringBuilder(); sb.Append("INSERT INTO [dbo].[Workflow_NodeTriggerCondition]"); sb.Append("("); sb.Append("[BatchSeq]"); sb.Append(",[BranchBatchSeq]"); sb.Append(",[TriggerID]"); sb.Append(",[FieldID]"); sb.Append(",[SymbolCode]"); // sb.Append(",[CompareFieldID]"); sb.Append(",[CompareToValue]"); sb.Append(",[AndOr]"); sb.Append(") "); sb.Append(" VALUES ("); sb.Append("@BatchSeq,"); sb.Append("@BranchBatchSeq,"); sb.Append("@TriggerID,"); sb.Append("@FieldID,"); sb.Append("@SymbolCode,"); // sb.Append("@CompareFieldID,"); sb.Append("@CompareToValue,"); sb.Append("@AndOr"); sb.Append("); "); sb.Append("select @@identity;"); return ExecuteScalar(CommandType.Text, sb.ToString(), pramsInsert).ToString(); }
private Workflow_NodeTriggerConditionEntity GetWorkflow_NodeTriggerConditionFromIDataReader(DbDataReader dr) { Workflow_NodeTriggerConditionEntity dt = new Workflow_NodeTriggerConditionEntity(); if (dr.FieldCount > 0) { if (dr["ConditionID"].ToString() != "" || dr["ConditionID"] != null) dt.ConditionID = Int32.Parse(dr["ConditionID"].ToString()); dt.BatchSeq = Convert.ToByte(dr["BatchSeq"]); dt.BranchBatchSeq = Convert.ToByte(dr["BranchBatchSeq"]); if (dr["TriggerID"].ToString() != "" || dr["TriggerID"] != null) dt.TriggerID = Int32.Parse(dr["TriggerID"].ToString()); if (dr["FieldID"].ToString() != "" || dr["FieldID"] != null) dt.FieldID = Int32.Parse(dr["FieldID"].ToString()); dt.SymbolCode = dr["SymbolCode"].ToString(); dt.CompareToValue = dr["CompareToValue"].ToString(); dt.AndOr = dr["AndOr"].ToString(); dr.Close(); return dt; } dr.Close(); return null; }
protected void btnAdd_Click(object sender, EventArgs e) { DataTable dtConditonSeq = (DataTable)ViewState["dtConditonSeq"]; Workflow_NodeTriggerConditionEntity _NodeConditionEntity = new Workflow_NodeTriggerConditionEntity(); _NodeConditionEntity.TriggerID = DNTRequest.GetInt("id", 0); DataTable dtMaxSeq = DbHelper.GetInstance().GetDBRecords("MaxBatchSeq=isnull(max(BatchSeq),0)+1", "Workflow_NodeTriggerCondition", "TriggerID=" + DNTRequest.GetString("id"), ""); _NodeConditionEntity.BatchSeq = Convert.ToByte (dtMaxSeq.Rows[0]["MaxBatchSeq"]); for (int i = 0; i < dtConditonSeq.Rows.Count; i++) { _NodeConditionEntity.BranchBatchSeq = Convert.ToByte(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_NodeTriggerCondition (_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(); }