private void UpdateForm() { AisleNumber.Clear(); SectionName.Clear(); PositionNumber.Clear(); ShelfNumber.Clear(); LocationMax.Clear(); Keyboard.Focus(AisleNumber); OutputViewer.Items.Refresh(); }
private void button8_Click(object sender, EventArgs e) { AddSection.Visible = true; DeleteSection.Visible = true; button4.Visible = false; CancelSection.Visible = false; SectionName.Clear(); //to generate code and refresh sections refreshAdvisorsCmb(); refreshSections(); }
private void AddSection_Click(object sender, EventArgs e) { string txtSectionCode = SectionCode.Text; string txtSectionName = SectionName.Text; if (SectionName.Text != "") { try { string txtSectionAdviser = getAdvisorCodeFromList(cmbAdvisorName.SelectedItem.ToString()); //search if existing if (!isExisting(txtSectionName, SectionList)) { dbConnect.Insert("insert into tblSection values('" + txtSectionCode + "','" + txtSectionName + "','" + txtSectionAdviser + "',false);"); this.SectionCode.Text = codeGenerator.generateCodeChild("tblSection", "strSectCode", getAdvisorCodeFromList(cmbAdvisorName.SelectedItem.ToString()), "Sec"); } SectionName.Clear(); } catch (Exception) { MessageBox.Show("No selected adviser"); } } else { MessageBox.Show("Input a Section name"); } //refresh Sections refreshSections(); AddSection.Visible = true; DeleteSection.Visible = true; button4.Visible = false; CancelSection.Visible = false; //-----Reseting data //clear cmb and code //for trying if there are advisers try { this.cmbAdvisorName.SelectedIndex = 0; } catch (ArgumentOutOfRangeException) { MessageBox.Show("No Registered Adviser, Please register faculties first"); } }
private void DeleteSection_Click(object sender, EventArgs e) { try { string c = this.SectionList.SelectedRows[0].Cells[0].Value.ToString(); DialogResult dialogResult = MessageBox.Show("Are you you want to delete " + SectionName.Text + "?", "Delete?", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { foreach (DataGridViewRow row in this.SectionList.SelectedRows) { //Logical delete in database dbConnect.Update("Update tblSection set boolSectIsDel = true where strSectCode = '" + row.Cells[0].Value.ToString() + "';"); } AddSection.Visible = true; button4.Visible = false; CancelSection.Visible = false; SectionName.Clear(); //to generate code and refresh sections refreshAdvisorsCmb(); refreshSections(); } else if (dialogResult == DialogResult.No) { } } catch (ArgumentOutOfRangeException) { MessageBox.Show("No selected Section"); } //refresh Sections refreshSections(); //for trying if there are advisers try { this.cmbAdvisorName.SelectedIndex = 0; } catch (ArgumentOutOfRangeException) { MessageBox.Show("No Registered Adviser, Please register faculties first"); } }
private void button4_Click(object sender, EventArgs e) { if (!isExisting(SectionName.Text, SectionList)) { dbConnect.Update("update tblSection set strSectName = '" + SectionName.Text + "', strSectFacuCode = '" + getAdvisorCodeFromList(cmbAdvisorName.SelectedItem.ToString()) + "' where strSectCode = '" + SectionCode.Text + "';"); MessageBox.Show("Update Successful!"); AddSection.Visible = true; DeleteSection.Visible = true; button4.Visible = false; CancelSection.Visible = false; SectionName.Clear(); //to generate code and refresh data grid refreshAdvisorsCmb(); refreshSections(); } }
private void button1_Click(object sender, EventArgs e) { string txtSectionCode = SectionCode.Text; string txtSectionName = SectionName.Text; if (SectionName.Text != "") { try { string txtSectionAdviser = getAdvisorCodeFromList(cmbAdvisorName.SelectedItem.ToString()); //search if existing if (!isExisting(txtSectionName, SectionList)) { dbConnect.Insert("insert into tblSection values('" + txtSectionCode + "','" + txtSectionName + "','" + txtSectionAdviser + "',false);"); this.SectionCode.Text = codeGenerator.generateCodeChild("tblSection", "strSectCode", getAdvisorCodeFromList(cmbAdvisorName.SelectedItem.ToString()), "Sec"); this.Close(); } SectionName.Clear(); } catch (Exception) { MessageBox.Show("No selected adviser"); } } else { MessageBox.Show("Input a Section name"); } try { this.cmbAdvisorName.SelectedIndex = 0; } catch (ArgumentOutOfRangeException) { MessageBox.Show("No Registered Adviser, Please register faculties first"); } }