protected void btn_delete_Click(object sender, EventArgs e) { /*difference between find_ID and Select is that find_ID is bool and Select return a class*/ try { cls_operations_admin obj1 = new cls_operations_admin(); cls_operations_admin obj2 = new cls_operations_admin(); if (obj2.find_ID(txt_ID.Text)) { obj1 = obj2.Select(txt_ID.Text); global_filepath = obj1.Photo; //lbl_success.Text = obj1.Photo; // lbl_success.Text = "Product Deleted Successfully"; // obj2.ID = Int32.Parse(txt_ID.Text); //global_filepath = obj2.Photo; if (obj2.Delete(txt_ID.Text)) { lbl_success.Text = "Product Deleted Successfully "; txt_ID.Text = ""; DeleteFileFromFolder(global_filepath); // DeleteFileFromFolder(global_filepath); } else { lblstatus.Text = obj2.msg; } lblstatus.Text = ""; } else { lblstatus.Text = "ID not found"; } } catch (Exception ex) { Response.Write("<script>alert('" + ex.Message + "');</script>"); } }
protected void LINK_BUTTUN_ID_Click(object sender, EventArgs e) { cls_operations_admin obj2 = new cls_operations_admin(0, 0, 0, "", "", 0, "", "", 0); cls_operations_admin obj1 = new cls_operations_admin(); if (obj2.find_ID(txt_ID.Text)) { obj2 = obj1.Select(txt_ID.Text); txt_name.Text = obj2.Name; txt_brand.Text = obj2.Brand; txt_price.Text = obj2.Price.ToString(); txt_description.Text = obj2.Description; DDL_category.SelectedValue = obj2.Fk_id_cat.ToString(); Image2.ImageUrl = obj2.Photo; txt_current_stock.Text = obj2.Current_stock.ToString(); global_filepath = obj2.Photo; lblstatus.Text = ""; // lbl_success.Text = "Product Updated Successfully " + global_filepath + "< "; } else { lblstatus.Text = "ID not found"; } }