public dataFiller(WorkPermitKeeper keeper, int wpId = 0, bool copy = false) { InitializeComponent(); wp = new WorkPermit(wpId); Keeper = keeper; if (wp.WorkPermitId == 0) { this.Text = "Nowe pozwolenie"; txtNumber.Text = wp.Number; createAutoComplete(); this.Controls.Add(ACKeeper.Output); } else { this.Text = "Edycja pozwolenia"; txtNumber.Text = wp.Number; txtDescription.Text = wp.Description; txtDepartment.Text = wp.Department; txtPlace.Text = wp.Place; txtCompany.Text = wp.CompanyName; txtPhone.Text = wp.CompanyPhone; txtApplicant.Text = wp.Applicant; txtHolder.Text = wp.Holder; dtDate.Value = wp.Date; txtUsers.Text = wp.GetUsers(); txtAuthorizing.Text = wp.Authorizing; txtAuthorizingPPN.Text = wp.AuthorizingPPN; txtAuthorizingPZ.Text = wp.AuthorizingPZ; txtAuthorizingPNW.Text = wp.AuthorizingPNW; txtControllerPPN.Text = wp.ControllerPPN; cmbFrom.Text = wp.HourFrom; cmbTo.Text = wp.HourTo; if (copy) { this.Text = "Nowe pozwolenie"; wp.Type = 1; wp.WorkPermitId = 0; wp.Date = DateTime.Now.Date; dtDate.ResetText(); cmbFrom.ResetText(); cmbFrom.SelectedIndex = -1; cmbTo.ResetText(); cmbTo.SelectedIndex = -1; wp.getNewNumber(); txtNumber.Text = wp.Number; createAutoComplete(); this.Controls.Add(ACKeeper.Output); } } }
public void getNewNumber() { WorkPermitKeeper keeper = new WorkPermitKeeper(); this.Number = keeper.getNewNumber(); }