예제 #1
0
 public List <StandardDTO> Standard(ClassTypeDTO classTypeDTO)
 {
     using (IDbSvc dbSvc = new DbSvc(_configSvc))
     {
         try
         {
             dbSvc.OpenConnection();
             MySqlCommand command = new MySqlCommand();
             command.CommandText = "select StandardId,StandardName from standard where Active=1 and ClassTypeId = '" + classTypeDTO.ClassTypeId + "'";
             command.Connection  = dbSvc.GetConnection() as MySqlConnection;
             _dtData             = new DataTable();
             MySqlDataAdapter msDa = new MySqlDataAdapter(command);
             msDa.Fill(_dtData);
             List <StandardDTO> lstStandard = new List <StandardDTO>();
             if (_dtData != null && _dtData.Rows.Count > 0)
             {
                 StandardDTO standardDTO = null;
                 foreach (DataRow dr in _dtData.Rows)
                 {
                     standardDTO              = new StandardDTO();
                     standardDTO.StandardId   = (int)dr["StandardId"];
                     standardDTO.StandardName = dr["StandardName"].ToString();
                     lstStandard.Add(standardDTO);
                 }
             }
             return(lstStandard);
         }
         catch (Exception exp)
         {
             throw exp;
         }
     }
 }
예제 #2
0
 public List <ClassTypeDTO> ClassType()
 {
     using (IDbSvc dbSvc = new DbSvc(_configSvc))
     {
         try
         {
             dbSvc.OpenConnection();
             MySqlCommand command = new MySqlCommand();
             command.CommandText = "select ClassTypeId,ClassTypeName from classtype where Active=1";
             command.Connection  = dbSvc.GetConnection() as MySqlConnection;
             _dtData             = new DataTable();
             MySqlDataAdapter msDa = new MySqlDataAdapter(command);
             msDa.Fill(_dtData);
             List <ClassTypeDTO> lstClassType = new List <ClassTypeDTO>();
             if (_dtData != null && _dtData.Rows.Count > 0)
             {
                 ClassTypeDTO classDTO = null;
                 foreach (DataRow dr in _dtData.Rows)
                 {
                     classDTO               = new ClassTypeDTO();
                     classDTO.ClassTypeId   = (int)dr["ClassTypeId"];
                     classDTO.ClassTypeName = dr["ClassTypeName"].ToString();
                     lstClassType.Add(classDTO);
                 }
             }
             return(lstClassType);
         }
         catch (Exception exp)
         {
             throw exp;
         }
     }
 }
예제 #3
0
        public ClassTypeDTO Create(ClassTypeDTO modeDTO)
        {
            if (modeDTO != null)
            {
                return(ClassTypeAssembler.ToDTO(classTypeRepos.CreateClassType(ClassTypeAssembler.ToEntity(modeDTO))));
            }

            return(null);
        }
예제 #4
0
        public SelectList getClassTypeDropDown()
        {
            List <ClassTypeDTO> rDto  = _ddlRepo.ClassType();
            ClassTypeDTO        blank = new ClassTypeDTO();

            blank.ClassTypeId   = -1;
            blank.ClassTypeName = "";
            rDto.Insert(0, blank);
            return(new SelectList(rDto, "ClassTypeId", "ClassTypeName"));
        }
예제 #5
0
        public ClassTypeDTO Get(int id)
        {
            ClassTypeDTO oClassTypeDTO = null;

            if (id > 0)
            {
                ClassType oClassType = classTypeRepos.GetClassType(id);
            }

            return(oClassTypeDTO);
        }
예제 #6
0
        public ClassTypeDTO Update(ClassTypeDTO modelDTO)
        {
            ClassTypeDTO returnUserMap = null;

            if (modelDTO != null && modelDTO.ClassTypeID > 0)
            {
                classTypeRepos.UpdateClassType(0, ClassTypeAssembler.ToEntity(modelDTO));
                returnUserMap = modelDTO;
            }

            return(returnUserMap);
        }
        /// <summary>
        /// Converts this instance of <see cref="ClassType"/> to an instance of <see cref="ClassTypeDTO"/>.
        /// </summary>
        /// <param name="entity"><see cref="ClassType"/> to convert.</param>
        public static ClassTypeDTO ToDTO(this ClassType entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var dto = new ClassTypeDTO();

            dto.ClassTypeID = entity.ClassTypeID;
            dto.Name        = entity.Name;
            dto.Code        = entity.Code;
            dto.Description = entity.Description;

            entity.OnDTO(dto);

            return(dto);
        }
        /// <summary>
        /// Converts this instance of <see cref="ClassTypeDTO"/> to an instance of <see cref="ClassType"/>.
        /// </summary>
        /// <param name="dto"><see cref="ClassTypeDTO"/> to convert.</param>
        public static ClassType ToEntity(this ClassTypeDTO dto)
        {
            if (dto == null)
            {
                return(null);
            }

            var entity = new ClassType();

            entity.ClassTypeID = dto.ClassTypeID;
            entity.Name        = dto.Name;
            entity.Code        = dto.Code;
            entity.Description = dto.Description;

            dto.OnEntity(entity);

            return(entity);
        }
예제 #9
0
        public SelectList getStandardDropDown(ClassTypeDTO classTypeDTO)
        {
            List <StandardDTO> rDto = _ddlRepo.Standard(classTypeDTO);

            return(new SelectList(rDto, "StandardId", "StandardName"));
        }
 /// <summary>
 /// Invoked when <see cref="ToEntity"/> operation is about to return.
 /// </summary>
 /// <param name="entity"><see cref="ClassType"/> converted from <see cref="ClassTypeDTO"/>.</param>
 static partial void OnEntity(this ClassTypeDTO dto, ClassType entity);
 /// <summary>
 /// Invoked when <see cref="ToDTO"/> operation is about to return.
 /// </summary>
 /// <param name="dto"><see cref="ClassTypeDTO"/> converted from <see cref="ClassType"/>.</param>
 static partial void OnDTO(this ClassType entity, ClassTypeDTO dto);