Beispiel #1
0
        // <summary>
        /// Agrega| Actualiza registros en el catalogo Dept
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        ///
        /// </history>
        private async void btnAccept_Click(object sender, RoutedEventArgs e)
        {
            btnAccept.Focus();
            List <Personnel> lstPersonnels = (List <Personnel>)dgrPersonnel.ItemsSource;

            if (enumMode != EnumMode.Add && ObjectHelper.IsEquals(dept, oldDept) && ObjectHelper.IsListEquals(lstPersonnels, _lstOldPersonnel))
            {
                blnClosing = true;
                Close();
            }
            else
            {
                string strMsj = ValidateHelper.ValidateForm(this, "Dept", blnDatagrids: true);
                if (strMsj == "")
                {
                    btnAccept.Visibility = Visibility.Collapsed;
                    List <Personnel> lstAdd = lstPersonnels.Where(pe => !_lstOldPersonnel.Any(pee => pee.peID == pe.peID)).ToList();
                    List <Personnel> lstDel = _lstOldPersonnel.Where(pe => !lstPersonnels.Any(pee => pee.peID == pe.peID)).ToList();
                    int nRes = await BRDepts.SaveDept(dept, (enumMode == EnumMode.Edit), lstAdd, lstDel);

                    UIHelper.ShowMessageResult("Dept", nRes);
                    if (nRes > 0)
                    {
                        blnClosing   = true;
                        DialogResult = true;
                        Close();
                    }
                }
                else
                {
                    UIHelper.ShowMessage(strMsj);
                }
                btnAccept.Visibility = Visibility.Visible;
            }
        }
Beispiel #2
0
        /// <summary>
        /// LLena el grid de depts
        /// </summary>
        /// <history>
        /// [emoguel] created 11/06/2016
        /// </history>
        private async void LoadDeps()
        {
            try
            {
                List <Dept> lstDepst = await BRDepts.GetDepts(1);

                lstDepst.Insert(0, new Dept {
                    deID = "ALL", deN = "ALL"
                });
                cmbDepts.ItemsSource   = lstDepst;
                cmbDepts.SelectedValue = dept;
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Llena el grid de Depts
        /// </summary>
        /// <param name="dept">Objeto a seleccionar</param>
        /// <history>
        /// [emoguel] created 03/05/2016
        /// [emoguel] modified 09/06/2016--> se volvió async
        /// </history>
        private async void LoadDepts(Dept dept = null)
        {
            try
            {
                status.Visibility = Visibility.Visible;
                int         nIndex   = 0;
                List <Dept> lstDepts = await BRDepts.GetDepts(_nStatus, _deptFilter);

                dgrDepts.ItemsSource = lstDepts;
                if (lstDepts.Count > 0 && dept != null)
                {
                    dept   = lstDepts.Where(de => de.deID == dept.deID).FirstOrDefault();
                    nIndex = lstDepts.IndexOf(dept);
                }
                GridHelper.SelectRow(dgrDepts, nIndex);
                StatusBarReg.Content = lstDepts.Count + " Depts.";
                status.Visibility    = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }