Example #1
0
        internal static ProductsModel Mapping(USR_TMMA_PRODUCTS o)
        {
            try
            {
                if (o != null)
                {
                    return(new ProductsModel()
                    {
                        ProductsID = o.ProductsID,
                        BOMFileID = o.BOMFileID,
                        RoutingFileID = o.RoutingFileID,
                        ProductsTypeID = o.ProductsTypeID,
                        Version = o.Version,
                        IsActive = o.IsActive == 1,
                        CreatedBy = o.CreatedBy,
                        CreatedDate = o.CreatedDate,
                        UpdatedBy = o.UpdatedBy,
                        UpdatedDate = o.UpdatedDate,
                        ProductsType = ProductsTypeDAL.GetProductsType(o.ProductsTypeID),
                        BOMFile = BOMFileDAL.GetBOMFile(o.BOMFileID.GetValueOrDefault()),
                        RoutingFile = RoutingFileDAL.GetRoutingFile(o.RoutingFileID.GetValueOrDefault())
                    });
                }

                return(null);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        internal static List <ProductsModel> Mapping(List <USR_TMMA_PRODUCTS> list)
        {
            ACTION = "Mapping(List<USR_TMMA_PRODUCTS>)";

            try
            {
                if (list != null && list.Count > 0)
                {
                    List <ProductsModel> mList = new List <ProductsModel>();

                    foreach (USR_TMMA_PRODUCTS o in list)
                    {
                        mList.Add(new ProductsModel()
                        {
                            ProductsID     = o.ProductsID,
                            BOMFileID      = o.BOMFileID,
                            RoutingFileID  = o.RoutingFileID,
                            ProductsTypeID = o.ProductsTypeID,
                            Version        = o.Version,
                            IsActive       = o.IsActive == 1,
                            CreatedBy      = o.CreatedBy,
                            CreatedDate    = o.CreatedDate,
                            UpdatedBy      = o.UpdatedBy,
                            UpdatedDate    = o.UpdatedDate,
                            ProductsType   = ProductsTypeDAL.GetProductsType(o.ProductsTypeID),
                            BOMFile        = BOMFileDAL.GetBOMFile(o.BOMFileID.GetValueOrDefault()),
                            RoutingFile    = RoutingFileDAL.GetRoutingFile(o.RoutingFileID.GetValueOrDefault())
                        });
                    }

                    return(mList);
                }

                return(null);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }