Beispiel #1
0
        private void UpdateSqlCondition()
        {
            JavaScriptSerializer js = new JavaScriptSerializer();
            List<Workflow_NodeConditionEntity> list_lnc = new List<Workflow_NodeConditionEntity>();
            foreach (DataRow dr in dtCon.Rows)
            {
                Workflow_NodeConditionEntity lnc = new Workflow_NodeConditionEntity();
              //  lnc.ConditionID = Convert.ToInt32(dr["ConditionID"]);
                lnc.BatchSeq = Convert.ToInt32(dr["BatchSeq"]);
                lnc.BranchBatchSeq = Convert.ToInt32(dr["BranchBatchSeq"]);
                lnc.LinkID = Convert.ToInt32(dr["LinkID"]);
                lnc.FieldID = Convert.ToInt32(dr["FieldID"]);
                lnc.SymbolCode = dr["SymbolCode"].ToString();
                lnc.CompareToValue = dr["CompareToValue"].ToString();
                lnc.AndOr = dr["AndOr"].ToString();

                list_lnc.Add(lnc);
            }
            condition = js.Serialize(list_lnc);  //插入到表中的数据

            string sql = getSQL();  //workflow_nodelink表中的SqlCondition

            resultsql = sql;   //sql语句

            //string[] resultString = Regex.Split(resultsql, "or", RegexOptions.None);
               //string[] r=   resultsql.Split(new char[6] { ')', ' ', 'o', 'r', ' ', '(' });
            //DbHelper.GetInstance().ExecSqlText(string.Format("update Workflow_NodeLink set SqlCondition='({0})' where LinkID={1}", sql, DNTRequest.GetString("id")));
               // DbHelper.GetInstance().UpdateSqlCondition(sql, DNTRequest.GetString("id"));
        }
Beispiel #2
0
        private string addCondition(DataTable dtConditonSeq)
        {
            Workflow_NodeConditionEntity _NodeConditionEntity = new Workflow_NodeConditionEntity();

            DataTable dt = (DataTable)GridView2.DataSource;

            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();

                List_nodeCondition.Add(_NodeConditionEntity);
            }

            return new JavaScriptSerializer().Serialize(List_nodeCondition);
        }
Beispiel #3
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            DataTable dtConditonSeq = (DataTable)ViewState["dtConditonSeq"];
            //addCondition(dtConditonSeq);

            Workflow_NodeConditionEntity _NodeConditionEntity = new Workflow_NodeConditionEntity();
               // _NodeConditionEntity.LinkID = DNTRequest.GetInt("id", 0);
             //   DataTable dtMaxSeq = DbHelper.GetInstance().GetDBRecords("MaxBatchSeq=isnull(max(BatchSeq),0)+1", "Workflow_NodeCondition", "LinkID=" + 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();

                DataRow myrow =dtCon.NewRow();
                myrow["ConditionID"] = dtCon.Rows.Count + 1;
                myrow["BatchSeq"] = icount;
                myrow["BranchBatchSeq"] = _NodeConditionEntity.BranchBatchSeq;
                myrow["LinkID"] = _NodeConditionEntity.LinkID;
                myrow["FieldID"] = _NodeConditionEntity.FieldID;
                myrow["SymbolCode"] = _NodeConditionEntity.SymbolCode;
                myrow["CompareToValue"] = _NodeConditionEntity.CompareToValue;
                myrow["AndOr"] = _NodeConditionEntity.AndOr;
                myrow["CreateDate"] = DateTime.Today;

               DataTable dtSymbolName = DbHelper.GetInstance().GetDBRecords("SymbolName", "Workflow_CompareSymbol","SymbolCode="+_NodeConditionEntity.SymbolCode,"DisplayOrder");
               DataTable dtFieldLabel = DbHelper.GetInstance().GetDBRecords("a.FieldLabel", "Workflow_FormField a,Workflow_Base b", "b.WorkflowID=" + DNTRequest.GetString("id")
               + " and a.FormID=b.FormID and a.FieldID=" + _NodeConditionEntity.FieldID, "a.DisplayOrder");

                   myrow["SymbolName"]= dtSymbolName.Rows[0][0];
                   myrow["FieldLabel"] = dtFieldLabel.Rows[0][0];

                dtCon.Rows.Add(myrow);
             //   DbHelper.GetInstance().AddWorkflow_NodeCondition(_NodeConditionEntity);  //增加到NodeConditiion表中
            }
            icount++;

            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();
        }
