/// <summary> /// Verifica que no se repita un registro en el grid /// </summary> /// <history> /// [emoguel] created 27/05/2016 /// </history> private void dgrScores_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { if (e.EditAction == DataGridEditAction.Commit) { switch (e.Column.SortMemberPath) { case "sjsp": { bool isRepeat = GridHelper.HasRepeatItem((Control)e.EditingElement, dgrScores, strPropGrid: "sjsp"); e.Cancel = isRepeat; break; } case "sjScore": { ScoreRuleByLeadSourceDetail scoreRuleByLSDetail = e.Row.Item as ScoreRuleByLeadSourceDetail; if (scoreRuleByLSDetail.sjScore > 9) { UIHelper.ShowMessage("Score can not be greater than 9."); e.Cancel = true; } break; } } } }
/// <summary> /// Verifica que no se agregue una fila vacia /// </summary> /// <history> /// [emoguel] created 27/05/2016 /// </history> private void dgrScores_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e) { if (e.EditAction == DataGridEditAction.Commit) { ScoreRuleByLeadSourceDetail scoreRuleByLSDetail = e.Row.Item as ScoreRuleByLeadSourceDetail; if (scoreRuleByLSDetail.sjsp < 1) { UIHelper.ShowMessage("Please Select a Concept"); e.Cancel = true; } else { cmbScoreRuleConcept.Header = "Concept (" + (dgrScores.Items.Count - 1) + ")"; } } }
/// <summary> /// Llena el grid de ScoreRulesDetails /// </summary> /// <history> /// [emoguel] created 28/05/2016 /// </history> private async void LoadScoreRuleDetail() { try { List <ScoreRuleByLeadSourceDetail> lstScoreRuleDetail = await BRScoreRulesByLeadSourceDetail.GetScoreRulesByLeadSourceDetail(scoreRuleByLeadSource.sbls); dgrScores.ItemsSource = lstScoreRuleDetail; lstScoreRuleDetail.ForEach(sj => { ScoreRuleByLeadSourceDetail scoreRuleByLSDet = new ScoreRuleByLeadSourceDetail(); ObjectHelper.CopyProperties(scoreRuleByLSDet, sj); _lstScoreRulesDet.Add(scoreRuleByLSDet); }); cmbScoreRuleConcept.Header = "Score Rule (" + lstScoreRuleDetail.Count + ")"; } catch (Exception ex) { UIHelper.ShowMessage(ex); } }