private void Delete(string key)
        {
            switch (key)
            {
            case "customer":
                _customerService.Delete(CustomerModel.Id);
                CustomerList.Remove(CustomerModel);
                break;

            case "truck":
                _truckService.Delete(TruckModel.Id);
                TruckList.Remove(TruckModel);
                break;

            case "order":
                UpdateTruckOnDelete();
                UpdateCargoOnDelete();

                UpdateCargoGridView();
                UpdateTruckGridView();

                _orderService.Delete(OrderModel.Id);
                OrderList.Remove(OrderModel);
                break;

            case "cargo":
                _cargoService.Delete(CargoModel.Id);
                CargoList.Remove(CargoModel);
                break;

            default:
                break;
            }
        }
 /// <summary>
 /// Updates cargo's grid view.
 /// </summary>
 private void UpdateCargoGridView()
 {
     CargoList.Clear();
     foreach (var item in _cargoService.GetAll().Result)
     {
         CargoList.Add(item);
     }
 }
        public override void RefreshSecondaryData()
        {
            Datos_TipoID.DataSource = Library.Common.EnumText <ETipoID> .GetList();

            PgMng.Grow();

            Datos_Cargos.DataSource = CargoList.GetList(false);
            PgMng.Grow();

            Datos_Municipios_Contactos.DataSource = MunicipioList.GetList(false);
            PgMng.Grow();
        }
Exemple #4
0
    public CargoManager()
    {
        _instance = this;

        TextAsset cargoDef = Resources.Load("Data/cargos") as TextAsset;
        CargoList cargos   = JsonUtility.FromJson <CargoList>(cargoDef.text);

        foreach (var cargo in cargos.cargos)
        {
            _cargos.Add((Cargoes)System.Enum.Parse(typeof(Cargoes), cargo.id), cargo);
        }
    }
Exemple #5
0
        public override void RefreshSecondaryData()
        {
            MunicipioList municipios = MunicipioList.GetList(false);

            Datos_Municipios.DataSource           = municipios;
            Municipio_CB.Text                     = EntityInfo.Municipio;
            Datos_Municipios_Contactos.DataSource = municipios;
            Bar.Grow();

            Datos_Cargos.DataSource = CargoList.GetList(false);
            Bar.Grow();
        }
        /// <summary>
        /// obtiene lista de cargos
        /// </summary>
        /// <returns></returns>
        public static CargoList Get()
        {
            CargoList lista = null;

            try
            {
                lista = CargoListDal.Get();
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(lista);
        }
        public static CargoList Get()
        {
            CargoList res = new CargoList();

            SqlCommand    cmd = null;
            SqlDataReader dr  = null;

            string query = "SELECT * FROM Cargo";

            try
            {
                cmd = Methods.CreateBasicCommand(query);
                dr  = Methods.ExecuteDataReaderCommand(cmd);

                while (dr.Read())
                {
                    res.Add(new Cargo()
                    {
                        IdCargo = dr.GetInt32(0),
                        Nombre  = dr.GetString(1),
                    });
                }
            }
            catch (SqlException ex)
            {
                //Methods.GenerateLogsRelease("KeyValuePacienteListDal", "Obtener", ex.Message + " " + ex.StackTrace);
                throw ex;
            }
            catch (Exception ex)
            {
                //Methods.GenerateLogsRelease("KeyValuePacienteListDal", "Obtener", ex.Message + " " + ex.StackTrace);
                throw ex;
            }
            finally
            {
                cmd.Connection.Close();
            }
            return(res);
        }
Exemple #8
0
 private void cl_Enter(object sender, EventArgs e)
 {
     lastFocusedCargoList = (CargoList)sender;
 }