Пример #1
0
        public CanbanInfoModel ConvertToModel(DataLayer.PP_CanbanInfo tbl)
        {
            CanbanInfoModel model = new CanbanInfoModel();

            model.CanbanID        = tbl.CanbanID;
            model.IOTrackingCode  = tbl.IOTrackingCode;
            model.IOPackageCode   = tbl.IOPackageCode;
            model.IOInventoryCode = tbl.IOInventoryCode;
            model.InputOutputID   = tbl.InputOutputID;
            model.CanbanPartID    = tbl.CanbanPartID;
            model.UnitID          = tbl.UnitID;
            model.Quantity        = tbl.Quantity;
            model.UserID          = tbl.UserID;
            model.YearID          = tbl.YearID;
            model.BranchID        = tbl.BranchID;
            model.RegisteredDate  = tbl.RegisteredDate;
            model.TechnicalCode   = tbl.TechnicalCode;
            model.CProcessStageID = tbl.CProcessStageID;
            if (context.PP_WarehouseTypeInfos.Where(q => q.WarehouseTypeInfoID == tbl.IOInventoryCode).FirstOrDefault() != null)
            {
                model.IOInventoryCodeName = context.PP_WarehouseTypeInfos.Where(q => q.WarehouseTypeInfoID == tbl.IOInventoryCode).FirstOrDefault().WarehouseTypeInfoName;
            }
            if (context.MRP_PartInfos.Where(q => q.PartID == tbl.CanbanPartID).FirstOrDefault() != null)
            {
                model.CanbanPartIDName = context.MRP_PartInfos.Where(q => q.PartID == tbl.CanbanPartID).FirstOrDefault().PartName;
            }
            if (context.MRP_PartInfos.Where(q => q.PartID == tbl.CanbanPartID).FirstOrDefault() != null)
            {
                model.TechnicalCodeName = context.MRP_PartInfos.Where(q => q.PartID == tbl.CanbanPartID).FirstOrDefault().TechnicalNumber;
            }
            ;
            if (context.PP_UnitInfos.Where(q => q.UnitID == tbl.UnitID).FirstOrDefault() != null)
            {
                model.UnitIDName = context.PP_UnitInfos.Where(q => q.UnitID == tbl.UnitID).FirstOrDefault().UnitName;
            }
            if (context.PP_ProcessStageInfos.Where(q => q.ProcessStageID == tbl.CProcessStageID).FirstOrDefault() != null)
            {
                model.CProcessStageIDName = context.PP_ProcessStageInfos.Where(q => q.ProcessStageID == tbl.CProcessStageID).FirstOrDefault().ProcessStageName;
            }
            if (context.PP_WorkersInfos.Where(q => q.WorkersID == tbl.CWorkerID).FirstOrDefault() != null)
            {
                model.WorkerName = context.PP_WorkersInfos.Where(q => q.WorkersID == tbl.CWorkerID).FirstOrDefault().WorkersSurname;
            }
            if (context.PP_CodeInfos.Where(q => q.CodeID == tbl.IOPackageCode).FirstOrDefault() != null)
            {
                model.IOPackageCodeName = context.PP_CodeInfos.Where(q => q.CodeID == tbl.IOPackageCode).FirstOrDefault().CodeDesc;
            }
            if (context.PP_CodeInfos.Where(q => q.CodeID == tbl.IOTrackingCode).FirstOrDefault() != null)
            {
                model.IOTrackingCodeName = context.PP_CodeInfos.Where(q => q.CodeID == tbl.IOTrackingCode).FirstOrDefault().CodeDesc;
            }
            model.CWorkerID = tbl.CWorkerID;
            return(model);
        }
Пример #2
0
 public DataLayer.PP_CanbanInfo ConvertToTable(CanbanInfoModel model)
 {
     DataLayer.PP_CanbanInfo tbl = new DataLayer.PP_CanbanInfo();
     tbl.CanbanID        = model.CanbanID;
     tbl.IOTrackingCode  = model.IOTrackingCode;
     tbl.IOPackageCode   = model.IOPackageCode;
     tbl.IOInventoryCode = model.IOInventoryCode;
     tbl.InputOutputID   = model.InputOutputID;
     tbl.CanbanPartID    = model.CanbanPartID;
     tbl.UnitID          = model.UnitID;
     tbl.Quantity        = model.Quantity;
     tbl.UserID          = model.UserID;
     tbl.YearID          = model.YearID;
     tbl.BranchID        = model.BranchID;
     tbl.RegisteredDate  = model.RegisteredDate;
     tbl.TechnicalCode   = model.TechnicalCode;
     tbl.CProcessStageID = model.CProcessStageID;
     tbl.CWorkerID       = model.CWorkerID;
     return(tbl);
 }