public EL.Registrations.Plants Select(EL.Registrations.Plants plantEL) { DataTable dt = null; using (var cmd = new MySqlCommand()) { cmd.CommandText = "select * from plants where plantid = @plantid"; cmd.Parameters.AddWithValue("@plantid", plantEL.Plantid); dt = methods.executeQuery(cmd); } if (dt.Rows.Count > 0) { plantEL.Plantid = Convert.ToInt32(dt.Rows[0]["plantid"]); plantEL.Plantcategoryid = Convert.ToInt32(dt.Rows[0]["plantcategoryid"]); plantEL.Plantcommonname = dt.Rows[0]["plantcommonname"].ToString(); plantEL.Plantscientificname = dt.Rows[0]["plantscientificname"].ToString(); plantEL.Plantfamily = dt.Rows[0]["plantfamily"].ToString(); plantEL.Plantmorphology = dt.Rows[0]["plantmorphology"].ToString(); plantEL.Planteconomicimportance = dt.Rows[0]["planteconomicimportance"].ToString(); plantEL.Plantwholeimage = dt.Rows[0]["plantwholeimage"].ToString(); plantEL.Plantflowerimage = dt.Rows[0]["plantflowerimage"].ToString(); plantEL.Plantleavesimage = dt.Rows[0]["plantleavesimage"].ToString(); return(plantEL); } else { return(null); } }
public Boolean Delete(EL.Registrations.Plants plantEL) { using (var cmd = new MySqlCommand()) { cmd.CommandText = "delete from plants where plantid = @plantid"; cmd.Parameters.AddWithValue("@plantid", plantEL.Plantid); return(methods.executeNonQueryBool(cmd)); } }
private void View(EL.Registrations.Plants _plantEL) { ShowForm(false); plantEL = plantBL.Select(_plantEL); lblCommonNameView.Text = plantEL.Plantcommonname; lblScientificNameView.Text = plantEL.Plantscientificname; lblFamilyView.Text = plantEL.Plantfamily; lblPlantMorphologyView.Text = plantEL.Plantmorphology; lblEconomicImportanceView.Text = plantEL.Planteconomicimportance; pbWholePlantView.Image = Image.FromFile(plantEL.Plantwholeimage); pbLeavesView.Image = Image.FromFile(plantEL.Plantleavesimage); pbFlowersView.Image = Image.FromFile(plantEL.Plantflowerimage); }
public long Insert(EL.Registrations.Plants plantEL) { using (var cmd = new MySqlCommand()) { cmd.CommandText = "insert into plants set plantcategoryid = @plantcategoryid, plantcommonname = @plantcommonname, plantscientificname = @plantscientificname, plantfamily = @plantfamily, plantmorphology = @plantmorphology, planteconomicimportance = @planteconomicimportance, plantwholeimage = @plantwholeimage, plantflowerimage = @plantflowerimage, plantleavesimage = @plantleavesimage"; cmd.Parameters.AddWithValue("@plantcategoryid", plantEL.Plantcategoryid); cmd.Parameters.AddWithValue("@plantcommonname", plantEL.Plantcommonname); cmd.Parameters.AddWithValue("@plantscientificname", plantEL.Plantscientificname); cmd.Parameters.AddWithValue("@plantfamily", plantEL.Plantfamily); cmd.Parameters.AddWithValue("@plantmorphology", plantEL.Plantmorphology); cmd.Parameters.AddWithValue("@planteconomicimportance", plantEL.Planteconomicimportance); cmd.Parameters.AddWithValue("@plantwholeimage", plantEL.Plantwholeimage); cmd.Parameters.AddWithValue("@plantflowerimage", plantEL.Plantflowerimage); cmd.Parameters.AddWithValue("@plantleavesimage", plantEL.Plantleavesimage); return(methods.executeNonQueryLong(cmd)); } }
public frmPlantCRUD(string _s, EL.Registrations.Plants _plantEL, PL.Registrations.frmPlant _frmPlant, EL.Registrations.Plantcategories _plantcategoryEL) { InitializeComponent(); plantcategoryEL = _plantcategoryEL; frmPlant = _frmPlant; s = _s; if (s.Equals("ADD")) { ShowForm(true); lblHeader.Text = "Add Plant"; plantEL = new EL.Registrations.Plants(); oldFlower = path + "image-icon-png-8.png"; plantEL.Plantflowerimage = oldFlower; oldWholePlant = path + "image-icon-png-8.png"; plantEL.Plantwholeimage = oldWholePlant; oldLeaves = path + "image-icon-png-8.png"; plantEL.Plantleavesimage = oldLeaves; pbWholePlant.Image = Image.FromFile(path + "image-icon-png-8.png"); pbLeaves.Image = Image.FromFile(path + "image-icon-png-8.png"); pbFlower.Image = Image.FromFile(path + "image-icon-png-8.png"); } else if (s.Equals("VIEW")) { View(_plantEL); pbCloseAdd.Visible = false; } }
public Boolean Delete(EL.Registrations.Plants plantEL) { return(plantDL.Delete(plantEL)); }
public Boolean Update(EL.Registrations.Plants plantEL) { return(plantDL.Update(plantEL)); }
public long Insert(EL.Registrations.Plants plantEL) { return(plantDL.Insert(plantEL)); }
public EL.Registrations.Plants Select(EL.Registrations.Plants plantEL) { return(plantDL.Select(plantEL)); }