Пример #1
0
        public GroupLineSelect()
        {
            FieldID = DNTRequest.GetInt("FieldID", 0);
            DataSetID = DNTRequest.GetInt("DataSetID", 0);
            //FormID = DNTRequest.GetInt("FormID", 0); ;
            dsEntity = DbHelper.GetInstance().GetWorkflow_DataSetEntityByKeyCol(DataSetID.ToString());
            string[] splitStr = new string[1];
            splitStr[0] = ",";
            string[] returnColumns = dsEntity.ReturnColumns.Split(splitStr, StringSplitOptions.RemoveEmptyEntries);
            SelectColumns = returnColumns;
            string[] returnColumnsName = dsEntity.ReturnColumnsName.Split(splitStr, StringSplitOptions.RemoveEmptyEntries);
            for (int j = 0; j < returnColumns.Length; j++)
            {
                nvc.Add(returnColumns[j], returnColumnsName[j]);

            }
            dsKeyColumns = dsEntity.DataSetPKColumns.Split(splitStr, StringSplitOptions.RemoveEmptyEntries);

            //获取参数列表
            dtParameters = DbHelper.GetInstance().GetWorkflow_DataSetParameterEntityByKeyCol(DataSetID.ToString());
            dtIniteSearchResult = DbHelper.GetInstance().GetDataSetTable(DataSetID, dtParameters);

            DataColumn[] PKdtSearchResult = new DataColumn[dsKeyColumns.Length];
            for (int p = 0; p < dsKeyColumns.Length; p++)
            {
                PKdtSearchResult[p] = dtIniteSearchResult.Columns[dsKeyColumns[p]];
            }

            dtIniteSearchResult.PrimaryKey = PKdtSearchResult;
        }
Пример #2
0
 private Workflow_DataSetEntity GetWorkflow_DataSetFromIDataReader(DbDataReader dr)
 {
     Workflow_DataSetEntity dt = new Workflow_DataSetEntity();
     if (dr.FieldCount > 0)
     {
         if (dr["DataSetID"].ToString() != "" || dr["DataSetID"] != null) dt.DataSetID = Int32.Parse(dr["DataSetID"].ToString());
         if (dr["DataSetType"].ToString() != "" || dr["DataSetType"] != null) dt.DataSetType = Int32.Parse(dr["DataSetType"].ToString());
         dt.DataSetName = dr["DataSetName"].ToString();
         if (dr["DataSourceID"].ToString() != "" || dr["DataSourceID"] != null) dt.DataSourceID = Int32.Parse(dr["DataSourceID"].ToString());
         dt.TableList = dr["TableList"].ToString();
         dt.FieldList = dr["FieldList"].ToString();
         dt.QueryCondition = dr["QueryCondition"].ToString();
         dt.OrderBy = dr["OrderBy"].ToString();
         dt.QuerySql = dr["QuerySql"].ToString();
         dt.ReturnColumns = dr["ReturnColumns"].ToString();
         dt.ReturnColumnsName = dr["ReturnColumnsName"].ToString();
         dt.DataSetPKColumns = dr["DataSetPKColumns"].ToString();
         dr.Close();
         return dt;
     }
     dr.Close();
     return null;
 }
