本文整理汇总了C#中OperationType类的典型用法代码示例。如果您正苦于以下问题:C# OperationType类的具体用法?C# OperationType怎么用?C# OperationType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OperationType类属于命名空间,在下文中一共展示了OperationType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
public void Add(List<XObject> objects, bool checkUploadFile = false)
{
if (objects == null)
throw new ArgumentNullException("objects", "Can not be null.");
if (objects.Count == 0)
return;
CurrentOperationType = OperationType.Add;
var data = new { objects };
var arrList = ExecuteTemplate<ArrayList>(EndPoint.object_array, XHttpMethod.POST, data);
// Parse arrayList. Item of array can contains id object or error
var errors = new Dictionary<int, object>();
int i = 0;
foreach (var obj in objects){
int id = -1;
if (arrList[i] is string && int.TryParse(arrList[i] as string, out id)){
obj.Id = id;
if (checkUploadFile)
CheckNeedUploadFiles(obj);
}
else
errors.Add(i, arrList[i]);
i++;
}
if (errors.Count > 0){
var concatErrors = new StringBuilder();
foreach (var error in errors)
if (error.Value is ArrayList && (error.Value as ArrayList).Count > 0 && arrList.Count > error.Key)
concatErrors.AppendLine("Index object: " + error.Key + ". Error: " + (arrList[error.Key] as ArrayList)[0] + "; ");
throw new FxServerException("FlexiDB server error." + concatErrors);
}
}
示例2: Operation
public Operation(OperationType type, int fileNumber, int start, int length)
{
Type = type;
FileNumber = fileNumber;
Start = start;
Length = length;
}
示例3: SetAuditTrail
public void SetAuditTrail(string un, OperationType op, string cat, string msg)
{
UserName = un;
Operation = op;
Category = cat;
Message = msg;
}
示例4: AddAfter
public virtual void AddAfter(IQueryPart part, OperationType operation)
{
var first = Parts.LastOrDefault(p => p.OperationType == operation);
var index = Parts.IndexOf(first) + 1;
Parts.Insert(index, part);
}
示例5: Token
public Token(Regex match, TokenType tokenType, OperationType operationType = OperationType.Operator, TokenDiscardPolicy discardPolicy = TokenDiscardPolicy.Keep)
{
m_TokenType = tokenType;
m_DiscardPolicy = discardPolicy;
m_OperationType = operationType;
m_Regex = match;
}
示例6: SyncOperationHistroy
/// <summary>
/// 同步计划的运营历史操作
/// </summary>
/// <param name="StartDate">开始时间</param>
/// <param name="planHistoryID">计划明细ID</param>
/// <param name="tag">标志</param>
/// <param name="dbContext">域上下文</param>
public static void SyncOperationHistroy(FleetEntities dbContext, Guid planHistoryID, OperationType tag)
{
//当前计划历史
var currentPlanHisotry = dbContext.PlanHistories.FirstOrDefault(p => p.PlanHistoryID == planHistoryID);
if (currentPlanHisotry == null || currentPlanHisotry.ApprovalHistoryID == null) return;
//运行日期
DateTime? StartDate = GetOperationDateByApprovalHistory(currentPlanHisotry.ApprovalHistoryID, dbContext);
if (StartDate == null) return;
//当前有效的年度
var currentOpenAnnual = (from t in dbContext.Plans.Include("Annuals")
from r in dbContext.PlanHistories
where
t.PlanID == r.PlanID &&
r.PlanHistoryID == currentPlanHisotry.PlanHistoryID
select t.Annual).FirstOrDefault();
if (currentOpenAnnual == null) return;
switch (tag)
{
case OperationType.OperationLastYearPlan:
SynOperationLastYearPlan(dbContext, currentPlanHisotry, (DateTime)StartDate, currentOpenAnnual);
break;
case OperationType.OperationNextYearPlan:
SynOperationNextYearPlan(dbContext, currentPlanHisotry, currentOpenAnnual);
break;
default:
break;
}
}
示例7: TextChangedEventArgs
public TextChangedEventArgs(OperationType operation, int start, int length, string text)
{
_operation = operation;
_start = start;
_length = length;
_text = text;
}
示例8: QueryPart
public QueryPart(OperationType operation, Type entityType, string id)
{
OperationType = operation;
ID = id ?? operation.ToString();
EntityType = entityType;
_parts = new Lazy<List<IQueryPart>>(() => new List<IQueryPart>());
}
示例9: GetLogOrderEntity
public static LogOrder GetLogOrderEntity(OrderTask orderTask,OperationType operationType,string objectId)
{
LogOrder logEntity = new LogOrder();
string hostname = Dns.GetHostName();
IPHostEntry localhost = Dns.GetHostEntry(hostname);
IPAddress localaddr = localhost.AddressList[0];
logEntity.IP = localaddr.ToString();
logEntity.UserId = ConsoleClient.Instance.User.UserId;
logEntity.UserName = ConsoleClient.Instance.User.UserName;
logEntity.Event = objectId;// "ExecuteOrder";
logEntity.ExchangeCode = orderTask.ExchangeCode;
logEntity.OperationType = operationType;
logEntity.OrderId = orderTask.OrderId;
logEntity.OrderCode = orderTask.Code;
logEntity.AccountCode = orderTask.AccountCode;
logEntity.InstrumentCode = orderTask.InstrumentCode;
logEntity.IsBuy = orderTask.IsBuy == BuySell.Buy;
logEntity.IsOpen = orderTask.IsOpen == OpenClose.Open;
logEntity.Lot = orderTask.Lot.Value;
logEntity.SetPrice = orderTask.SetPrice;
logEntity.OrderType = orderTask.OrderType;
logEntity.OrderRelation = null;
logEntity.TransactionCode = orderTask.Transaction.Code;
return logEntity;
}
示例10: Token
public Token(TokenType type, OperationType operationType, string value, TokenPosition position)
{
OperationType = operationType;
Type = type;
Value = value;
Position = position;
}
示例11: EnqueueMessage
public NetSendResult EnqueueMessage(OperationType opType, PacketPayload payload, DeliveryMethod method, bool encrypt, byte channel, int connectionId)
{
outgoingMessageQueue.syncRoot.EnterWriteLock();
try
{
//This is similar to how Photon works on the Unity client.
//They enqueue actions
outgoingMessageQueue.Enqueue(() =>
{
INetworkMessageRouterService sender = sendServiceStrategy.GetRouterService(connectionId);
sender.TrySendMessage(opType, payload, method, encrypt, channel);
});
//signal any handlers that a message is in the queue
//it is important to do this in a lock. Reset could be called after Set
//in the other thread and we'd end up with potential unhandled messages in that race condition
outgoingMessageQueue.QueueSemaphore.Set();
}
finally
{
outgoingMessageQueue.syncRoot.ExitWriteLock();
}
return NetSendResult.Queued;
}
示例12: Calculate
public IVariable Calculate(IMilpManager milpManager, OperationType type, params IVariable[] arguments)
{
if (!SupportsOperation(type, arguments)) throw new NotSupportedException(SolverUtilities.FormatUnsupportedMessage(type, arguments));
if (arguments.All(a => a.IsConstant()))
{
var constantResult = (int) arguments[0].ConstantValue.Value%(int) arguments[1].ConstantValue.Value;
return milpManager.FromConstant((int)constantResult);
}
IVariable numerator = arguments[0];
IVariable denominator = arguments[1];
var one = milpManager.FromConstant(1);
var any = milpManager.CreateAnonymous(Domain.PositiveOrZeroInteger);
any.Operation(OperationType.Multiplication, denominator).Set(ConstraintType.LessOrEqual, numerator);
any.Operation(OperationType.Addition, one)
.Operation(OperationType.Multiplication, denominator)
.Set(ConstraintType.GreaterOrEqual, numerator.Operation(OperationType.Addition, one));
IVariable result = milpManager.CreateAnonymous(Domain.PositiveOrZeroInteger);
result.Set(ConstraintType.LessOrEqual, denominator);
result.Set(ConstraintType.Equal,
numerator.Operation(OperationType.Subtraction,
denominator.Operation(OperationType.Multiplication, any)));
result.ConstantValue = numerator.ConstantValue%denominator.ConstantValue;
result.Expression = $"{numerator.FullExpression()} % {denominator.FullExpression()}";
return result;
}
示例13: GceOperation
public GceOperation(OperationType operationType, string projectId, string zoneName, string name)
{
OperationType = operationType;
ProjectId = projectId;
ZoneName = zoneName;
Name = name;
}
示例14: TokenRule
public TokenRule( OperationType op, Symbol tokenID, string symbol )
{
this.operation = op;
this.tokenID = tokenID;
this.symbol = symbol;
this.errorID = 0;
}
示例15: DesktopChangeEventArgs
public DesktopChangeEventArgs(int x1, int y1, int x2, int y2, OperationType type) {
this.x = x1;
this.y = y1;
this.w = x2 - x1;
this.h = y2 - y1;
this.type = type;
}