Example #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);
        }
Example #2
0
        private void ShowFilterSql()
        {
            CriteriaOperator criteria = ActiveFilterCriteria;
            var sqlCriteria           = CriteriaToWhereClauseHelper.GetMsSqlWhere(XpoCriteriaFixer.Fix(criteria));

            new GenericMessageBox(sqlCriteria,
                                  "Filter Criteria SQL Text");
        }
Example #3
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();
        }
Example #4
0
        public ActionResult CustomBinding(GridViewModel model)
        {
            var    co          = CriteriaOperator.Parse(model.FilterExpression);
            string criterias   = CriteriaToWhereClauseHelper.GetMsSqlWhere(co, true);
            var    sortOptions = model.SortedColumns.Select(c => new SortOption
            {
                Field = c.FieldName, SortIndex = c.SortIndex, SortOrder = c.SortOrder.ToString()
            });

            var page = QualityControl.GetMeasurementsPage(
                model.Pager.PageIndex,
                model.Pager.PageSize,
                criterias,
                sortOptions);

            model.ProcessCustomBinding(
                e => e.DataRowCount = page.TotalItems,
                e => e.Data         = page.Items);
            return(PartialView("_ContactsGridView", model));
        }
        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();
            }
        }
Example #6
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     filter = CriteriaToWhereClauseHelper.GetMsSqlWhere(filterControl.FilterCriteria);
     this.Close();
 }