示例#1
0
 /// <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_RoutInfo ConvertToTable(RoutInfoModel model)
 {
     DataLayer.PP_RoutInfo tbl = new DataLayer.PP_RoutInfo();
     tbl.RoutID         = model.RoutID;
     tbl.RoutName       = model.RoutName;
     tbl.WorkStationID  = model.WorkStationID;
     tbl.RoutTypeID     = model.RoutTypeID;
     tbl.PartID         = model.PartID;
     tbl.YearID         = model.YearID;
     tbl.BranchID       = model.BranchID;
     tbl.UserID         = model.UserID;
     tbl.RegisteredDate = model.RegisteredDate;
     tbl.IsActived      = model.IsActived;
     return(tbl);
 }
示例#2
0
        /// <summary>
        /// this function conver the table form to model
        /// </summary>
        /// <param name="tbl"></param> the covertable table
        /// <returns></returns>the converted model
        public RoutInfoModel ConvertToModel(DataLayer.PP_RoutInfo tbl)
        {
            RoutInfoModel model = new RoutInfoModel();

            model.RoutID          = tbl.RoutID;
            model.RoutName        = tbl.RoutName;
            model.WorkStationID   = tbl.WorkStationID;
            model.RoutTypeID      = tbl.RoutTypeID;
            model.PartID          = tbl.PartID;
            model.YearID          = tbl.YearID;
            model.BranchID        = tbl.BranchID;
            model.UserID          = tbl.UserID;
            model.IsActived       = (int)tbl.IsActived;
            model.RegisteredDate  = tbl.RegisteredDate;
            model.PartName        = context.MRP_PartInfos.Where(q => q.PartID == tbl.PartID).FirstOrDefault().PartName;
            model.WorkStationName = context.PP_WorkStationInfos.Where(q => q.WorkStationID == tbl.WorkStationID).FirstOrDefault().WorkStationName;
            model.RoutTypeName    = context.PP_RoutTypeInfos.Where(q => q.RoutTypeID == tbl.RoutTypeID).FirstOrDefault().RoutTypeName;
            return(model);
        }