public DataLayer.PP_WasteCanbanInfo ConvertToTable(WasteCanbanInfoModel model) { DataLayer.PP_WasteCanbanInfo tbl = new DataLayer.PP_WasteCanbanInfo(); tbl.WasteCanbanID = model.WasteCanbanID; tbl.FacilityID = model.FacilityID; tbl.WorkerID = model.WorkerID; tbl.WasteSourceID = model.WasteSourceID; tbl.WTrackingCode = model.WTrackingCode; tbl.WPackageCode = model.WPackageCode; tbl.WInventoryCode = model.WInventoryCode; tbl.InputOutputID = model.InputOutputID; tbl.WastageQuantity = model.WastageQuantity; tbl.TaminID = model.TaminID; tbl.WasteDesc = model.WasteDesc; tbl.OvercomeDesc = model.OvercomeDesc; tbl.YearID = model.YearID; tbl.UserID = model.UserID; tbl.BranchID = model.BranchID; tbl.RegisteredDate = model.RegisteredDate; tbl.WCProcessStageID = model.WCProcessStageID; tbl.ActionID = model.ActionID; tbl.FaultID = model.FaultID; tbl.WasteSupplierID = model.WasteSupplierID; tbl.BOM = model.BOM; tbl.WastePartID = model.WastePartID; tbl.ReworkTime = model.ReworkTime; return(tbl); }
///////// second detail public WasteCanbanInfoModel ConvertToModel(DataLayer.PP_WasteCanbanInfo tbl) { WasteCanbanInfoModel model = new WasteCanbanInfoModel(); model.WasteCanbanID = tbl.WasteCanbanID; model.FacilityID = tbl.FacilityID; model.WorkerID = tbl.WorkerID; model.WasteSourceID = tbl.WasteSourceID; model.WTrackingCode = tbl.WTrackingCode; model.WPackageCode = tbl.WPackageCode; model.WInventoryCode = tbl.WInventoryCode; model.InputOutputID = tbl.InputOutputID; model.WastageQuantity = tbl.WastageQuantity; model.TaminID = tbl.TaminID; model.WasteDesc = tbl.WasteDesc; model.OvercomeDesc = tbl.OvercomeDesc; model.YearID = tbl.YearID; model.UserID = tbl.UserID; model.BranchID = tbl.BranchID; model.RegisteredDate = tbl.RegisteredDate; model.ActionID = tbl.ActionID; model.FaultID = tbl.FaultID; model.ReworkTime = tbl.ReworkTime; model.WasteSupplierID = tbl.WasteSupplierID; model.BOM = tbl.BOM; model.WastePartID = tbl.WastePartID; if (context.PP_WarehouseTypeInfos.Where(q => q.WarehouseTypeInfoID == tbl.WInventoryCode).FirstOrDefault() != null) { model.WInventoryCodeName = context.PP_WarehouseTypeInfos.Where(q => q.WarehouseTypeInfoID == tbl.WInventoryCode).FirstOrDefault().WarehouseTypeInfoName; } if (context.PP_CodeInfos.Where(q => q.CodeID == tbl.WPackageCode).FirstOrDefault() != null) { model.WPackageCodeName = context.PP_CodeInfos.Where(q => q.CodeID == tbl.WPackageCode).FirstOrDefault().CodeDesc; } if (context.PP_CodeInfos.Where(q => q.CodeID == tbl.WTrackingCode).FirstOrDefault() != null) { model.WTrackingCodeName = context.PP_CodeInfos.Where(q => q.CodeID == tbl.WTrackingCode).FirstOrDefault().CodeDesc; } if (context.PP_WasteSourceInfos.Where(q => q.WasteSourceID == tbl.WasteSourceID).FirstOrDefault() != null) { model.WasteSourceIDName = context.PP_WasteSourceInfos.Where(q => q.WasteSourceID == tbl.WasteSourceID).FirstOrDefault().WasteSourceName; } if (context.PP_WorkersInfos.Where(q => q.WorkersID == tbl.WorkerID).FirstOrDefault() != null) { model.WorkerIDName = context.PP_WorkersInfos.Where(q => q.WorkersID == tbl.WorkerID).FirstOrDefault().WorkersName + " " + context.PP_WorkersInfos.Where(q => q.WorkersID == tbl.WorkerID).FirstOrDefault().WorkersSurname; } if (context.PP_FacilityInfos.Where(q => q.FacilityID == tbl.FacilityID).FirstOrDefault() != null) { model.FacilityIDName = context.PP_FacilityInfos.Where(q => q.FacilityID == tbl.FacilityID).FirstOrDefault().FacilityName; } if (context.PP_FaultInfos.Where(q => q.FaultID == tbl.FaultID).FirstOrDefault() != null) { model.FaultIDName = context.PP_FaultInfos.Where(q => q.FaultID == tbl.FaultID).FirstOrDefault().FaultName; } if (context.PP_ActionInfos.Where(q => q.ActionID == tbl.ActionID).FirstOrDefault() != null) { model.ActionIDName = context.PP_ActionInfos.Where(q => q.ActionID == tbl.ActionID).FirstOrDefault().ActionName; } if (context.MRP_PartInfos.Where(q => q.PartID == tbl.WastePartID).FirstOrDefault() != null) { model.WastePartIDName = context.MRP_PartInfos.Where(q => q.PartID == tbl.WastePartID).FirstOrDefault().PartName; } if (context.PP_ProcessStageInfos.Where(q => q.ProcessStageID == tbl.WCProcessStageID).FirstOrDefault() != null) { model.WCProcessStageIDName = context.PP_ProcessStageInfos.Where(q => q.ProcessStageID == tbl.WCProcessStageID).FirstOrDefault().ProcessStageName; } if (context.PP_Tamins.Where(q => q.TaminID == tbl.TaminID).FirstOrDefault() != null) { model.TaminName = context.PP_Tamins.Where(q => q.TaminID == tbl.TaminID).FirstOrDefault().TaminName; } //model.WCProcessStageID = tbl.WCProcessStageID; return(model); }