protected void Page_Load(object sender, EventArgs e)
        {
            //I was trying to update the data but everytime I select the DropDowList refresh the page and remove the actual data
            cls_operations_admin obj1 = new cls_operations_admin(0, "", "", "", "", "", "", "");
            cls_operations_admin obj2 = new cls_operations_admin(0, "", "", "", "", "", "", "");

            obj2 = obj1.select_Profile(Session["Ides"].ToString());
            txt_first_name.Text       = obj2.First_Name;
            txt_last_name.Text        = obj2.Last_Name;
            txt_cell_phone.Text       = obj2.Number_Phone;
            DDL_country.SelectedValue = obj2.Country;
            txt_city.Text             = obj2.City;
            txt_address.Text          = obj2.Address;
            txt_zipcode.Text          = obj2.Zip_Code;


            /*
             *
             * bool status = true;
             *
             * if (status == true)
             * {
             *  status = false;
             *
             *
             * }
             * else
             * {
             *  //status = false;
             * }*/
        }
        protected void Button3_Click(object sender, EventArgs e)
        {
            try
            {
                cls_operations_admin obj1 = new cls_operations_admin();
                cls_operations_admin obj2 = new cls_operations_admin(0, 0, 0, "", "", 0, "", "", 0);
                obj1            = obj2.Select(txt_ID.Text);
                global_filepath = obj1.Photo;


                obj2.ID = Int32.Parse(txt_ID.Text);

                obj2.Name          = txt_name.Text.Trim();
                obj2.Brand         = txt_brand.Text.Trim();
                obj2.Price         = float.Parse(txt_price.Text);
                obj2.Description   = txt_description.Text.Trim();
                obj2.Photo         = img_upload(FileUpload1);
                obj2.Current_stock = Int32.Parse(txt_current_stock.Text);

                /*if (String.IsNullOrEmpty(obj2.Name)) //this was to verify i the var was empty of not
                 * {
                 *  Response.Write("<script>alert('fil');</script>");
                 * }
                 * else
                 * {
                 *  Response.Write("<script>alert('nope');</script>");
                 * }*/
                //lbl_success.Text = "Product Updated Successfully " + global_filepath+"< ";

                if (status == true)//check if the picture fulfill all the requirements in the algorithm
                {
                    if (obj2.Updatek())
                    {
                        lbl_success.Text = "Product Updated Successfully ";
                        // Response.Write("<script>alert('success');</script>");
                        txt_ID.Text                = "";
                        txt_name.Text              = "";
                        txt_brand.Text             = "";
                        txt_price.Text             = "";
                        txt_description.Text       = "";
                        DDL_category.SelectedValue = "0";
                        txt_current_stock.Text     = "";
                        // DeleteFileFromFolder(global_filepath);
                        status = false;
                        DeleteFileFromFolder(global_filepath);
                    }
                    else
                    {
                        lbl_verification.Text = obj2.msg;
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Write("<script>alert('" + ex.Message + "');</script>");
            }
        }
        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";
            }
        }
        protected void btn_add_Click(object sender, EventArgs e)
        {
            try
            {
                cls_operations_admin obj = new cls_operations_admin(0, 0, 0, "", "", 0, "", "", 0);

                obj.Fk_id_admin   = Int32.Parse(Session["Ides"].ToString());
                obj.Fk_id_cat     = Int32.Parse(DDL_category.SelectedValue);
                obj.Name          = txt_name.Text;
                obj.Brand         = txt_brand.Text;
                obj.Price         = float.Parse(txt_price.Text);
                obj.Description   = txt_description.Text;
                obj.Photo         = img_upload(FileUpload);
                obj.Current_stock = Int32.Parse(txt_current_stock.Text);

                if (status == true)//check if the picture fulfill all the requirements in the algorithm
                {
                    obj.Add();

                    lbl_success.Text = "Product successfully added";

                    txt_name.Text              = "";
                    txt_brand.Text             = "";
                    txt_price.Text             = "";
                    txt_description.Text       = "";
                    DDL_category.SelectedValue = "0";
                    txt_current_stock.Text     = "";
                    status = false;
                }
            }
            catch (Exception ex)
            {
                // Mostrara un mensaje en caso de no completar la operaciĆ³n
                Response.Write("ERROR 4004  " + ex);
            }
        }