本文整理汇总了C#中Dto类的典型用法代码示例。如果您正苦于以下问题:C# Dto类的具体用法?C# Dto怎么用?C# Dto使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Dto类属于命名空间,在下文中一共展示了Dto类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例3: 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;
}
示例4: 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);
}
}
示例5: 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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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"));
}
}
示例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;
}
示例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;
}
示例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;
}
}