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_partMIA : BaseUserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// BatchId corrente...
        /// </summary>
        public int BatchId
        {
            set
            {
                hfBatchID.Value = value.ToString();
                doUpdate();
            }
            get
            {
                int answ = 0;
                int.TryParse(hfBatchID.Value, out answ);
                return answ;
            }
        }
        /// <summary>
        /// Calcola css da statusID
        /// </summary>
        /// <param name="_statusID"></param>
        /// <returns></returns>
        public string cssByStatus(object _statusID)
        {
            string answ = "text-secondary";
            int statusID = 0;
            int.TryParse(_statusID.ToString(), out statusID);
            switch (statusID)
            {
                case 1:
                    answ = "text-dark";
                    break;
                case 2:
                    answ = "text-warning";
                    break;
                case 3:
                    answ = "text-success";
                    break;
                case 4:
                    answ = "text-info";
                    break;
                default:
                    answ = "text-danger";
                    break;
            }
            return answ;
        }

        public void doUpdate()
        {
            grView.DataBind();
        }
        public int numRow
        {
            get
            {
                return grView.PageSize;
            }
            set
            {
                grView.PageSize = value;
            }
        }
        public bool showFull
        {
            get
            {
                bool answ = false;
                bool.TryParse(hfShowFull.Value, out answ);
                return answ;
            }
            set
            {
                hfShowFull.Value = value.ToString();
                grView.DataBind();
            }
        }
        public bool enableScrap
        {
            get
            {
                bool answ = false;
                bool.TryParse(hfEnableScrap.Value, out answ);
                return answ;
            }
            set
            {
                hfEnableScrap.Value = value.ToString();
                grView.DataBind();
            }
        }
        public bool checkVisible(object _statusID)
        {
            bool answ = false;
            int StatusID = 0;
            int.TryParse(_statusID.ToString(), out StatusID);
            answ = StatusID < 900;
            return answ;
        }
    }
}