Esempio n. 1
0
 /// <summary>
 /// Insertar, Editar y Eliminar Area
 /// </summary>
 /// <param name="ESGR_Area">Objecto de la Entidad Area</param>
 public void TransArea(ESGR_Area ESGR_Area)
 {
     try
     {
         var objCmpSql = new CmpSql(SGRVariables.ConectionString);
         objCmpSql.CommandProcedure("spSGR_SET_Area");
         objCmpSql.AddParameter("@Opcion", SqlDbType.Char, ESGR_Area.Opcion);
         objCmpSql.AddParameter("@IdArea", SqlDbType.Int, ESGR_Area.IdArea);
         objCmpSql.AddParameter("@IdEmpresa", SqlDbType.SmallInt, 1);//ESGR_Area.SGR_Empresa.IdEmpresa);
         objCmpSql.AddParameter("@Area", SqlDbType.VarChar, ESGR_Area.Area);
         objCmpSql.AddParameter("@IdUsuario", SqlDbType.Int, 1);
         objCmpSql.ExecuteNonQuery();
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 2
0
        private async void MethodLoadDetail()
        {
            await Task.Factory.StartNew(() =>
            {
                try
                {
                    CmpObservableCollection <ESGR_UsuarioEmpresaSucursal> vrCollectionUsuarioEmpresaSucursal = new CmpObservableCollection <ESGR_UsuarioEmpresaSucursal>(new BSGR_UsuarioEmpresaSucursal().GetCollectionUsuarioEmpresaSucursal().Where(x => x.ESGR_Usuario.IdUsuario == ESGR_Usuario.IdUsuario));
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        CollectionDataGridESGR_EmpresaSucursal.Clear();
                        vrCollectionUsuarioEmpresaSucursal.ToList().ForEach(x =>
                        {
                            if (CollectionESGR_EmpresaSucursal.ToList().Exists(y => y.IdEmpSucursal == x.ESGR_EmpresaSucursal.IdEmpSucursal))
                            {
                                ESGR_EmpresaSucursal Aux = CollectionESGR_EmpresaSucursal.FirstOrDefault(y => y.IdEmpSucursal == x.ESGR_EmpresaSucursal.IdEmpSucursal);
                                CollectionDataGridESGR_EmpresaSucursal.Add(Aux);
                                CollectionESGR_EmpresaSucursal.Remove(Aux);
                            }
                        });
                    });

                    CmpObservableCollection <ESGR_UsuarioArea> vrCollectionUsuarioArea = new CmpObservableCollection <ESGR_UsuarioArea>(new BSGR_UsuarioArea().GetCollectionUsuarioArea().Where(x => x.ESGR_Usuario.IdUsuario == ESGR_Usuario.IdUsuario));
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        CollectionDataGridESGR_Area.Clear();
                        vrCollectionUsuarioArea.ToList().ForEach(x =>
                        {
                            if (CollectionESGR_Area.ToList().Exists(y => y.IdArea == x.ESGR_Area.IdArea))
                            {
                                ESGR_Area Aux = CollectionESGR_Area.FirstOrDefault(y => y.IdArea == x.ESGR_Area.IdArea);
                                CollectionDataGridESGR_Area.Add(Aux);
                                CollectionESGR_Area.Remove(Aux);
                            }
                        });
                    });
                }
                catch (Exception ex)
                {
                    CmpMessageBox.Show(SGRMessage.AdministratorUsuario, ex.Message, CmpButton.Aceptar);
                }
            });
        }