public Form_NewCustomer(DBinterface dbInterface, Form_SelectCustomer formCustomer, Form1 form1) { InitializeComponent(); this.StartPosition = FormStartPosition.CenterScreen; InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(new System.Globalization.CultureInfo("he-IL")); this.localInterface = dbInterface; this.formSelectCustomer = formCustomer; this.mainForm = form1; }
private void Form_NewProject_Load(object sender, EventArgs e) { formSelectCustomer = new Form_SelectCustomer(localInterface, this); comboBoxCurency.SelectedIndex = 0; comboBoxDetailsProjectlinking.SelectedIndex = 0; textBoxDetailsProjectAmount.Text = "0"; textBoxDetailsProjectPriceIndex.Text = "0"; DataTable dt = localInterface.Select("Select * FROM engineers").Tables[0]; comboBoxDetailsProjectHandler1.Items.Add(""); comboBoxDetailsProjectHandler2.Items.Add(""); foreach (DataRow dr in dt.Rows) { comboBoxDetailsProjectHandler1.Items.Add(dr[0]); comboBoxDetailsProjectHandler2.Items.Add(dr[0]); } dt = localInterface.Select("Select projectNumber FROM projects").Tables[0]; double temp = 0; foreach (DataRow row in dt.Rows) { if (double.Parse(row[0].ToString()) > temp) { if (double.Parse(row[0].ToString()) != 9999) { temp = double.Parse(row[0].ToString()); } } } textBoxDetailsProjectNumber.Text = ((int)temp + 1).ToString(); textBoxCustomerId.Text = localProject.CustomerId.ToString(); textBoxDetailsProjectAmount.Text = localProject.Amount.ToString(); comboBoxCurency.SelectedIndex = localProject.Curency; textBoxDetailsProjectAmountInfo.Text = localProject.AmountNotes; if (localProject.Type == 1) { radioButtonProjectTypeElectricity.Checked = true; } else { radioButtonProjectTypeInstilation.Checked = false; } try { comboBoxDetailsProjectHandler1.SelectedIndex = int.Parse(localProject.Handler1); } catch { comboBoxDetailsProjectHandler1.SelectedIndex = 0; } try { comboBoxDetailsProjectHandler2.SelectedIndex = int.Parse(localProject.Handler2); } catch { comboBoxDetailsProjectlinking.SelectedIndex = 0; } textBoxDetailsProjectPriceIndex.Text = localProject.PriceIndex.ToString(); if (localProject.PriceIndexDateExists == 1) { dateTimePickerDetailsProjectPriceIndexDate.Checked = true; dateTimePickerDetailsProjectPriceIndexDate.Value = localProject.PriceIndexDate; } if (localProject.ContractExists == 1) { checkBoxDetailsProjectContract.Checked = true; } textBoxDetailsProjectContractNotes.Text = localProject.ContractNotes; textBoxDetailsProjectNotes.Text = localProject.ProjectNotes; textBoxDetailsProjectMileStones.Text = localProject.MileStonesNotes; //Payer textBoxPayerName.Text = localProject.PayerName; textBoxPayerPhone.Text = localProject.PayerPhone; textBoxPayerEmail.Text = localProject.PayerEmail; textBoxPayerFax.Text = localProject.PayerFax; textBoxPayerAddress.Text = localProject.PayerAddress; //Approver textBoxApproverName.Text = localProject.ApproverName; textBoxApproverPhone.Text = localProject.ApproverPhone; textBoxApproverEmail.Text = localProject.ApproverEmail; textBoxApproverFax.Text = localProject.ApproverFax; textBoxApproverAddress.Text = localProject.PayerAddress; }