Exemplo n.º 1
0
        private void ibuttonSave_Click(object sender, EventArgs e)
        {
            GetData(ref newData);

            savedData = new modelMobility();
            savedData = newData.DeepClone();
            this.Hide();
        }
Exemplo n.º 2
0
 private void ibuttonMobilityCopy_Click(object sender, EventArgs e)
 {
     if (gridMobility.SelectedRows.Count > 0)
     {
         long id          = (long)gridMobility.SelectedRows[0].Cells["ID"].Value;
         var  mobility    = Program.GData.dataActivity.getMobilities.First(c => c.ID == id);
         var  newmobility = new modelMobility();
         newmobility = mobility.DeepClone();
         Program.GData.dataActivity.Insert(newmobility);
         gridMobility.LoadGrid();
     }
 }
Exemplo n.º 3
0
        public formEditMobility(modelMobility mobility)
        {
            InitializeComponent();

            originalData = new modelMobility();
            originalData = mobility.DeepClone();
            newData      = new modelMobility();
            newData      = mobility.DeepClone();
            savedData    = null;

            ShowDistanceBands();
            ShowData(originalData);
        }
Exemplo n.º 4
0
 private void ShowData(modelMobility mobility)
 {
     ShowCountries();
     textTravelDays.Text         = mobility.TravelDays.ToString();
     textParticipants.Text       = mobility.Participants.ToString();
     textFewerOpportunities.Text = mobility.FewerOpportunities.ToString();
     textGroupLeaders.Text       = mobility.GroupLeaders.ToString();
     textTrainers.Text           = mobility.Trainers.ToString();
     textFacilitators.Text       = mobility.Facilitators.ToString();
     textOthers.Text             = mobility.Others.ToString();
     textRate.Text          = mobility.Rate.ToString();
     textPrice.Text         = mobility.Price.ToString();
     comboDistanceBand.Text = Program.GData.dataLOV.getDistanceBands.First(c => c.ID == mobility.DistanceBand).DistanceBand;
 }
Exemplo n.º 5
0
        private void ibuttonClose_Click(object sender, EventArgs e)
        {
            GetData(ref newData);

            if (!Program.Compare <modelMobility>(originalData, newData))
            {
                if (!Program.ShowMessageBox("Do you want to scrap changes?", true, "YES", "NO"))
                {
                    return;
                }
            }
            newData = null;
            this.Hide();
        }
Exemplo n.º 6
0
        private void AddMobility(long actvariation, long country, bool FirstTwo)
        {
            var projact  = Program.GData.dataProject.getProjectActivity(newData.ProjectActivity);
            var mobility = new modelMobility();

            mobility.ActivityVariation  = actvariation;
            mobility.CountryOfOrigin    = country;
            mobility.DistanceBand       = 4;
            mobility.TravelDays         = 2;
            mobility.Participants       = newData.ParticipantsPerCountry;
            mobility.FewerOpportunities = newData.FewerOpportunitiePerCountry;
            mobility.GroupLeaders       = newData.GTFPerCountry;
            mobility.Trainers           = projact.ActivityID == 1 ? 0 : 1;
            mobility.Facilitators       = FirstTwo ? 1 : 0;
            mobility.Others             = FirstTwo ? 1 : 0;

            Program.GData.dataActivity.Insert(mobility);
        }
Exemplo n.º 7
0
        private void GetData(ref modelMobility mobility)
        {
            int tmp; float fmp;

            if (int.TryParse(textTravelDays.Text, out tmp))
            {
                mobility.TravelDays = tmp;
            }
            if (int.TryParse(textParticipants.Text, out tmp))
            {
                mobility.Participants = tmp;
            }
            if (int.TryParse(textFewerOpportunities.Text, out tmp))
            {
                mobility.FewerOpportunities = tmp;
            }
            if (int.TryParse(textGroupLeaders.Text, out tmp))
            {
                mobility.GroupLeaders = tmp;
            }
            if (int.TryParse(textTrainers.Text, out tmp))
            {
                mobility.Trainers = tmp;
            }
            if (int.TryParse(textFacilitators.Text, out tmp))
            {
                mobility.Facilitators = tmp;
            }
            if (int.TryParse(textOthers.Text, out tmp))
            {
                mobility.Others = tmp;
            }
            if (float.TryParse(textRate.Text, out fmp))
            {
                mobility.Rate = fmp;
            }

            //mobility.DistanceBand = Program.GData.dataLOV.getDistanceBands.First(c => c.DistanceBand == comboDistanceBand.Text).ID;
            var db = Program.GData.dataLOV.getDistanceBands.First(c => c.DistanceBand == comboDistanceBand.Text);

            mobility.DistanceBand = db.ID;
            mobility.Price        = db.Price;
        }