Beispiel #4
0
 /// <summary>
 /// 新增信息
 /// </summary>
 /// <param name="_Workflow_NodeConditionEntity"></param>
 /// <returns>返回string "-1"表示该已经存在,否则成功 </returns>
 public string AddWorkflow_NodeCondition(Workflow_NodeConditionEntity _Workflow_NodeConditionEntity)
 {
     DbParameter[] pramsInsert = {
                                MakeInParam("@BatchSeq",(DbType)SqlDbType.Int,4,_Workflow_NodeConditionEntity.BatchSeq ),
                                MakeInParam("@BranchBatchSeq",(DbType)SqlDbType.Int,4,_Workflow_NodeConditionEntity.BranchBatchSeq ),
                                MakeInParam("@LinkID",(DbType)SqlDbType.Int,4,_Workflow_NodeConditionEntity.LinkID ),
                                MakeInParam("@FieldID",(DbType)SqlDbType.Int,4,_Workflow_NodeConditionEntity.FieldID ),
                                MakeInParam("@SymbolCode",(DbType)SqlDbType.VarChar,50,_Workflow_NodeConditionEntity.SymbolCode ),
                                MakeInParam("@CompareToValue",(DbType)SqlDbType.VarChar,200,_Workflow_NodeConditionEntity.CompareToValue ),
                                MakeInParam("@AndOr",(DbType)SqlDbType.VarChar,50,_Workflow_NodeConditionEntity.AndOr ),
                                      };
     StringBuilder sb = new StringBuilder();
     sb.Append("INSERT INTO [dbo].[Workflow_NodeCondition]");
     sb.Append("(");
     sb.Append(" [BatchSeq]");
     sb.Append(",[BranchBatchSeq]");
     sb.Append(",[LinkID]");
     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("@LinkID,");
     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 #5
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            DataTable dtConditonSeq = (DataTable)ViewState["dtConditonSeq"];
            Workflow_NodeConditionEntity _NodeConditionEntity = new Workflow_NodeConditionEntity();
            _NodeConditionEntity.LinkID = DNTRequest.GetInt("id", 0);
            DataTable dtMaxSeq = DbHelper.GetInstance().GetDBRecords("MaxBatchSeq=isnull(max(BatchSeq),0)+1", "Workflow_NodeCondition", "LinkID=" + 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_NodeCondition(_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();
        }
Beispiel #6
0
        private string AddNodeCondition(int LinkID,List<Workflow_NodeConditionEntity> wnc)
        {
            string result = "";
            Workflow_NodeConditionEntity _NodeConditionEntity = new Workflow_NodeConditionEntity();
            _NodeConditionEntity.LinkID = LinkID;

            DataTable dtMaxSeq = DbHelper.GetInstance().GetDBRecords("MaxBatchSeq=isnull(max(BatchSeq),0)+1", "Workflow_NodeCondition", "LinkID=" + LinkID, "");
            _NodeConditionEntity.BatchSeq = Convert.ToInt32(dtMaxSeq.Rows[0]["MaxBatchSeq"]);

            foreach (var i in wnc)
            {
                _NodeConditionEntity.BranchBatchSeq = i.BranchBatchSeq;
                _NodeConditionEntity.FieldID = i.FieldID;
                _NodeConditionEntity.SymbolCode = i.SymbolCode;
                _NodeConditionEntity.CompareToValue = i.CompareToValue;
                _NodeConditionEntity.AndOr = i.AndOr;

                result=DbHelper.GetInstance().AddWorkflow_NodeCondition(_NodeConditionEntity);  //增加到NodeConditiion表中
            }

            return result;
        }