private void PetFoodView_Load(object sender, EventArgs e) { PetFoodModel pfm = new PetFoodModel(); pf_idTextEdit.Text = pfm.getNextID(); pf_statusTextEdit.SelectedItem = "Active"; }
private void pf_idTextEdit_Click(object sender, EventArgs e) { //get next id PetFoodModel pfm = new PetFoodModel(); pf_idTextEdit.Text = pfm.getNextID(); //auto set status new item is Active pf_statusTextEdit.SelectedItem = "Active"; }
private void pf_imageTextEdit_Click(object sender, EventArgs e) { openDialog.Filter = "Image files (*.jpg)|*.jpg|Image files (*.png)|*.png|All files (*.*)|*.*"; openDialog.ShowDialog(); if (openDialog.FileName != "" && (openDialog.FileName.EndsWith(".jpg") || openDialog.FileName.EndsWith(".png"))) { PetFoodModel pfm = new PetFoodModel(); if (openDialog.FileName.EndsWith(".jpg")) { pf_imageTextEdit.Text = pfm.getNextID() + ".jpg"; } else { pf_imageTextEdit.Text = pfm.getNextID() + ".png"; } } else { XtraMessageBox.Show("Please choose a image with (*.jpg)/(*.png) file !!!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void pf_imageTextEdit_Click(object sender, EventArgs e) { //set type file choose openDialog.Filter = "Image files (*.jpg)|*.jpg|Image files (*.png)|*.png|All files (*.*)|*.*"; openDialog.ShowDialog(); //check have choose file or not and file choose must be a image file if (openDialog.FileName != "" && (openDialog.FileName.EndsWith(".jpg") || openDialog.FileName.EndsWith(".png"))) { PetFoodModel pfm = new PetFoodModel(); //set text box Image with ID + ".jpg" or ".png" for save to database if (openDialog.FileName.EndsWith(".jpg")) { pf_imageTextEdit.Text = pfm.getNextID() + ".jpg"; } else { pf_imageTextEdit.Text = pfm.getNextID() + ".png"; } } else { XtraMessageBox.Show("Please choose a image with *.jpg or *.png file !!!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void pf_idTextEdit_Click(object sender, EventArgs e) { PetFoodModel pfm = new PetFoodModel(); pf_idTextEdit.Text = pfm.getNextID(); }