public static ExternalMethodCallResult DeleteBudgetDictionary(EntityMetadata metadata, Dictionary <string, string> parameters, IEnumerable <DynamicEntity> entities) { ExternalMethodCallResult res = new ExternalMethodCallResult(true); List <string> views = null; if (parameters.ContainsKey("Views")) { views = parameters["Views"].Split(',').Select(c => c.Trim()).ToList(); } List <string> forms = null; if (parameters.ContainsKey("Forms")) { forms = parameters["Forms"].Split(',').Select(c => c.Trim()).ToList(); } string budgetColumnName = "BudgetId"; if (parameters.ContainsKey("Column")) { budgetColumnName = parameters["Column"]; } foreach (DynamicEntity e in entities) { if (parameters.ContainsKey("ValidateStoredProcedure")) { var paramsIn = new Dictionary <string, object>(); paramsIn.Add(budgetColumnName, e.GetId()); var paramsOut = new Dictionary <string, object>(); paramsOut.Add("ErrorMessage", string.Empty); DynamicRepository.ExecuteSP(parameters["ValidateStoredProcedure"], paramsIn, paramsOut); if (!string.IsNullOrWhiteSpace(paramsOut["ErrorMessage"] as string)) { res.AddGlobalError(paramsOut["ErrorMessage"].ToString()); res.Sucess = false; } } } if (res.Sucess) { foreach (DynamicEntity e in entities) { Budget b = new Budget(); b.DeleteEntityByViews(budgetColumnName, e.GetId(), views); b.DeleteEntityByForms(budgetColumnName, e.GetId(), forms); } } return(res); }
public static ExternalMethodCallResult DeleteBudgetDictionary(EntityMetadata metadata, Dictionary<string, string> parameters, IEnumerable<DynamicEntity> entities) { ExternalMethodCallResult res = new ExternalMethodCallResult(true); List<string> views = null; if (parameters.ContainsKey("Views")) { views = parameters["Views"].Split(',').Select(c => c.Trim()).ToList(); } List<string> forms = null; if (parameters.ContainsKey("Forms")) { forms = parameters["Forms"].Split(',').Select(c => c.Trim()).ToList(); } string budgetColumnName = "BudgetId"; if (parameters.ContainsKey("Column")) { budgetColumnName = parameters["Column"]; } foreach (DynamicEntity e in entities) { if(parameters.ContainsKey("ValidateStoredProcedure")) { var paramsIn = new Dictionary<string, object>(); paramsIn.Add(budgetColumnName, e.GetId()); var paramsOut = new Dictionary<string, object>(); paramsOut.Add("ErrorMessage", string.Empty); DynamicRepository.ExecuteSP(parameters["ValidateStoredProcedure"],paramsIn,paramsOut); if (!string.IsNullOrWhiteSpace(paramsOut["ErrorMessage"] as string)) { res.AddGlobalError(paramsOut["ErrorMessage"].ToString()); res.Sucess = false; } } } if (res.Sucess) { foreach (DynamicEntity e in entities) { Budget b = new Budget(); b.DeleteEntityByViews(budgetColumnName, e.GetId(), views); b.DeleteEntityByForms(budgetColumnName, e.GetId(), forms); } } return res; }