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; } } }
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; } } }
public ClassTypeDTO Create(ClassTypeDTO modeDTO) { if (modeDTO != null) { return(ClassTypeAssembler.ToDTO(classTypeRepos.CreateClassType(ClassTypeAssembler.ToEntity(modeDTO)))); } return(null); }
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")); }
public ClassTypeDTO Get(int id) { ClassTypeDTO oClassTypeDTO = null; if (id > 0) { ClassType oClassType = classTypeRepos.GetClassType(id); } return(oClassTypeDTO); }
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); }
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);