Пример #1
0
        public string ConvertToSql(string sqlUpdate, CriteriaOperator criteria)
        {
            var sqlWhere    = CriteriaToWhereClauseHelper.GetMsSqlWhere(XpoCriteriaFixer.Fix(criteria));
            var sqlTemplate = sqlUpdate.Replace("{criteria}", (string.IsNullOrEmpty(sqlWhere) ? "" : " AND " + sqlWhere));

            return(sqlTemplate);
        }
Пример #2
0
        private void ShowFilterSql()
        {
            CriteriaOperator criteria = ActiveFilterCriteria;
            var sqlCriteria           = CriteriaToWhereClauseHelper.GetMsSqlWhere(XpoCriteriaFixer.Fix(criteria));

            new GenericMessageBox(sqlCriteria,
                                  "Filter Criteria SQL Text");
        }
Пример #3
0
        public void CriteriaToSqlTest()
        {
            string xpoCriteriaText = "[Activity] Is Not Null Or [ActionOwner.Name] Like 'UNDEFINED'";
            var    criteria        = CriteriaEditorHelper.GetCriteriaOperator(
                xpoCriteriaText, typeof(BankStmt), ObjectSpace);
            var sqlCriteriaText = CriteriaToWhereClauseHelper.GetOracleWhere(XpoCriteriaFixer.Fix(criteria));

            Console.WriteLine(sqlCriteriaText);
        }
Пример #4
0
        private void BuildCriteriaExpression_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            var obj             = (IMappingCriteriaGenerator)View.CurrentObject;
            var xpoCriteriaText = obj.Criteria;

            var criteria = CriteriaEditorHelper.GetCriteriaOperator(
                xpoCriteriaText, obj.CriteriaObjectType, ObjectSpace);

            obj.CriteriaExpression = CriteriaToWhereClauseHelper.GetOracleWhere(XpoCriteriaFixer.Fix(criteria));
        }
Пример #5
0
        // Note that this does not delete child objects
        public void Delete(XPClassInfo classInfo, CriteriaOperator criteria)
        {
            var session = ((XPObjectSpace)objectSpace).Session;

            var gcRecordIDGenerator = new Random();
            var randomNumber        = gcRecordIDGenerator.Next(1, 2147483647);
            var sqlWhere            = CriteriaToWhereClauseHelper.GetMsSqlWhere(XpoCriteriaFixer.Fix(criteria));

            sqlWhere = string.IsNullOrEmpty(sqlWhere) ? "" : " WHERE " + sqlWhere;
            var sqlNonQuery = "UPDATE " + classInfo.TableName + " SET GCRecord = "
                              + randomNumber
                              + sqlWhere;

            session.ExecuteNonQuery(sqlNonQuery);
            objectSpace.CommitChanges();
        }
Пример #6
0
        public void Process(IEnumerable objs)
        {
            Type objType = null;

            foreach (var obj in objs)
            {
                objType = obj.GetType();
            }
            if (objType == null)
            {
                return;
            }
            var criteria = new InOperator(objSpace.GetKeyPropertyName(objType),
                                          objs);
            var sqlWhere = CriteriaToWhereClauseHelper.GetMsSqlWhere(XpoCriteriaFixer.Fix(criteria));

            string processCommandText = CreateProcessCommandText(sqlWhere);

            using (var cmd = ((SqlConnection)objSpace.Session.Connection).CreateCommand())
            {
                cmd.CommandText = parameterCommandText + "\n\n" + processCommandText;
                cmd.ExecuteNonQuery();
            }
        }