Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Func _del_product_button($hParent = 0)
- Local $iGOEM_Opt
- $iGOEM_Opt = Opt("GUIOnEventMode", 0)
- $Form_del_product = GUICreate("Удалить продукт", 475, 37, -1, -1)
- $Tovar_Combo_del = GUICtrlCreateCombo("Выберите удаляемый продукт", 8, 8, 393, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
- $del_product= GUICtrlCreateButton("Дальше", 408, 8, 51, 22)
- my_FillCombo($Tovar_Combo_del,$edit_tovar_arr)
- ;заполняем combo из add_product_button
- ;GUISetState(@SW_DISABLE, $hParent)
- GUISetState(@SW_SHOW, $Form_del_product)
- ;MsgBox(0,'',GUICtrlRead($Tovar_Combo_del))
- While 1
- $nMsg = GUIGetMsg()
- Switch $nMsg
- Case $GUI_EVENT_CLOSE
- ;GUISetState(@SW_ENABLE, $hMain_GUI)
- GUIDelete($Form_del_product)
- ExitLoop
- ;Send('{ESC}')
- Case $Tovar_Combo_del
- $id_tovar=my_GetId($Tovar_Combo_del)
- ;MsgBox(0,'',$edit_tovar_arr[$id_tovar][0]); id выбираемого товара в базе
- case $del_product
- ;_ArrayDisplay($edit_tovar_arr); Выбрать товар для редактирования
- if GUICtrlRead($Tovar_Combo_del) == "Выберите удаляемый продукт" Then
- MsgBox(64,'Ошибка','Вы не выбрали раздел')
- ContinueLoop
- EndIf
- $query = "DELETE FROM `shop_product` WHERE id = '"& $edit_tovar_arr[$id_tovar][0] &"' "
- $mysql_bool = _MySQL_Real_Query($MysqlConn, $query)
- If $mysql_bool = $MYSQL_SUCCESS Then
- TrayTip("","Запрос обработан",2000)
- Else
- $errno = _MySQL_errno($MysqlConn)
- MsgBox(0,"Error:",$errno & @LF & _MySQL_error($MysqlConn))
- EndIf
- $res = _MySQL_Store_Result($MysqlConn)
- $arr_edit_product = _MySQL_Fetch_Result_StringArray($res)
- ;_ArrayDisplay($arr_edit_product); Выборка продукта с заданным id
- GUIDelete($Form_del_product)
- ; Обновляем список продуктов после добавления товара
- $query = "SELECT `id`,`name` FROM `shop_product`"
- $mysql_bool = _MySQL_Real_Query($MysqlConn, $query)
- If $mysql_bool = $MYSQL_SUCCESS Then
- ;MsgBox(0, '', "Query OK"); Удачный запрос или нет
- Else
- $errno = _MySQL_errno($MysqlConn)
- MsgBox(0,"Error:",$errno & @LF & _MySQL_error($MysqlConn))
- EndIf
- $res = _MySQL_Store_Result($MysqlConn)
- $edit_tovar_arr = _MySQL_Fetch_Result_StringArray($res)
- _del_product_button($hMain_GUI)
- EndSwitch
- WEnd
- Opt("GUIOnEventMode", $iGOEM_Opt)
- GUISetState(@SW_ENABLE, $hParent)
- GUIDelete($Form_del_product)
- EndFunc
Add Comment
Please, Sign In to add comment