Пример #3
0
 /// <summary>
 /// 修改信息
 /// </summary>
 /// <param name="_Workflow_DataSetEntity"></param>
 /// <returns>返回string "-1"表示该已经存在,否则成功 </returns>
 public int UpdateWorkflow_DataSetForStoredProcedure(Workflow_DataSetEntity _Workflow_DataSetEntity)
 {
     DbParameter[] pramsUpdate = {
                                      MakeInParam("@DataSetName",(DbType)SqlDbType.VarChar,50,_Workflow_DataSetEntity.DataSetName ),
                                      MakeInParam("@DataSourceID",(DbType)SqlDbType.Int,4,_Workflow_DataSetEntity.DataSourceID ),
                                      MakeInParam("@TableList",(DbType)SqlDbType.VarChar,2000,_Workflow_DataSetEntity.TableList ),
                                      MakeInParam("@QueryCondition",(DbType)SqlDbType.VarChar,2000,_Workflow_DataSetEntity.QueryCondition ),
                                      MakeInParam("@ReturnColumns",(DbType)SqlDbType.VarChar,2000,_Workflow_DataSetEntity.ReturnColumns ),
                                      MakeInParam("@DataSetPKColumns",(DbType)SqlDbType.VarChar,2000,_Workflow_DataSetEntity.DataSetPKColumns ),
                                      MakeInParam("@ReturnColumnsName",(DbType)SqlDbType.VarChar,2000,_Workflow_DataSetEntity.ReturnColumnsName ),
                                      MakeInParam("@DataSetID",(DbType)SqlDbType.Int,4,_Workflow_DataSetEntity.DataSetID )
                                  };
     StringBuilder sb = new StringBuilder();
     sb.Append("Update [dbo].[Workflow_DataSet]");
     sb.Append(" set ");
     sb.Append(" [DataSetType]=2,");
     sb.Append(" [DataSetName]=@DataSetName,");
     sb.Append(" [DataSourceID]=@DataSourceID,");
     sb.Append(" [TableList]=@TableList,");
     sb.Append(" [QueryCondition]=@QueryCondition,");
     sb.Append(" [ReturnColumns]=@ReturnColumns,");
     sb.Append(" [DataSetPKColumns]=@DataSetPKColumns,");
     sb.Append(" [ReturnColumnsName]=@ReturnColumnsName");
     sb.Append(" where [DataSetID]=@DataSetID; select @@rowcount");
     return Convert.ToInt32(ExecuteScalar(CommandType.Text, sb.ToString(), pramsUpdate));
 }
Пример #4
0
 /// <summary>
 /// 新增信息
 /// </summary>
 /// <param name="_Workflow_DataSetEntity"></param>
 /// <returns>返回string "-1"表示该已经存在,否则成功 </returns>
 public int AddWorkflow_DataSetSP(Workflow_DataSetEntity _Workflow_DataSetEntity)
 {
     DbParameter[] pramsInsert = {
                                MakeInParam("@DataSetType",(DbType)SqlDbType.Int,4,_Workflow_DataSetEntity.DataSetType ),
                                MakeInParam("@DataSetName",(DbType)SqlDbType.VarChar,50,_Workflow_DataSetEntity.DataSetName ),
                                MakeInParam("@DataSourceID",(DbType)SqlDbType.Int,4,_Workflow_DataSetEntity.DataSourceID ),
                                MakeInParam("@TableList",(DbType)SqlDbType.VarChar,2000,_Workflow_DataSetEntity.TableList ),
                                MakeInParam("@QueryCondition",(DbType)SqlDbType.VarChar,2000,_Workflow_DataSetEntity.QueryCondition ),
                                MakeInParam("@ReturnColumns",(DbType)SqlDbType.VarChar,2000,_Workflow_DataSetEntity.ReturnColumns ),
                                MakeInParam("@DataSetPKColumns",(DbType)SqlDbType.VarChar,2000,_Workflow_DataSetEntity.DataSetPKColumns ),
                                MakeInParam("@ReturnColumnsName",(DbType)SqlDbType.VarChar,2000,_Workflow_DataSetEntity.ReturnColumnsName )
                                      };
     StringBuilder sb = new StringBuilder();
     sb.Append("INSERT INTO [dbo].[Workflow_DataSet]");
     sb.Append("(");
     sb.Append("[DataSetType]");
     sb.Append(",[DataSetName]");
     sb.Append(",[DataSourceID]");
     sb.Append(",[TableList]");
     sb.Append(",[QueryCondition]");
     sb.Append(",[ReturnColumns]");
     sb.Append(",[DataSetPKColumns]");
     sb.Append(",[ReturnColumnsName]");
     sb.Append(") ");
     sb.Append(" VALUES (");
     sb.Append("@DataSetType,");
     sb.Append("@DataSetName,");
     sb.Append("@DataSourceID,");
     sb.Append("@TableList,");
     sb.Append("@QueryCondition,");
     sb.Append("@ReturnColumns,");
     sb.Append("@DataSetPKColumns,");
     sb.Append("@ReturnColumnsName");
     sb.Append(");");
     sb.Append("select @@identity;");
     return Convert.ToInt32(ExecuteScalar(CommandType.Text, sb.ToString(), pramsInsert));
 }