void StartSortie(ApiInfo rpInfo) { r_ReturnReason = null; var rSortie = SortieInfo.Current; var rMap = rSortie.Map; using (var rCommand = Connection.CreateCommand()) { rCommand.CommandText = "INSERT OR IGNORE INTO sortie_map(id, is_event_map) VALUES(@map_id, @is_event_map);" + "INSERT INTO sortie(id, map, difficulty, map_hp) VALUES(@sortie_id, @map_id, @difficulty, @map_hp);"; rCommand.Parameters.AddWithValue("@map_id", rMap.ID); rCommand.Parameters.AddWithValue("@sortie_id", rSortie.ID); rCommand.Parameters.AddWithValue("@is_event_map", rMap.IsEventMap); rCommand.Parameters.AddWithValue("@difficulty", rMap.Difficulty); rCommand.Parameters.AddWithValue("@map_hp", rMap.HasGauge ? rMap.HP.Current : (int?)null); if (rMap.HasGauge) { rCommand.CommandText += "INSERT OR IGNORE INTO sortie_map_hp(id, difficulty, hp) VALUES(@map_id, coalesce(@difficulty, 0), @map_max_hp);"; rCommand.Parameters.AddWithValue("@map_max_hp", rMap.HP.Maximum); } rCommand.ExecuteNonQuery(); } InsertExplorationRecord(rSortie); }
void InsertExplorationRecord(SortieInfo rpSortie) { var rNode = rpSortie.Node; if (rNode.IsDeadEnd) { r_ReturnReason = ReturnReason.DeadEnd; } var rCommand = Connection.CreateCommand(); rCommand.CommandText = "INSERT OR IGNORE INTO sortie_node(map, id, type, subtype) VALUES(@map, @node_id, @type, @subtype);" + "INSERT INTO sortie_detail(id, step, node, extra_info) VALUES(@id, (SELECT ifnull(max(step), 0) + 1 FROM sortie_detail WHERE id = @id), @node_id, @extra_info);"; rCommand.Parameters.AddWithValue("@map", rpSortie.Map.ID); rCommand.Parameters.AddWithValue("@node_id", rNode.ID); rCommand.Parameters.AddWithValue("@type", (int)rNode.EventType); rCommand.Parameters.AddWithValue("@subtype", rNode.EventSubType); rCommand.Parameters.AddWithValue("@id", rpSortie.ID); rCommand.Parameters.AddWithValue("@extra_info", (rNode.Event as IExtraInfo)?.GetExtraInfo()); if (!rpSortie.Map.IsCleared && rNode.EventType == SortieEventType.EscortSuccess) { var rHP = rpSortie.Map.HP.Current; rCommand.CommandText += "UPDATE sortie SET map_hp = @map_hp WHERE id = @id;"; rCommand.Parameters.AddWithValue("@map_hp", rHP > 0 ? (int?)rHP : null); } rCommand.PostToTransactionQueue(); }
/// <summary> /// Initializes a new instance of the <see cref="MerchantReturnRequest" /> class. /// </summary> /// <param name="merchantOrderNo">The unique order reference used by the Merchant (sku). (required).</param> /// <param name="merchantReturnNo">The unique return reference used by the Merchant (sku). (required).</param> /// <param name="lines">lines (required).</param> /// <param name="id">The unique return reference used by ChannelEngine..</param> /// <param name="reason">reason.</param> /// <param name="customerComment">Optional. Comment of customer on the (reason of) the return..</param> /// <param name="merchantComment">Optional. Comment of merchant on the return..</param> /// <param name="refundInclVat">Refund amount incl. VAT..</param> /// <param name="refundExclVat">Refund amount excl. VAT..</param> /// <param name="returnDate">The date at which the return was originally created in the source system (if available)..</param> public MerchantReturnRequest(string merchantOrderNo = default(string), string merchantReturnNo = default(string), List <MerchantReturnLineRequest> lines = default(List <MerchantReturnLineRequest>), int id = default(int), ReturnReason?reason = default(ReturnReason?), string customerComment = default(string), string merchantComment = default(string), decimal refundInclVat = default(decimal), decimal refundExclVat = default(decimal), DateTime?returnDate = default(DateTime?)) { // to ensure "merchantOrderNo" is required (not null) if (merchantOrderNo == null) { throw new ArgumentNullException("merchantOrderNo is a required property for MerchantReturnRequest and cannot be null"); } this.MerchantOrderNo = merchantOrderNo; // to ensure "merchantReturnNo" is required (not null) if (merchantReturnNo == null) { throw new ArgumentNullException("merchantReturnNo is a required property for MerchantReturnRequest and cannot be null"); } this.MerchantReturnNo = merchantReturnNo; // to ensure "lines" is required (not null) if (lines == null) { throw new ArgumentNullException("lines is a required property for MerchantReturnRequest and cannot be null"); } this.Lines = lines; this.Id = id; this.Reason = reason; this.CustomerComment = customerComment; this.MerchantComment = merchantComment; this.RefundInclVat = refundInclVat; this.RefundExclVat = refundExclVat; this.ReturnDate = returnDate; }
/// <summary> /// Initializes a new instance of the <see cref="MerchantSingleOrderReturnResponse" /> class. /// </summary> /// <param name="merchantOrderNo">The unique order reference used by the Merchant..</param> /// <param name="lines">lines.</param> /// <param name="createdAt">The date at which the return was created in ChannelEngine..</param> /// <param name="updatedAt">The date at which the return was last modified in ChannelEngine..</param> /// <param name="merchantReturnNo">The unique return reference used by the Merchant, will be empty in case of a channel or unacknowledged return..</param> /// <param name="channelReturnNo">The unique return reference used by the Channel, will be empty in case of a merchant return..</param> /// <param name="channelId">The id of the channel..</param> /// <param name="globalChannelId">The id of the Global Channel..</param> /// <param name="globalChannelName">The name of the Global Channel..</param> /// <param name="status">status.</param> /// <param name="id">The unique return reference used by ChannelEngine..</param> /// <param name="reason">reason.</param> /// <param name="customerComment">Optional. Comment of customer on the (reason of) the return..</param> /// <param name="merchantComment">Optional. Comment of merchant on the return..</param> /// <param name="refundInclVat">Refund amount incl. VAT..</param> /// <param name="refundExclVat">Refund amount excl. VAT..</param> /// <param name="returnDate">The date at which the return was originally created in the source system (if available)..</param> public MerchantSingleOrderReturnResponse(string merchantOrderNo = default(string), List <MerchantSingleOrderReturnLineResponse> lines = default(List <MerchantSingleOrderReturnLineResponse>), DateTime createdAt = default(DateTime), DateTime updatedAt = default(DateTime), string merchantReturnNo = default(string), string channelReturnNo = default(string), int?channelId = default(int?), int?globalChannelId = default(int?), string globalChannelName = default(string), ReturnStatus?status = default(ReturnStatus?), int id = default(int), ReturnReason?reason = default(ReturnReason?), string customerComment = default(string), string merchantComment = default(string), decimal refundInclVat = default(decimal), decimal refundExclVat = default(decimal), DateTime?returnDate = default(DateTime?)) { this.MerchantOrderNo = merchantOrderNo; this.Lines = lines; this.CreatedAt = createdAt; this.UpdatedAt = updatedAt; this.MerchantReturnNo = merchantReturnNo; this.ChannelReturnNo = channelReturnNo; this.ChannelId = channelId; this.GlobalChannelId = globalChannelId; this.GlobalChannelName = globalChannelName; this.Status = status; this.Id = id; this.Reason = reason; this.CustomerComment = customerComment; this.MerchantComment = merchantComment; this.RefundInclVat = refundInclVat; this.RefundExclVat = refundExclVat; this.ReturnDate = returnDate; }
void OnReturnedFromSortie(SortieInfo rpSortie) { if (!r_ReturnReason.HasValue) { IEnumerable <Ship> rShips = rpSortie.Fleet.Ships; if (rpSortie.EscortFleet != null) { rShips = rShips.Concat(rpSortie.EscortFleet.Ships); } r_ReturnReason = rShips.Any(rpShip => (rpShip.State & ShipState.HeavilyDamaged) != 0) ? ReturnReason.RetreatWithHeavilyDamagedShip : ReturnReason.Retreat; } using (var rTransaction = Connection.BeginTransaction()) { InsertReturnReason(r_ReturnReason.Value); SetReturnTime(rpSortie.ReturnTime); rTransaction.Commit(); } }
void OnReturnedFromSortie(SortieInfo rpSortie) { if (!r_ReturnReason.HasValue) { IEnumerable<Ship> rShips = rpSortie.Fleet.Ships; if (rpSortie.EscortFleet != null) rShips = rShips.Concat(rpSortie.EscortFleet.Ships); r_ReturnReason = rShips.Any(rpShip => (rpShip.State & ShipState.HeavilyDamaged) != 0) ? ReturnReason.RetreatWithHeavilyDamagedShip : ReturnReason.Retreat; } using (var rTransaction = Connection.BeginTransaction()) { InsertReturnReason(r_ReturnReason.Value); SetReturnTime(rpSortie.ReturnTime); rTransaction.Commit(); } }
void InsertExplorationRecord(SortieInfo rpSortie) { var rNode = rpSortie.Node; if (rNode.IsDeadEnd) r_ReturnReason = ReturnReason.DeadEnd; var rCommand = Connection.CreateCommand(); rCommand.CommandText = "INSERT OR IGNORE INTO sortie_node(map, id, type, subtype) VALUES(@map, @node_id, @type, @subtype);" + "INSERT INTO sortie_detail(id, step, node, extra_info) VALUES(@id, (SELECT ifnull(max(step), 0) + 1 FROM sortie_detail WHERE id = @id), @node_id, @extra_info);"; rCommand.Parameters.AddWithValue("@map", rpSortie.Map.ID); rCommand.Parameters.AddWithValue("@node_id", rNode.ID); rCommand.Parameters.AddWithValue("@type", (int)rNode.EventType); rCommand.Parameters.AddWithValue("@subtype", rNode.EventSubType); rCommand.Parameters.AddWithValue("@id", rpSortie.ID); rCommand.Parameters.AddWithValue("@extra_info", (rNode.Event as IExtraInfo)?.GetExtraInfo()); if (!rpSortie.Map.IsCleared && rNode.EventType == SortieEventType.EscortSuccess) { var rHP = rpSortie.Map.HP.Current; rCommand.CommandText += "UPDATE sortie SET map_hp = @map_hp WHERE id = @id;"; rCommand.Parameters.AddWithValue("@map_hp", rHP > 0 ? (int?)rHP : null); } rCommand.PostToTransactionQueue(); }