/// <summary> /// Carga la lista del grid /// </summary> /// <param name="postLog">Objeto a seleccionar</param> /// <history> /// [emoguel] created 11/04/2016 /// </history> private async void LoadPostLogs(PostLog postLog = null) { try { status.Visibility = Visibility.Visible; int nIndex = 0; List <PostLog> lstPostsLog = await BRPostsLog.GetPostsLog(_postLogFilter, _blnDate); dgrPostsLog.ItemsSource = lstPostsLog; if (lstPostsLog.Count > 0) { if (postLog != null) { postLog = lstPostsLog.Where(pp => pp.ppID == postLog.ppID).FirstOrDefault(); nIndex = lstPostsLog.IndexOf(postLog); } GridHelper.SelectRow(dgrPostsLog, nIndex); btnDel.IsEnabled = _blnDel; } else { btnDel.IsEnabled = false; } StatusBarReg.Content = lstPostsLog.Count + " Posts Log."; status.Visibility = Visibility.Collapsed; } catch (Exception ex) { UIHelper.ShowMessage(ex); } }
/// <summary> /// Guarda|actualiza un registro en la Bd /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <history> /// [emoguel] created 13/04/2016 /// [emoguel] modified 30/05/2016 /// </history> private async void btnAccept_Click(object sender, RoutedEventArgs e) { try { btnAccept.Focus(); if (enumMode == EnumMode.Search) { if (dpppDT.Value != null) { blnDate = true; postLog.ppDT = Convert.ToDateTime(dpppDT.Value); } else { blnDate = false; } _isClosing = true; DialogResult = true; Close(); } else { if (ObjectHelper.IsEquals(postLog, oldPostLog) && enumMode != EnumMode.Add) { _isClosing = true; Close(); } else { #region Insertar|Agregar string strMsj = ValidateHelper.ValidateForm(this, "Post Log"); if (strMsj == "") { int nRes = await BREntities.OperationEntity(postLog, enumMode); UIHelper.ShowMessageResult("PostLog", nRes); if (nRes > 0) { _isClosing = true; var postsLog = await BRPostsLog.GetPostsLog(postLog); postLog = postsLog.FirstOrDefault(); DialogResult = true; Close(); } } else { UIHelper.ShowMessage(strMsj); } #endregion } } } catch (Exception ex) { UIHelper.ShowMessage(ex); } }