using System;

namespace NKC_WF.WebUserControls
{
    public partial class cmp_ML_ShDet : BaseUserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public int StatusReqStart
        {
            get
            {
                int answ = 0;
                int.TryParse(hfStatus.Value, out answ);
                return answ;
            }
            set
            {
                hfStatus.Value = value.ToString();
                // update generale
                doUpdate();
            }
        }
        public int StatusReqEnd
        {
            get
            {
                int answ = 0;
                int.TryParse(hfStatusEnd.Value, out answ);
                return answ;
            }
            set
            {
                hfStatusEnd.Value = value.ToString();
                // update generale
                doUpdate();
            }
        }
        public int BatchId
        {
            set
            {
                hfBatchID.Value = value.ToString();
                doUpdate();
            }
            get
            {
                int answ = 0;
                int.TryParse(hfBatchID.Value, out answ);
                return answ;
            }
        }

        public string getCss(object _status)
        {
            string answ = "";
            int status = -10;
            int.TryParse(_status.ToString(), out status);
            string colore = "dark";
            switch (status)
            {
                case 1:
                case 3:
                case 5:
                    colore = "success";
                    break;
                case 2:
                case 4:
                case 6:
                    colore = "warning";
                    break;
                default:
                    colore = "secondary";
                    break;
            }
            answ = $"alert-{colore} border border-{colore}";
            return answ;
        }

        public void doUpdate()
        {
            // sistemo filtraggio frmView
            frmView.DataBind();
        }

        public string getTitle(object _status)
        {
            string answ = "";
            int status = -10;
            int.TryParse(_status.ToString(), out status);
            switch (status)
            {
                case 0:
                    answ = traduci("Loading");
                    break;
                case 1:
                    answ = traduci("Printing");
                    break;
                case 2:
                    answ = traduci("Printed");
                    break;
                case 3:
                    answ = traduci("Machining");
                    break;
                case 4:
                    answ = traduci("Machined");
                    break;
                case 5:
                    answ = traduci("Unloading");
                    break;
                case 6:
                    answ = traduci("Unloaded");
                    break;
                default:
                    answ = traduci("NotStarted");
                    break;
            }
            return answ;
        }
    }
}