本文整理汇总了C#中Dto类的典型用法代码示例。如果您正苦于以下问题:C# Dto类的具体用法?C# Dto怎么用?C# Dto使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Dto类属于命名空间,在下文中一共展示了Dto类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Test
public void Test()
{
var e = new Entity
{
Color = Colors.Blue,
Color2 = Colors.Green,
Mood = Moods.VeryHappy,
Mood2 = Moods.Great,
};
var dto = new Dto();
dto.InjectFrom<EnumToInt>(e);
Assert.AreEqual(2, dto.Color);
Assert.AreEqual(1, dto.Color2);
Assert.AreEqual(2, dto.Mood);
Assert.AreEqual(3, dto.Mood2);
var e2 = new Entity();
e2.InjectFrom<IntToEnum>(dto);
Assert.AreEqual(dto.Color, 2);
Assert.AreEqual(dto.Color2, 1);
Assert.AreEqual(dto.Mood, 2);
Assert.AreEqual(dto.Mood2, 3);
}
开发者ID:tidusjar,项目名称:ValueInjecter,代码行数:26,代码来源:EnumInjectionsTests.cs
示例2: RecuperarFiltrado
/// <summary>
///
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public IEnumerable<Dto.ItemLista> RecuperarFiltrado(Dto.ItemLista obj)
{
IEnumerable<Dto.ItemLista> lst = new Data.DItemsLista().RecuperarFiltrados(obj).ToList();
this.RecuperarItemsHijo_ItemLista(lst);
return lst;
}
开发者ID:cartoneria,项目名称:Cotizar,代码行数:12,代码来源:BItemsLista.cs
示例3: Save
public void Save(Dto.Action action)
{
if (action.Id < 0) {
this.Add (action);
return;
}
try {
int tid = entity.BeginTransaction ();
List<ColumnValue> columns = new List<ColumnValue> ();
columns.Add (new ColumnValue () { Item1 = "gameId", Item2 = action.Game.Id.ToString() });
columns.Add (new ColumnValue () { Item1 = "time", Item2 = action.Time.ToString("yyyy-MM-dd HH:mm:ss") });
columns.Add (new ColumnValue () { Item1 = "description", Item2 = action.Description });
if (action.Player != null) {
columns.Add (new ColumnValue () { Item1 = "playerId", Item2 = action.Player.Id.ToString() });
} else {
columns.Add (new ColumnValue () { Item1 = "playerId", Item2 = null });
}
StatementValue where = new StatementValue ();
where.Item1 = "id = @StatementValue0";
where.Item2 = new List<string> ();
where.Item2.Add (action.Id.ToString ());
this.Update (columns, where);
entity.Commit (tid);
} catch (MySqlException ex) {
entity.Rollback ();
Debug.LogError ("Table " + this.Name + ": Failed to Save: " + ex.Message);
}
}
开发者ID:RicardoEPRodrigues,项目名称:LetsParty,代码行数:31,代码来源:ActionsTable.cs
示例4: Insert
/// <summary>
/// 配信者を新規登録
/// </summary>
/// <param name="detail">チャンネル詳細</param>
public static void Insert(Dto.ChannelDetail detail)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("INSERT ");
sb.AppendLine("INTO `PecaTsuBBS`.`Channel` ( ");
sb.AppendLine(" `ChannelName`");
sb.AppendLine(" , `ChannelType`");
sb.AppendLine(") ");
sb.AppendLine("VALUES ( ");
sb.AppendLine(" @ChannelName");
sb.AppendLine(" , @ChannelType");
sb.AppendLine(") ");
Dictionary<string, string> paramDic = new Dictionary<string, string>();
paramDic["ChannelName"] = detail.ChannelName;
if (detail.IsYPInfo)
{
// YP
paramDic["ChannelType"] = "1";
}
else
{
// 配信者
paramDic["ChannelType"] = "0";
}
DBUtil.Update(sb.ToString(), paramDic);
}
开发者ID:shule517,项目名称:PecaTsu,代码行数:32,代码来源:ChannelDao.cs
示例5: Crear
/// <summary>
///
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public bool Crear(Dto.Usuario obj)
{
string strClave = obj.usuario.Substring(0, 4)
+ arrNumeros[new Random().Next(10)]
+ arrNumeros[new Random().Next(10)]
+ arrCaracteres[new Random().Next(26)]
+ arrSimbolos[new Random().Next(21)];
obj.clave = strClave;
bool blnResul = new Data.DUsuario().Insertar(obj);
if (blnResul)
{
try
{
if (string.IsNullOrEmpty(obj.correoelectronico))
obj.correoelectronico = System.Configuration.ConfigurationManager.AppSettings["GenericEmailTo"].ToString();
Utilidades.EnviarCorreo(obj.correoelectronico, Recursos.MsgMailUsuarioCreacion, Utilidades.PlantillasCorreo.CreaciónUsuario, obj.nombrecompleto, obj.usuario, obj.clave);
}
catch (Exception)
{
//Procesar error
throw;
}
}
return blnResul;
}
开发者ID:cartoneria,项目名称:Cotizar,代码行数:34,代码来源:BUsuario.cs
示例6: GetSearchTourModel
/// <summary>
/// Gets the search tour model.
/// </summary>
/// <param name="search">The search.</param>
/// <param name="pageIndex">Index of the page.</param>
/// <param name="take">The take.</param>
/// <param name="total">The total.</param>
/// <returns></returns>
public IQueryable<Dto.SearchTourDto> GetSearchTourModel(Dto.SearchInfoDto search, int pageIndex, int take, ref int total)
{
IQueryable<Dto.SearchTourDto> data = null;
var temp = tourPlanRepository.GetList(e => e.Days <= search.Days && e.Days > ((search.Days - 2) > 0 ? (search.Days - 2) : 0))
.Where(e => e.IsDelete == 0)
.Where(e => e.PlanTitle.Contains(search.Bide) ||
e.Destination.Contains(search.Bide) ||
e.Remark.Contains(search.Bide)
)
.OrderByDescending(e => e.Days);
total = temp.Count();
data = temp.Select(e => new Dto.SearchTourDto
{
ViCount = e.VisitCount,
Id = e.PlanID,
PlanTitle = e.PlanTitle,
Days = e.Days,
TopReason = e.Destination,
PlanTotalMoney = tourPlanDetailRepository.GetList(c => c.PlanID == e.PlanID).Sum(d => d.CurrentPrice),
UserName = e.UserName,
ClassId = e.PlanClass,
AddTime = e.AddTime
}).OrderByDescending(e => e.ViCount)
.Skip(((pageIndex - 1) < 0 ? 0 : (pageIndex - 1)) * take)
.Take(take).AsQueryable();
return data;
}
开发者ID:JPomichael,项目名称:IPOW,代码行数:35,代码来源:SearchService.cs
示例7: SearchStationsStartingWithAsync
/// <summary>
/// Searches the stations that satisfy the input condidions.
/// </summary>
/// <param name="input">Search conditions.</param>
/// <returns>
/// A task that represents the asynchronous operation.
/// <para>
/// The task result contains a <see cref="Dto.SearchStationsStartingWithOutput" />.
/// </para>
/// </returns>
public async Task<Dto.SearchStationsStartingWithOutput> SearchStationsStartingWithAsync(Dto.SearchStationsStartingWithInput input)
{
await this._logger.LogInfoAsync("entered SearchStationsStartingWithAsync").ConfigureAwait(false);
Dto.SearchStationsStartingWithOutput output = null;
// logger cannot be awaited in catch / finally blocks, so using ExceptionDispatchInfo as a workarround
// The support for this feature is coming in the Roslyn
ExceptionDispatchInfo capturedException = null;
try
{
await this._logger.LogInfoAsync("fetching stations").ConfigureAwait(false);
// fetch stations
var dataRep = await this._stationRepository.GetStationsStartingWithAsync(input.StartingWith).ConfigureAwait(false);
await this._logger.LogInfoAsync("selecting possible characters").ConfigureAwait(false);
// select possible next characters
var nextPossibleCharacters = dataRep
.Where(p => p.Name.Length > input.StartingWith.Length)
.Select(p => p.Name[input.StartingWith.Length]);
await this._logger.LogInfoAsync("mapping results").ConfigureAwait(false);
// map to DTOs
var mappedResult = dataRep.Select(p => new Dto.StationDto()
{
Name = p.Name
});
// prepare output
output = new Dto.SearchStationsStartingWithOutput()
{
Stations = mappedResult,
NextPossbileCharacters = nextPossibleCharacters
};
}
catch (Exception ex)
{
//capture the exception
capturedException = ExceptionDispatchInfo.Capture(ex);
}
// if there's any captured exception, log it.
if (capturedException != null)
{
await this._logger.LogExceptionAsync(capturedException.SourceException).ConfigureAwait(false);
//rethrow the captured exception preserving the stack details
capturedException.Throw();
}
await this._logger.LogInfoAsync("returning").ConfigureAwait(false);
// return
return output;
}
开发者ID:Rzpeg,项目名称:TicketMachine,代码行数:69,代码来源:StationService.cs
示例8: Delete
public void Delete(Dto.Action action)
{
StatementValue where = new StatementValue ();
where.Item1 = "id = @StatementValue0";
where.Item2 = new List<string> ();
where.Item2.Add (action.Id.ToString ());
this.Delete (where);
}
开发者ID:RicardoEPRodrigues,项目名称:LetsParty,代码行数:8,代码来源:ActionsTable.cs
示例9: When_serializing_and_the_type_is_not_bytes
public void When_serializing_and_the_type_is_not_bytes()
{
var input = new Dto { Name = "Dave" };
var serialized = _rawSerializer.Serialize(input);
var expected = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(input));
serialized.ShouldBe(expected);
}
开发者ID:Pondidum,项目名称:RabbitHarness,代码行数:9,代码来源:RawMessageHandlerDecoratorTests.cs
示例10: RecuperarFiltrado
/// <summary>
///
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public IEnumerable<Dto.Rol> RecuperarFiltrado(Dto.Rol obj)
{
IEnumerable<Dto.Rol> lst = new Data.DRol().RecuperarFiltrados(obj).ToList();
foreach (Dto.Rol item in lst)
{
item.permisos = new BPermiso().RecuperarFiltrado(new Dto.Permiso() { rol_idrol = item.idrol });
}
return lst;
}
开发者ID:cartoneria,项目名称:Cotizar,代码行数:15,代码来源:BRol.cs
示例11: RecuperarFiltrado
/// <summary>
///
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public IEnumerable<Dto.Maquina> RecuperarFiltrado(Dto.Maquina obj)
{
IEnumerable<Dto.Maquina> lstResult = new Data.DMaquina().RecuperarFiltrados(obj).ToList();
foreach (var item in lstResult)
{
item.VariacionesProduccion = this.RecuperarVPFiltrado(new Dto.MaquinaVariacionProduccion() { maquina_idmaquina = item.idmaquina }).ToList();
item.DatosPeriodicos = this.RecuperarDPFiltrado(new Dto.MaquinaDatoPeriodico() { maquina_idmaquina = item.idmaquina }).ToList();
}
return lstResult;
}
开发者ID:cartoneria,项目名称:Cotizar,代码行数:15,代码来源:BMaquina.cs
示例12: FaultException
/// <summary>
///
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
Dto.Rol ICMCotizar.Rol_Eliminar(Dto.Rol obj)
{
if (new Business.BRol().Eliminar(obj))
{
return obj;
}
else
{
throw new FaultException(new FaultReason("El rol no pudo ser actualizado."), new FaultCode("002"));
}
}
开发者ID:Rjaspe0905,项目名称:CMCotizar,代码行数:16,代码来源:CMCotizar.cs
示例13: Asesor_Insertar
/// <summary>
///
/// </summary>
/// <param name="obj"></param>
/// <param name="idasesor"></param>
/// <returns></returns>
public bool Asesor_Insertar(Dto.Asesor obj, out byte? idasesor)
{
bool blnRespuesta = new Business.BAsesor().Crear(obj);
if (blnRespuesta)
idasesor = obj.idasesor;
else
idasesor = null;
return blnRespuesta;
}
开发者ID:cartoneria,项目名称:Cotizar,代码行数:17,代码来源:CotizarService.cs
示例14: RecuperarFiltrado
public IEnumerable<Dto.Funcionalidad> RecuperarFiltrado(Dto.Funcionalidad obj)
{
IEnumerable<Dto.Funcionalidad> lstResultado = new Data.DFuncionalidad().RecuperarFiltrados(obj).ToList();
foreach (var item in lstResultado)
{
item.acciones = this.RecuperarAccionesFuncionalidad(item);
}
return lstResultado;
}
开发者ID:cartoneria,项目名称:Cotizar,代码行数:11,代码来源:BFuncionalidad.cs
示例15: ValidaNombre
/// <summary>
///
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public bool ValidaNombre(Dto.ItemLista obj)
{
Dto.ItemLista objExiste = new Data.DItemsLista().RecuperarFiltrados(obj).FirstOrDefault();
if (objExiste != null)
{
return false;
}
else
{
return true;
}
}
开发者ID:cartoneria,项目名称:Cotizar,代码行数:17,代码来源:BItemsLista.cs
示例16: Create
public static ObjectAccessPoint Create(Dto.ObjectAccessPoint item)
{
return new ObjectAccessPoint
{
AccessPointGuid = item.AccessPointGuid.ToUUID(),
ObjectGuid = item.ObjectGuid.ToUUID(),
StartDate = item.StartDate,
EndDate = item.EndDate,
DateCreated = item.DateCreated,
DateModified = item.DateModified
};
}
开发者ID:CHAOS-Community,项目名称:CHAOS.Portal.MCM,代码行数:12,代码来源:ObjectAccessPoint.cs
示例17: Create
public static Metadata Create(Dto.Metadata item)
{
return new Metadata
{
Guid = item.Guid.ToUUID(),
EditingUserGuid = item.EditingUserGuid.ToUUID(),
LanguageCode = item.LanguageCode,
MetadataSchemaGuid = item.MetadataSchemaGuid.ToUUID(),
MetadataXml = item.MetadataXml,
DateCreated = item.DateCreated
};
}
开发者ID:CHAOS-Community,项目名称:CHAOS.Portal.MCM,代码行数:12,代码来源:Metadata.cs
示例18: ValidaCodigo
/// <summary>
///
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public bool ValidaCodigo(Dto.Asesor obj)
{
Dto.Asesor objExiste = new Data.DAsesor().RecuperarFiltrados(obj).FirstOrDefault();
if (objExiste != null)
{
return false;
}
else
{
return true;
}
}
开发者ID:cartoneria,项目名称:Cotizar,代码行数:17,代码来源:BAsesor.cs
示例19: RecuperarFuncionalidadesHijas
private void RecuperarFuncionalidadesHijas(Dto.Funcionalidad obj, IEnumerable<Dto.Funcionalidad> Funcionalidades)
{
IEnumerable<Dto.Funcionalidad> lstFuncionalidadesHijas = Funcionalidades.Where(ee => ee.idpadre == obj.idfuncionalidad).ToList();
if (lstFuncionalidadesHijas.Count() > 0)
{
foreach (Dto.Funcionalidad item in lstFuncionalidadesHijas)
{
this.RecuperarFuncionalidadesHijas(item, Funcionalidades);
}
}
obj.funcionalidades = lstFuncionalidadesHijas;
}
开发者ID:cartoneria,项目名称:Cotizar,代码行数:13,代码来源:BFuncionalidad.cs
示例20: Create
public static Object Create(Dto.Object obj)
{
return new Object
{
Guid = obj.Guid.ToUUID(),
ObjectTypeId = obj.ObjectTypeID,
DateCreated = obj.DateCreated,
Metadatas = obj.Metadatas.Select(item => Metadata.Create(item)).ToList(),
ObjectRelations = obj.ObjectRelationInfos.Select(item => ObjectRelation.Create(item)).ToList(),
Files = obj.Files.Select(item => FileInfo.Create(item)).ToList(),
AccessPoints = obj.AccessPoints.Select(item => ObjectAccessPoint.Create(item)).ToList()
};
}
开发者ID:CHAOS-Community,项目名称:CHAOS.Portal.MCM,代码行数:13,代码来源:Object.cs
注:本文中的Dto类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论