public void AddCriteriaToQuery(O2CV1QueryDto queryDto, CriteriaDto criteriaDto) { using (var dc = new CriteriaDataContext()) { var query = dc.O2CVQueries.Single(q => q.QueryName == queryDto.QueryName); var criteria = new O2CVQueryCriteria { Sequence = criteriaDto.Sequence, TableName = criteriaDto.TableName, TableColumn = criteriaDto.TableColumn, CompareOperator = criteriaDto.CompareOperator, CompareValue = criteriaDto.CompareValue, Description = criteriaDto.Description, Name = $"{criteriaDto.TableName} {criteriaDto.TableColumn} {criteriaDto.CompareOperator} {criteriaDto.CompareValue}", DisableBy = criteriaDto.Disabled ? criteriaDto.Createdby : null, CreatedBy = criteriaDto.Createdby, Disabled = criteriaDto.Disabled, CreatedDate = Now }; if (criteria.Disabled == true) { criteria.DisabledDate = Now; } query.O2CVQueryCriterias.Add(criteria); dc.SubmitChanges(); } }
public void AddQueryAndFirstCriteriaToQuery(O2CV1QueryDto queryDto, CriteriaDto criteriaDto) { using (var dc = new CriteriaDataContext()) { var query = new O2CVQuery { QueryName = queryDto.QueryName, QuerySql = queryDto.QuerySql, CreatedBy = queryDto.CreatedBy, Deleted = queryDto.Deleted, Description = queryDto.Description, CreatedDate = Now }; var criteria = new O2CVQueryCriteria { Sequence = 1, TableName = criteriaDto.TableName, TableColumn = criteriaDto.TableColumn, Name = criteriaDto.Description, CompareOperator = criteriaDto.CompareOperator, CompareValue = criteriaDto.CompareValue, Description = criteriaDto.Description, DisableBy = criteriaDto.Disabled ? criteriaDto.Createdby : null, CreatedBy = criteriaDto.Createdby, Disabled = criteriaDto.Disabled, CreatedDate = Now }; if (criteria.Disabled == true) { criteria.DisabledDate = Now; } query.O2CVQueryCriterias.Add(criteria); dc.O2CVQueries.InsertOnSubmit(query); dc.SubmitChanges(); } }
private void detach_O2CVQueryCriterias(O2CVQueryCriteria entity) { this.SendPropertyChanging(); entity.O2CVQuery = null; }
partial void DeleteO2CVQueryCriteria(O2CVQueryCriteria instance);
partial void UpdateO2CVQueryCriteria(O2CVQueryCriteria instance);
partial void InsertO2CVQueryCriteria(O2CVQueryCriteria instance);