public formEditProjectVariation(modelProjectVariation projectVariation) { InitializeComponent(); PrepareCallCombo(); originalData = new modelProjectVariation(); originalData = projectVariation.DeepClone(); newData = new modelProjectVariation(); newData = projectVariation.DeepClone(); savedData = null; ShowLanguages(); ShowNationalAgency(); ShowStatuses(); ShowData(originalData); gridOrganizations.SetupLinq += GridOrganizations_SetupLinq; gridOrganizations.SetupGrid += GridOrganizations_SetupGrid; gridOrganizations.LoadGrid(); gridActivities.SetupLinq += GridActivities_SetupLinq; gridActivities.SetupGrid += GridActivities_SetupGrid; gridActivities.LoadGrid(); }
private void GetData(ref modelProjectVariation projectVariation) { projectVariation.Language = Program.GData.dataLOV.getLanguages.First(c => c.Language == comboLanguage.Text).ID; projectVariation.NationalAgency = Program.GData.dataLOV.getNationalAgencies.First(c => c.AgencyName == comboNationalAgency.Text).ID; projectVariation.StartDate = dateStartDate.Value; projectVariation.Duration = 1; int duration; if (int.TryParse(textDuration.Text, out duration)) { projectVariation.Duration = duration; } projectVariation.EndDate = projectVariation.StartDate.AddMonths(duration); projectVariation.Call = comboCall.Text; projectVariation.Title = textTitle.Text; projectVariation.Acronym = textAcronym.Text; projectVariation.Code = textCode.Text; projectVariation.Phase = textPhase.Text; projectVariation.Status = comboStatus.Text; projectVariation.CustomVariable1 = textCustomVariable1.Text; projectVariation.CustomVariable2 = textCustomVariable2.Text; projectVariation.CustomVariable3 = textCustomVariable3.Text; projectVariation.CustomVariable4 = textCustomVariable4.Text; }
private void ibuttonSave_Click(object sender, EventArgs e) { GetData(ref newData); SaveOrder(); savedData = new modelProjectVariation(); savedData = newData.DeepClone(); this.Hide(); }
private void ibuttonClose_Click(object sender, EventArgs e) { GetData(ref newData); if (!Program.Compare <modelProjectVariation>(originalData, newData)) { if (!Program.ShowMessageBox("Do you want to scrap changes?", true, "YES", "NO")) { return; } } newData = null; this.Hide(); }
private void ibuttonProjectVariationAdd_Click(object sender, EventArgs e) { var projectVariation = new modelProjectVariation(); projectVariation.ProjectID = originalData.ID; projectVariation.Call = "New Call"; projectVariation.Title = "New Title"; projectVariation.Acronym = "AA"; projectVariation.StartDate = DateTime.Now; projectVariation.Duration = 7; projectVariation.EndDate = projectVariation.StartDate.AddDays(projectVariation.Duration); projectVariation.Language = Program.GData.dataLOV.getLanguages.ElementAt(0).ID; projectVariation.ApplicantOrganization = Program.GData.dataOrganization.getOrganizations.ElementAt(0).ID; projectVariation.NationalAgency = Program.GData.dataLOV.getNationalAgencies.ElementAt(0).ID; projectVariation.PartnerOrganization = Program.GData.dataOrganization.getOrganizations.ElementAt(0).ID; projectVariation.Code = ""; projectVariation.Status = ""; projectVariation.Phase = ""; Program.GData.dataProject.Insert(projectVariation); gridVariations.LoadGrid(); }
private void ShowData(modelProjectVariation projectVariation) { labelProject.Text = Program.GData.dataProject.getProjects.First(c => c.ID == projectVariation.ProjectID).Title; labelApplicant.Text = Program.GData.dataOrganization.getOrganizations.First(c => c.ID == projectVariation.ApplicantOrganization).LegalName; comboLanguage.Text = Program.GData.dataLOV.getLanguages.First(c => c.ID == projectVariation.Language).Language; comboNationalAgency.Text = Program.GData.dataLOV.getNationalAgencies.First(c => c.ID == projectVariation.NationalAgency).AgencyName; comboStatus.Text = projectVariation.Status; dateStartDate.Value = projectVariation.StartDate; dateEndDate.Value = projectVariation.EndDate; comboCall.Text = projectVariation.Call; textTitle.Text = projectVariation.Title; textAcronym.Text = projectVariation.Acronym; textDuration.Text = projectVariation.Duration.ToString(); textCode.Text = projectVariation.Code; textPhase.Text = projectVariation.Phase; textCustomVariable1.Text = projectVariation.CustomVariable1; textCustomVariable2.Text = projectVariation.CustomVariable2; textCustomVariable3.Text = projectVariation.CustomVariable3; textCustomVariable4.Text = projectVariation.CustomVariable4; }