public Design MapEntityToObject(TWMDESIGN entity)
        {
            if (entity != null)
            {
                Design obj = new Design();

                obj.District          = entity.CD_DIST;
                obj.WorkRequestID     = entity.CD_WR;
                obj.DesignNumber      = entity.NO_DESIGN.ToString();
                obj.DesignDescription = entity.DS_DESIGN;
                obj.FlagPreferred     = entity.FG_PREFERRED == "Y" ? true : false;
                obj.FlagComplete      = entity.FG_COMPLETE == "Y" ? true : false;
                obj.FlagExtDesign     = entity.FG_EXTDSGN == "Y" ? true : false;

                obj.Points = null;
                if (entity.TWMPOINT_ESTs != null && entity.TWMPOINT_ESTs.Count() > 0)
                {
                    obj.Points = new PointBl().Get(entity.TWMPOINT_ESTs);
                }

                return(obj);
            }

            return(null);
        }
        public TWMDESIGN MapObjectToEntity(Design obj)
        {
            if (obj != null)
            {
                TWMDESIGN entity = new TWMDESIGN();

                entity.CD_DIST = obj.District;
                entity.CD_WR   = obj.WorkRequestID;
                //entity.NO_DESIGN = (short)int.Parse(obj.DesignNumber);
                entity.NO_DESIGN    = 1;
                entity.DS_DESIGN    = obj.DesignDescription;
                entity.FG_PREFERRED = obj.FlagPreferred == true ? "Y" : "N";
                entity.FG_COMPLETE  = obj.FlagComplete == true ? "Y" : "N";
                entity.FG_EXTDSGN   = obj.FlagExtDesign == true ? "Y" : "N";

                entity.TWMPOINT_ESTs = new PointBl().MapObjectsToEntities(obj.Points).ToList();

                return(entity);
            }

            return(null);
        }
 public Design GetByEntity(TWMDESIGN entity)
 {
     return(MapEntityToObject(entity));
 }