using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace NKC_WF.WebUserControls
{
    public partial class cmp_cartDetIRK : BaseUserControl
    {
        #region Protected Properties

        protected string ItemExtCode
        {
            get
            {
                string answ = "";
                if (grView.SelectedIndex >= 0)
                {
                    answ = grView.SelectedValue.ToString();
                }
                return answ;
            }
        }

        #endregion Protected Properties

        #region Public Properties

        /// <summary>
        /// Cart selezionato
        /// </summary>
        public int CartID
        {
            get
            {
                int answ = 0;
                int.TryParse(hfCartID.Value, out answ);
                return answ;
            }
            set
            {
                hfCartID.Value = value.ToString();
                //grView.DataBind();
            }
        }

        #endregion Public Properties

        #region Protected Methods

        protected void grView_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(ItemExtCode))
            {
                // esegue la stored di reset delle PART con quel ExtCode nel cart...
                DLMan.taIL.invalidateByPartCart(CartID, ItemExtCode, PlaceCod);
            }
            grView.DataBind();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
        }

        #endregion Protected Methods

        #region Public Methods

        public bool checkQty(object _qty)
        {
            bool answ = false;
            int num = 0;
            int.TryParse(_qty.ToString(), out num);
            answ = num > 0;
            return answ;
        }

        public void doUpdate()
        {
            grView.DataBind();
        }

        #endregion Public Methods
    }
}