Exemplo n.º 1
0
        public static bool InsertUpdateIntelligentMapping(IntelligentMapping intelligentMapping)
        {
            var lstSqlParameter = new List <SqlParameter>();

            lstSqlParameter.Add(new SqlParameter()
            {
                ParameterName = "@ParentId", SqlDbType = SqlDbType.BigInt, Value = (object)intelligentMapping.ParentId ?? DBNull.Value
            });
            lstSqlParameter.Add(new SqlParameter()
            {
                ParameterName = "@TableName", SqlDbType = SqlDbType.NVarChar, Value = (object)intelligentMapping.TableName ?? DBNull.Value
            });
            lstSqlParameter.Add(new SqlParameter()
            {
                ParameterName = "@ColumnName", SqlDbType = SqlDbType.NVarChar, Value = intelligentMapping.ColumnName
            });
            lstSqlParameter.Add(new SqlParameter()
            {
                ParameterName = "@PossibleMatches", SqlDbType = SqlDbType.NVarChar, Value = (object)intelligentMapping.PossibleMatches ?? DBNull.Value
            });
            lstSqlParameter.Add(new SqlParameter()
            {
                ParameterName = "@PossibleHierarchies", SqlDbType = SqlDbType.NVarChar, Value = (object)intelligentMapping.PossibleHierarchies ?? DBNull.Value
            });
            lstSqlParameter.Add(new SqlParameter()
            {
                ParameterName = "@CustomCriteria", SqlDbType = SqlDbType.NVarChar, Value = (object)intelligentMapping.CustomCriteria ?? DBNull.Value
            });

            int rowsAffected = DBProvider.ExecuteNonQuery("IntelligentMapping_InsertUpdate", CommandType.StoredProcedure, ref lstSqlParameter);

            return(rowsAffected > 0);
        }
Exemplo n.º 2
0
        public static IntelligentMapping GetIntelligentMappingDetail(long id)
        {
            IntelligentMapping intelligentMapping = null;
            var lstSqlParameter = new List <SqlParameter>();

            lstSqlParameter.Add(new SqlParameter()
            {
                ParameterName = "@Id", SqlDbType = SqlDbType.BigInt, Value = id
            });

            var dt = DBProvider.GetDataTable("GetIntelligentMappingDetail", CommandType.StoredProcedure, ref lstSqlParameter);

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    intelligentMapping = new IntelligentMapping()
                    {
                        Id              = Convert.ToInt32(row["Id"]),
                        TableName       = Convert.ToString(row["TableName"]),
                        ColumnName      = Convert.ToString(row["ColumnName"]),
                        PossibleMatches = Convert.ToString(row["PossibleMatches"]),
                        CustomCriteria  = Convert.ToString(row["CustomCriteria"])
                    };

                    if (row["ParentId"] != DBNull.Value)
                    {
                        intelligentMapping.ParentId = Convert.ToInt32(row["ParentId"]);
                    }
                }
            }

            return(intelligentMapping);
        }