public static ClientDataSet.RuleDataTable GetRules(Guid ruleEngineId, Guid organizationId, Guid?instanceId) { using (RuleTableAdapter adapter = new RuleTableAdapter(OrganizationProvider.GetConnectionString(organizationId))) { return(adapter.GetRules(ruleEngineId, organizationId, instanceId)); } }
public static ClientDataSet.RuleRow GetRuleRow(string ruleName, Guid organizationId) { using (RuleTableAdapter adapter = new RuleTableAdapter(OrganizationProvider.GetConnectionString(organizationId))) { ClientDataSet.RuleDataTable table = adapter.GetRuleByName(ruleName, organizationId); return((table.Count > 0) ? table[0] : null); } }
public ExperlogixRepository() { _seriesAdapter = new SeriesTableAdapter(); _modelAdapter = new ModelTableAdapter(); _categoryAdapter = new CategoryTableAdapter(); _listAdapter = new ListTableAdapter(); _lookupAdapter = new LookupTableAdapter(); _ruleAdapter = new RuleTableAdapter(); _attributeAdapter = new CategoryAttributeTableAdapter(); _formulaAdapter = new FormulaTableAdapter(); _attributeLookupAdapter = new CategoryAttLookupTableAdapter(); }
public static void DeleteRule(Guid ruleId, Guid organizationId) { if (ruleId.Equals(Guid.Empty)) { throw new ArgumentNullException("ruleId", Properties.Resources.ExceptionMessage_ArgumentsIsEmpty); } using (RuleTableAdapter adapter = new RuleTableAdapter(OrganizationProvider.GetConnectionString(organizationId))) { adapter.Delete(ruleId); } }
public static int UpdateOrderNumber(Guid organizationId, Guid ruleId, int orderNumber) { if (organizationId.Equals(Guid.Empty) || ruleId.Equals(Guid.Empty)) { throw new ArgumentNullException("ruleId", Properties.Resources.ExceptionMessage_ArgumentsIsEmpty); } using (RuleTableAdapter adapter = new RuleTableAdapter(OrganizationProvider.GetConnectionString(organizationId))) { return(adapter.UpdateRuleOrder(ruleId, orderNumber)); } }
public static int UpdateRuleUses(Guid organizationId, Guid ruleId, Guid lastUsedUser, DateTime lastUsedDate) { if (ruleId.Equals(Guid.Empty) || organizationId.Equals(Guid.Empty)) { throw new ArgumentNullException("ruleId", Properties.Resources.ExceptionMessage_ArgumentsIsEmpty); } using (RuleTableAdapter adapter = new RuleTableAdapter(OrganizationProvider.GetConnectionString(organizationId))) { return(adapter.UpdateRuleUses(ruleId, lastUsedUser, lastUsedDate)); } }
public static void UpdateRule(Guid ruleId, Guid ruleEngineId, Guid organizationId, Guid?instanceId, string name, string displayName, int orderNumber, bool active) { if (ruleId.Equals(Guid.Empty) || ruleEngineId.Equals(Guid.Empty) || string.IsNullOrEmpty(name)) { throw new ArgumentNullException("ruleId", Properties.Resources.ExceptionMessage_ArgumentsIsEmpty); } ClientDataSet.RuleDataTable table = new ClientDataSet.RuleDataTable(); using (RuleTableAdapter adapter = new RuleTableAdapter(OrganizationProvider.GetConnectionString(organizationId))) { table = adapter.GetRule(ruleId); ClientDataSet.RuleRow row = ((table.Count > 0) ? table[0] : null); if (row == null) { row = table.NewRuleRow(); row.RuleId = ruleId; row.RuleEngineId = ruleEngineId; row.OrganizationId = organizationId; if (instanceId.HasValue) { row.InstanceId = instanceId.Value; } else { row.SetInstanceIdNull(); } row.UsedQty = 0; row.SetLastUsedUserNull(); row.SetLastUsedDateNull(); row.CreatedBy = UserContext.Current != null ? UserContext.Current.UserId : Guid.Empty; row.CreatedDate = DateTime.UtcNow; } row.Name = name; row.DisplayName = displayName; row.Active = active; row.OrderNumber = orderNumber; if (row.RowState == DataRowState.Detached) { table.AddRuleRow(row); } adapter.Update(row); } }