本文整理汇总了C#中Models.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Models.ToString方法的具体用法?C# Models.ToString怎么用?C# Models.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Models
的用法示例。
在下文中一共展示了Models.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
/// <summary>
/// createtime expiresetime不用传。
/// </summary>
/// <param name="PubConn"></param>
/// <param name="model"></param>
/// <param name="tokentype"></param>
/// <returns></returns>
public virtual bool Add(DbConn PubConn, DbModels.tb_token model, Models.DbModels.TokenType tokentype)
{
DateTime nowtime = PubConn.GetServerDate();
model.createtime = nowtime;
model.expires = nowtime.AddMinutes(GetExpiresminutes(tokentype));
List<ProcedureParameter> Par = new List<ProcedureParameter>()
{
//
new ProcedureParameter("@token", model.token),
//
new ProcedureParameter("@userid", model.userid),
new ProcedureParameter("@id", model.id),
//
new ProcedureParameter("@username", model.username),
//
new ProcedureParameter("@appid", model.appid),
//
new ProcedureParameter("@createtime", model.createtime),
//
new ProcedureParameter("@expires", model.expires )
};
int rev = PubConn.ExecuteSql("insert into " + tokentype.ToString() + " (token,userid,id,username,appid,createtime,expires)" +
" values(@token,@userid,@id,@username,@appid,@createtime,@expires)", Par);
return rev == 1;
}
示例2: Calculate
public override int Calculate(Models.BetOrder order)
{
if (!order.Num.IsPL2())
throw new ApplicationException(string.Format("num:{0} not a pl2 number", order.Num));
int companyBId;
if (!int.TryParse(order.Ext1, out companyBId))
throw new ApplicationException(string.Format("A&BPL2的B公司Id为空或不符合规格," + order.ToString()));
return GetMultiple(order.Num, order.CompanyId, companyBId);
}
示例3: SetEventFrequencyAsync
public async Task<bool> SetEventFrequencyAsync(Models.Accounts.NotificationFrequency frequency)
{
using (var dclient = this.CreateClient())
{
var client = dclient.Client;
var url = ApiUrls.AccountEventFrequencyUrl.Replace("{frequency}", frequency.ToString());
var response = await client.PutAsync(this.GetUri(url), null).ConfigureAwait(false);
return await this.HandleResponseAsync(response).ConfigureAwait(false);
}
}
示例4: Remove
public async Task Remove(Models.ColorInfo color)
{
if (color == null)
return;
_favorites = _favorites ?? await GetColorsAsync();
_favorites.RemoveAll(x => x.ToString().Equals(color.ToString()));
// save changes
await _fileService.WriteColors(CACHEKEY, _favorites);
if (FavoritesChanged != null)
FavoritesChanged.Invoke();
}
示例5: deletetoken
public JsonResult deletetoken(string id, Models.DbModels.TokenType tokentype)
{
using (XXF.Db.DbConn PubConn = XXF.Db.DbConfig.CreateConn())
{
PubConn.Open();
bool r = Models.TokenDal.Instance.Delete(PubConn, id, tokentype);
Models.DbModels.certcenterlog log = new Models.DbModels.certcenterlog(this);
log.opecontent = "删除token。tokentype="+tokentype.ToString()+" result="+r;
Models.CertCenterLogDal.Instance.Add(PubConn, log);
if (r)
{
return Json(new { code = 1 });
}
else
{
return Json(new { code = -905, msg = "删除失败,token不存在或存已被删除。" });
}
}
}
示例6: ValidateAzureVMBackupManagementType
private void ValidateAzureVMBackupManagementType(Models.BackupManagementType backupManagementType)
{
if (backupManagementType != Models.BackupManagementType.AzureVM)
{
throw new ArgumentException(string.Format(Resources.UnExpectedBackupManagementTypeException,
Models.BackupManagementType.AzureVM.ToString(),
backupManagementType.ToString()));
}
}
示例7: GetName
public static string GetName(Models.OrderStatus orderStatus)
{
DisplayAttribute[] attributes = (DisplayAttribute[])orderStatus.GetType().GetField(orderStatus.ToString()).GetCustomAttributes(typeof(DisplayAttribute), false);
return attributes.Length > 0 ? attributes[0].Name : string.Empty;
}
示例8: GetCategories
private async Task<Models.UI.Category> GetCategories(Models.UI.Category result)
{
var error = string.Empty;
try
{
LoadingCounter++;
var isCached = await _storageService.Exists(Constants.CATEGORIES, new TimeSpan(10, 0, 0, 0));
if (isCached)
{
result = JsonConvert.DeserializeObject<Models.UI.Category>(await _storageService.ReadData(Constants.CATEGORIES));
}
else
{
result = await Broker.GetCategories();
_storageService.Save(Constants.CATEGORIES, result.ToString());
}
AppBase.Current.LoadedCategories = result;
LoadingCounter--;
}
catch (Exception ex)
{
error = string.Format(International.Translation.ErrorGetting, "categories", ex.Message);
LoadingCounter--;
}
if (!string.IsNullOrEmpty(error))
{
await _uxService.ShowAlert(error);
}
return result;
}
示例9: FormatLegend
/// <summary>
/// Format the legend.
/// </summary>
/// <param name="legendPositionType">Position of the legend</param>
public void FormatLegend(Models.Graph.Graph.LegendPositionType legendPositionType)
{
LegendPosition oxyLegendPosition;
if (Enum.TryParse<LegendPosition>(legendPositionType.ToString(), out oxyLegendPosition))
{
this.plot1.Model.LegendFont = Font;
this.plot1.Model.LegendFontSize = FontSize;
this.plot1.Model.LegendPosition = oxyLegendPosition;
}
//this.plot1.Model.LegendSymbolLength = 60;
}
示例10: DrawBar
public void DrawBar(
string title,
IEnumerable x,
IEnumerable y,
Models.Graph.Axis.AxisType xAxisType,
Models.Graph.Axis.AxisType yAxisType,
Color colour,
bool showOnLegend)
{
ColumnXYSeries series = new ColumnXYSeries();
if (showOnLegend)
series.Title = title;
series.FillColor = ConverterExtensions.ToOxyColor(colour);
series.StrokeColor = ConverterExtensions.ToOxyColor(colour);
series.ItemsSource = this.PopulateDataPointSeries(x, y, xAxisType, yAxisType);
series.XAxisKey = xAxisType.ToString();
series.YAxisKey = yAxisType.ToString();
this.plot1.Model.Series.Add(series);
}
示例11: DrawLineAndMarkers
public void DrawLineAndMarkers(
string title,
IEnumerable x,
IEnumerable y,
Models.Graph.Axis.AxisType xAxisType,
Models.Graph.Axis.AxisType yAxisType,
Color colour,
Models.Graph.LineType lineType,
Models.Graph.MarkerType markerType,
Models.Graph.LineThicknessType lineThickness,
Models.Graph.MarkerSizeType markerSize,
bool showOnLegend)
{
if (x != null && y != null)
{
Utility.LineSeriesWithTracker series = new Utility.LineSeriesWithTracker();
series.OnHoverOverPoint += OnHoverOverPoint;
if (showOnLegend)
series.Title = title;
else
series.ToolTip = title;
series.Color = OxyColor.FromArgb(colour.A, colour.R, colour.G, colour.B);
series.ItemsSource = this.PopulateDataPointSeries(x, y, xAxisType, yAxisType);
series.XAxisKey = xAxisType.ToString();
series.YAxisKey = yAxisType.ToString();
series.CanTrackerInterpolatePoints = false;
bool filled = false;
string oxyMarkerName = markerType.ToString();
if (oxyMarkerName.StartsWith("Filled"))
{
oxyMarkerName = oxyMarkerName.Remove(0, 6);
filled = true;
}
// Line type.
LineStyle oxyLineType;
if (Enum.TryParse<LineStyle>(lineType.ToString(), out oxyLineType))
{
series.LineStyle = oxyLineType;
if (series.LineStyle == LineStyle.None)
series.Color = OxyColors.Transparent;
}
// Line thickness
if (lineThickness == LineThicknessType.Thin)
series.StrokeThickness = 0.5;
// Marker type.
OxyPlot.MarkerType type;
if (Enum.TryParse<OxyPlot.MarkerType>(oxyMarkerName, out type))
{
series.MarkerType = type;
}
if (markerSize == MarkerSizeType.Normal)
series.MarkerSize = 7.0;
else
series.MarkerSize = 5.0;
series.MarkerStroke = OxyColor.FromArgb(colour.A, colour.R, colour.G, colour.B);
if (filled)
{
series.MarkerFill = OxyColor.FromArgb(colour.A, colour.R, colour.G, colour.B);
series.MarkerStroke = OxyColors.White;
}
this.plot1.Model.Series.Add(series);
}
}
示例12: DrawBar
public void DrawBar(
string title,
IEnumerable x,
IEnumerable y,
Models.Graph.Axis.AxisType xAxisType,
Models.Graph.Axis.AxisType yAxisType,
Color colour,
bool showOnLegend)
{
if (x != null && y != null)
{
ColumnXYSeries series = new ColumnXYSeries();
if (showOnLegend)
series.Title = title;
series.FillColor = OxyColor.FromArgb(colour.A, colour.R, colour.G, colour.B);
series.StrokeColor = OxyColor.FromArgb(colour.A, colour.R, colour.G, colour.B);
series.ItemsSource = this.PopulateDataPointSeries(x, y, xAxisType, yAxisType);
series.XAxisKey = xAxisType.ToString();
series.YAxisKey = yAxisType.ToString();
this.plot1.Model.Series.Add(series);
}
}
示例13: FormatLegend
/// <summary>
/// Format the legend.
/// </summary>
/// <param name="legendPositionType">Position of the legend</param>
public void FormatLegend(Models.Graph.Graph.LegendPositionType legendPositionType)
{
LegendPosition oxyLegendPosition;
if (Enum.TryParse<LegendPosition>(legendPositionType.ToString(), out oxyLegendPosition))
{
foreach (PlotView p in plots)
{
p.Model.LegendFont = Font;
p.Model.LegendFontSize = FontSize;
p.Model.LegendPosition = oxyLegendPosition;
p.Model.LegendSymbolLength = 30;
}
}
}
示例14: GetResources
public static List<Models.Resource> GetResources(Models.ResourceType type, string tag, string cultureName)
{
string typeName = type.ToString();
using (var ctx = new AssessmentEntities())
{
var query =
from resource in ctx.Resource
join rt in ctx.ResourceType on resource.ResourceTypeId equals rt.Id into rt1
from resourceType in rt1.DefaultIfEmpty()
join rv in ctx.ResourceValue on resource.Id equals rv.ResourceId into rv1
from resourceValue in rv1.Where(rv => rv.CultureName == cultureName).DefaultIfEmpty()
where resourceType.Name == typeName && resource.Tag == tag && !resource.Deleted
select new Models.Resource()
{
Id = resource.Id,
Name = resource.Name,
Value = resourceValue.Value ?? resource.DefaultValue,
Type = type,
TypeName = resource.ResourceType != null ? resource.ResourceType.Name : string.Empty,
Tag = resource.Tag,
CultureName = resourceValue.CultureName
};
return query.ToList();
}
}
示例15: DisplayTransactionPopup
private void DisplayTransactionPopup(Models.TransactionType type)
{
double width = pageRoot.ActualWidth;
((Grid)AddTransactionPopup.Child).Height = Window.Current.Bounds.Height;
AddTransactionPopup.HorizontalOffset = Window.Current.Bounds.Width - AddTransactionPopup.ActualWidth;
foreach (ListItem item in (List<ListItem>)DefaultViewModel["TransactionTypes"])
{
if (item.Label.Equals(type.ToString()))
{
TransactionType.SelectedItem = item;
}
}
if (((List<ListItem>)DefaultViewModel["Accounts"]).Count == 0)
{
List<Account> accounts = (new ViewModel<Account>()).FetchAll();
List<ListItem> items = new List<ListItem>(accounts.Count);
foreach (Account account in accounts)
{
items.Add(new ListItem(account.Name, account.Id.ToString()));
}
DefaultViewModel["Accounts"] = items;
}
AddTransactionPopup.IsOpen = true;
}