private void BtnAddClientAddress_Click(object sender, EventArgs e) { ClientAddressForm caaf = new ClientAddressForm(clientId, 0, this, 0); caaf.Show(); this.Hide(); FormState.PreviousPage = this; }
private void LblAddAddress_Click(object sender, EventArgs e) { ClientAddressForm clientaddress = new ClientAddressForm(this.ClientId); clientaddress.Show(); this.Hide(); clientaddress.FormClosed += ClientForm_FormClosed; }
private void BtnAddClient_Click(object sender, EventArgs e) { this.Hide(); //ClientModule client = (ClientModule)dataGridClient.SelectedRows[0].DataBoundItem; ClientAddressForm clientAddressForm = new ClientAddressForm(); clientAddressForm.Show(); clientAddressForm.FormClosed += ClientAddressForm_FormClosed; }
public void UpdateDataGridAddress(ClientAddressModel address, ClientAddressForm ca) { if (!ca.IsAddedorModify()) { changeDataGridView = false; } if (address.status == 0) { dataGridClientAddress.Rows.Add(address.ClientAddressId, address.ClientId, address.City.CityName, address.County.CountyName, address.StreetName, address.StreetNo, address.unique, address.status); listAddress.Add(address); } else if (address.status == 1) { foreach (DataGridViewRow row in dataGridClientAddress.Rows) { if (row.Cells[6].Value.ToString() == address.unique.ToString() && row.Cells[0].Value.ToString() == address.ClientAddressId.ToString()) { row.Cells[2].Value = address.City.CityName.ToString(); row.Cells[3].Value = address.County.CountyName.ToString(); row.Cells[4].Value = address.StreetName.ToString(); row.Cells[5].Value = address.StreetNo.ToString(); bool verifyList = listAddress.Any(item => item.unique == address.unique && item.ClientAddressId == address.ClientAddressId); if (!verifyList) { listAddress.Add(address); } else { foreach (ClientAddressModel model in listAddress) { if (model.unique == address.unique && model.ClientAddressId == address.ClientAddressId) { model.City.CityName = address.City.CityName; model.County.CountyName = address.County.CountyName; model.StreetName = address.StreetName; model.StreetNo = address.StreetNo; break; } } } break; } } } }
private void DataGridViewClientAddress_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { ClientAddressForm clientAddressForm = new ClientAddressForm(); int index = e.RowIndex; DataGridViewRow selectedRow = dataGridViewClientAddress.Rows[index]; clientAddressForm.IdAdresa = Convert.ToInt32(selectedRow.Cells[0].Value.ToString()); clientAddressForm.IdClient1 = Convert.ToInt32(lblIdInvisible.Text); clientAddressForm.comboBoxUpdateCounty.SelectedItem = selectedRow.Cells[1].Value.ToString(); clientAddressForm.comboBoxUpdateCity.SelectedItem = selectedRow.Cells[2].Value.ToString(); clientAddressForm.txtBoxUpdateStreetName.Text = selectedRow.Cells[3].Value.ToString(); clientAddressForm.textBoxStreetNo.Text = selectedRow.Cells[4].Value.ToString(); this.Hide(); clientAddressForm.Show(); clientAddressForm.FormClosed += clientAddressForm_FormClose; }
public AddAddressForm(int _id, ClientAddressForm owner) { id = _id; parent = owner; InitializeComponent(); BLAddress bLAddress = new BLAddress(); List <CityModel> cities = bLAddress.GetCity(); List <CountyModel> county = bLAddress.GetCounty(); cmbCountyName.DataSource = county; cmbCountyName.DisplayMember = "CountyName"; //cmbCountyName.ValueMember. cmbCityName.DataSource = cities; cmbCityName.DisplayMember = "CityName"; }
private void DataGridClient_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { //ClientAddressForm clientAddressForm = new ClientAddressForm(); //clientAddressForm.Show(); //this.Hide(); //string clientName = textBoxPartener.Text; //BLGetClientList bLGetClient = new BLGetClientList(); //int e1 = e.RowIndex; //List<ClientModule> list = bLGetClient.GetClientList(clientName); //this.id = Convert.ToInt32( dataGridClient.Rows[e.RowIndex].Cells[0].Value); //textBoxPartener.Text = this.id.ToString(); this.Hide(); ClientModule client = (ClientModule)dataGridClient.SelectedRows[0].DataBoundItem; ClientAddressForm clientAddressForm = new ClientAddressForm(client.ClientId); clientAddressForm.Show(); clientAddressForm.FormClosed += ClientAddressForm_FormClosed; }
public UpdateAddressForm(int _clientId, int _clientAddressId, ClientAddressForm owner) { clientIdValue = _clientId; clientAddressIdValue = _clientAddressId; parent = owner; InitializeComponent(); BLAddress bLAddress = new BLAddress(); List <CityModel> cities = bLAddress.GetCity(); List <CountyModel> county = bLAddress.GetCounty(); cmbCounty.DataSource = county; cmbCounty.DisplayMember = "CountyName"; cmbCounty.SelectedIndex = -1; cmbCity.DataSource = cities; cmbCity.DisplayMember = "CityName"; cmbCity.SelectedIndex = -1; }
private void BtnEditAddress_Click(object sender, EventArgs e) { if (dataGridClientAddress.Rows.Count != 0) { int i = dataGridClientAddress.SelectedCells[0].RowIndex; int selectedClientId = Convert.ToInt32(dataGridClientAddress.Rows[i].Cells[1].Value.ToString()); int selectedClientAddressId = Convert.ToInt32(dataGridClientAddress.Rows[i].Cells[0].Value.ToString()); string cityName = dataGridClientAddress.Rows[i].Cells[2].Value.ToString(); string countyName = dataGridClientAddress.Rows[i].Cells[3].Value.ToString(); string streetName = dataGridClientAddress.Rows[i].Cells[4].Value.ToString(); string streetNr = dataGridClientAddress.Rows[i].Cells[5].Value.ToString(); string unique = dataGridClientAddress.Rows[i].Cells[6].Value.ToString(); ClientAddressForm caaf = new ClientAddressForm(selectedClientId, selectedClientAddressId, this, 1); caaf.PopulateFormAddress(cityName, countyName, streetName, streetNr, unique); caaf.Show(); this.Hide(); FormState.PreviousPage = this; } else { MessageBox.Show("Nu se poate edita nicio adresa deoarece nu exista vreo adresa pentru acest client", "Atentie", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } }