/// <summary>
        /// this function conver the table form to model
        /// </summary>
        /// <param name="tbl"></param> the covertable table
        /// <returns></returns>the converted model
        public ProductionLineInfoModel ConvertToModel(DataLayer.PP_ProductionLineInfo tbl)
        {
            ProductionLineInfoModel model = new ProductionLineInfoModel();
            var res         = context.PP_WorkersInfos.Where(q => q.WorkersID == tbl.ResponsibleID).FirstOrDefault();
            var sche        = context.PP_ScheduleProductionLineInfos.Where(q => q.ProductionLineID == tbl.ProductionLineID).FirstOrDefault();
            var shiftstatus = context.PP_ProductionLineInfos.Where(q => q.Shift == tbl.Shift).FirstOrDefault();

            model.ProductionLineID = tbl.ProductionLineID;
            // model.ProductionLineStop = tbl.ProductionLineStop;
            model.ResponsibleID   = tbl.ResponsibleID;
            model.ResponsibleName = (res == null)?"-":res.WorkersSurname;
            model.WorkStationID   = tbl.WorkStationID;
            model.Shift           = tbl.Shift;
            if (shiftstatus != null)
            {
                if (tbl.Shift == 1)
                {
                    model.ShiftName = "شب";
                }
                if (tbl.Shift == 2)
                {
                    model.ShiftName = "روز";
                }
            }
            // model.LineAcceptance = tbl.LineAcceptance;
            // model.LineEfficiency = tbl.LineEfficiency;
            //model.LineGoal = tbl.LineGoal;
            model.RoutID = tbl.RoutID;
            model.YearID = tbl.YearID;
            model.UserID = tbl.UserID;
            if (sche != null)
            {
                model.RegisteredDate = sche.Date;
            }
            else
            {
                model.RegisteredDate = tbl.RegisteredDate;
            }
            model.BranchID = tbl.BranchID;
            //  model.RoutName = context.PP_RoutInfos.Where(q => q.RoutID == tbl.RoutID).FirstOrDefault().RoutName;
            if (context.PP_WorkStationInfos.Where(q => q.WorkStationID == tbl.WorkStationID).FirstOrDefault() != null)
            {
                model.WorkStationName = context.PP_WorkStationInfos.Where(q => q.WorkStationID == tbl.WorkStationID).FirstOrDefault().WorkStationName;
            }
            if (sche != null)
            {
                model.ScheduleProductionLineID = sche.ScheduleProductionLineID;
            }
            return(model);
        }
 /// <summary>
 /// this function convert the model to table form
 /// </summary>
 /// <param name="model"></param> the convertable model
 /// <returns></returns> returns the converted table
 public DataLayer.PP_ProductionLineInfo ConvertToTable(ProductionLineInfoModel model)
 {
     DataLayer.PP_ProductionLineInfo tbl = new DataLayer.PP_ProductionLineInfo();
     tbl.ProductionLineID   = model.ProductionLineID;
     tbl.ProductionLineStop = model.ProductionLineStop;
     tbl.WorkStationID      = model.WorkStationID;
     tbl.LineAcceptance     = model.LineAcceptance;
     tbl.LineEfficiency     = model.LineEfficiency;
     tbl.LineGoal           = model.LineGoal;
     tbl.Shift          = model.Shift;
     tbl.RoutID         = model.RoutID;
     tbl.YearID         = model.YearID;
     tbl.UserID         = model.UserID;
     tbl.RegisteredDate = model.RegisteredDate;
     tbl.BranchID       = model.BranchID;
     tbl.ResponsibleID  = model.ResponsibleID;
     return(tbl);
 }