private void changToMainForm(String token) { TransferInfo info = new TransferInfo(); info.token = token; info.username = tx_username.Text; Thread newForm = new Thread(new ParameterizedThreadStart(activeForm)); newForm.SetApartmentState(ApartmentState.STA); newForm.IsBackground = false; newForm.Start(info); this.recovery(); this.Dispose(true); }
public GoodsTransferSeller() { ShortInfo = new DocumentShortInfo { Name = "Товарная накладная" }; GoodsTransferInfo = new TransferInfo() { Description = "Перечисленные в документе ценности переданы" }; }
public TransferOutRequested(Guid processId, TransferInfo transferInfo) : base(processId, transferInfo) { }
public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull) { base.PrepareFrame(elapsedTime, updateFull); if (updateFull) { CurrentTime.Text = FormatStrings.FormatTime(Owner.Viewer.Simulator.ClockTime); Activity act = Owner.Viewer.Simulator.ActivityRun; Train playerTrain = Owner.Viewer.Simulator.PlayerLocomotive.Train; if (playerTrain.Delay.HasValue) { CurrentDelay.Text = Viewer.Catalog.GetPluralStringFmt("Current Delay: {0} minute", "Current Delay: {0} minutes", (long)playerTrain.Delay.Value.TotalMinutes); } else { CurrentDelay.Text = ""; } bool metric = Owner.Viewer.MilepostUnitsMetric; bool InfoAvail = false; ActivityTaskPassengerStopAt at = null; ActivityTaskPassengerStopAt Current = null; // timetable information if (playerTrain.CheckStations) { TTTrain playerTimetableTrain = playerTrain as TTTrain; // train name StationPlatform.Text = String.Concat(playerTimetableTrain.Name.Substring(0, Math.Min(playerTimetableTrain.Name.Length, 20))); if (playerTimetableTrain.ControlMode == Train.TRAIN_CONTROL.INACTIVE || playerTimetableTrain.MovementState == Simulation.AIs.AITrain.AI_MOVEMENT_STATE.AI_STATIC) { // no info available StationPreviousName.Text = ""; StationPreviousArriveScheduled.Text = ""; StationPreviousArriveActual.Text = ""; StationPreviousDepartScheduled.Text = ""; StationPreviousDepartActual.Text = ""; StationPreviousDistance.Text = ""; StationCurrentName.Text = ""; StationCurrentArriveScheduled.Text = ""; StationCurrentArriveActual.Text = ""; StationCurrentDepartScheduled.Text = ""; StationCurrentDistance.Text = ""; StationNextName.Text = ""; StationNextArriveScheduled.Text = ""; StationNextDepartScheduled.Text = ""; StationNextDistance.Text = ""; bool validMessage = false; if (playerTimetableTrain.NeedAttach != null && playerTimetableTrain.NeedAttach.ContainsKey(-1)) { List <int> attachTrains = playerTimetableTrain.NeedAttach[-1]; TTTrain otherTrain = playerTimetableTrain.GetOtherTTTrainByNumber(attachTrains[0]); if (otherTrain == null) { if (playerTimetableTrain.Simulator.AutoGenDictionary.ContainsKey(attachTrains[0])) { otherTrain = playerTimetableTrain.Simulator.AutoGenDictionary[attachTrains[0]] as TTTrain; } } if (otherTrain == null) { Message.Text = Viewer.Catalog.GetString("Waiting for train to attach"); Message.Color = Color.Orange; validMessage = true; } else { Message.Text = String.Concat(Viewer.Catalog.GetString("Waiting for train to attach : "), otherTrain.Name); Message.Color = Color.Orange; validMessage = true; } } if (!validMessage && playerTimetableTrain.NeedTrainTransfer.Count > 0) { foreach (TrackCircuitSection occSection in playerTimetableTrain.OccupiedTrack) { if (playerTimetableTrain.NeedTrainTransfer.ContainsKey(occSection.Index)) { Message.Text = Viewer.Catalog.GetString("Waiting for transfer"); Message.Color = Color.Orange; break; } } } if (!validMessage) { Message.Color = Color.White; if (playerTimetableTrain.ActivateTime.HasValue) { DateTime activateDT = new DateTime((long)(Math.Pow(10, 7) * playerTimetableTrain.ActivateTime.Value)); if (playerTimetableTrain.ControlMode == Train.TRAIN_CONTROL.INACTIVE) { Message.Text = Viewer.Catalog.GetString("Train inactive."); } else if (playerTimetableTrain.MovementState == Simulation.AIs.AITrain.AI_MOVEMENT_STATE.AI_STATIC) { Message.Text = Viewer.Catalog.GetString("Train static."); } else { Message.Text = Viewer.Catalog.GetString("Train not active."); } // set activation message or time if (playerTimetableTrain.TriggeredActivationRequired) { Message.Text = String.Concat(Message.Text, Viewer.Catalog.GetString(" Activated by other train.")); } else { Message.Text = String.Concat(Message.Text, Viewer.Catalog.GetString(" Activation time : "), activateDT.ToString("HH:mm:ss")); } } else { Message.Text = Viewer.Catalog.GetString("Train has terminated."); } } } else { // previous stop if (playerTimetableTrain.PreviousStop == null) { StationPreviousName.Text = ""; StationPreviousArriveScheduled.Text = ""; StationPreviousArriveActual.Text = ""; StationPreviousDepartScheduled.Text = ""; StationPreviousDepartActual.Text = ""; StationPreviousDistance.Text = ""; } else { StationPreviousName.Text = playerTimetableTrain.PreviousStop.PlatformItem.Name; StationPreviousArriveScheduled.Text = playerTimetableTrain.PreviousStop.arrivalDT.ToString("HH:mm:ss"); if (playerTimetableTrain.PreviousStop.ActualArrival >= 0) { DateTime actArrDT = new DateTime((long)(Math.Pow(10, 7) * playerTimetableTrain.PreviousStop.ActualArrival)); StationPreviousArriveActual.Text = actArrDT.ToString("HH:mm:ss"); StationPreviousArriveActual.Color = actArrDT < playerTimetableTrain.PreviousStop.arrivalDT ? Color.LightGreen : Color.LightSalmon; DateTime actDepDT = new DateTime((long)(Math.Pow(10, 7) * playerTimetableTrain.PreviousStop.ActualDepart)); StationPreviousDepartActual.Text = actDepDT.ToString("HH:mm:ss"); StationPreviousDepartActual.Color = actDepDT > playerTimetableTrain.PreviousStop.arrivalDT ? Color.LightGreen : Color.LightSalmon; } else { StationPreviousArriveActual.Text = Viewer.Catalog.GetString("(missed)"); StationPreviousArriveActual.Color = Color.LightSalmon; StationPreviousDepartActual.Text = ""; } StationPreviousDepartScheduled.Text = playerTimetableTrain.PreviousStop.departureDT.ToString("HH:mm:ss"); StationPreviousDistance.Text = ""; } if (playerTimetableTrain.StationStops == null || playerTimetableTrain.StationStops.Count == 0) { StationCurrentName.Text = ""; StationCurrentArriveScheduled.Text = ""; StationCurrentArriveActual.Text = ""; StationCurrentDepartScheduled.Text = ""; StationCurrentDistance.Text = ""; StationNextName.Text = ""; StationNextArriveScheduled.Text = ""; StationNextDepartScheduled.Text = ""; StationNextDistance.Text = ""; Message.Text = Viewer.Catalog.GetString("No more stations."); Message.Color = Color.White; } else { StationCurrentName.Text = playerTimetableTrain.StationStops[0].PlatformItem.Name; StationCurrentArriveScheduled.Text = playerTimetableTrain.StationStops[0].arrivalDT.ToString("HH:mm:ss"); if (playerTimetableTrain.StationStops[0].ActualArrival >= 0) { DateTime actArrDT = new DateTime((long)(Math.Pow(10, 7) * playerTimetableTrain.StationStops[0].ActualArrival)); StationCurrentArriveActual.Text = actArrDT.ToString("HH:mm:ss"); StationCurrentArriveActual.Color = actArrDT < playerTimetableTrain.StationStops[0].arrivalDT ? Color.LightGreen : Color.LightSalmon; } else { StationCurrentArriveActual.Text = ""; } StationCurrentDepartScheduled.Text = playerTimetableTrain.StationStops[0].departureDT.ToString("HH:mm:ss"); StationCurrentDistance.Text = FormatStrings.FormatDistanceDisplay(playerTimetableTrain.StationStops[0].DistanceToTrainM, metric); Message.Text = playerTimetableTrain.DisplayMessage; Message.Color = playerTimetableTrain.DisplayColor; if (playerTimetableTrain.StationStops.Count >= 2) { StationNextName.Text = playerTimetableTrain.StationStops[1].PlatformItem.Name; StationNextArriveScheduled.Text = playerTimetableTrain.StationStops[1].arrivalDT.ToString("HH:mm:ss"); StationNextDepartScheduled.Text = playerTimetableTrain.StationStops[1].departureDT.ToString("HH:mm:ss"); StationNextDistance.Text = ""; } else { StationNextName.Text = ""; StationNextArriveScheduled.Text = ""; StationNextDepartScheduled.Text = ""; StationNextDistance.Text = ""; } } // check transfer details bool transferValid = false; string TransferMessage = String.Empty; if (playerTimetableTrain.TransferStationDetails != null && playerTimetableTrain.TransferStationDetails.Count > 0 && playerTimetableTrain.StationStops != null && playerTimetableTrain.StationStops.Count > 0) { if (playerTimetableTrain.TransferStationDetails.ContainsKey(playerTimetableTrain.StationStops[0].PlatformReference)) { TransferInfo thisTransfer = playerTimetableTrain.TransferStationDetails[playerTimetableTrain.StationStops[0].PlatformReference]; TransferMessage = Viewer.Catalog.GetString("Transfer units at next station with train "); TransferMessage = String.Concat(TransferMessage, thisTransfer.TransferTrainName); transferValid = true; } } else if (playerTimetableTrain.TransferTrainDetails != null && playerTimetableTrain.TransferTrainDetails.Count > 0) { foreach (KeyValuePair <int, List <TransferInfo> > transferDetails in playerTimetableTrain.TransferTrainDetails) { TransferInfo thisTransfer = transferDetails.Value[0]; TransferMessage = Viewer.Catalog.GetString("Transfer units with train "); TransferMessage = String.Concat(TransferMessage, thisTransfer.TransferTrainName); transferValid = true; break; // only show first } } // attach details if (playerTimetableTrain.AttachDetails != null) { bool attachDetailsValid = false; // attach is not at station - details valid if (playerTimetableTrain.AttachDetails.StationPlatformReference < 0) { attachDetailsValid = true; } // no further stations - details valid if (playerTimetableTrain.StationStops == null || playerTimetableTrain.StationStops.Count <= 0) { attachDetailsValid = true; } // attach is at next station - details valid else if (playerTimetableTrain.AttachDetails.StationPlatformReference == playerTimetableTrain.StationStops[0].PlatformReference) { attachDetailsValid = true; } if (attachDetailsValid) { if (playerTimetableTrain.AttachDetails.Valid) { Message.Text = Viewer.Catalog.GetString("Train is to attach to : "); Message.Text = String.Concat(Message.Text, playerTimetableTrain.AttachDetails.AttachTrainName); Message.Color = Color.Orange; } else { Message.Text = Viewer.Catalog.GetString("Train is to attach to : "); Message.Text = String.Concat(Message.Text, playerTimetableTrain.AttachDetails.AttachTrainName); Message.Text = String.Concat(Message.Text, Viewer.Catalog.GetString(" ; other train not yet ready")); Message.Color = Color.Orange; } } } // general details else if (playerTimetableTrain.PickUpStaticOnForms) { Message.Text = Viewer.Catalog.GetString("Train is to pickup train at end of path"); Message.Color = Color.Orange; } else if (playerTimetableTrain.NeedPickUp) { Message.Text = Viewer.Catalog.GetString("Pick up train ahead"); Message.Color = Color.Orange; } else if (transferValid) { Message.Text = String.Copy(TransferMessage); Message.Color = Color.Orange; } else if (playerTimetableTrain.NeedTransfer) { Message.Text = Viewer.Catalog.GetString("Transfer units with train ahead"); Message.Color = Color.Orange; } } } // activity mode - switched train else if (!Owner.Viewer.Simulator.TimetableMode && playerTrain != Owner.Viewer.Simulator.OriginalPlayerTrain) { // train name StationPlatform.Text = String.Concat(playerTrain.Name.Substring(0, Math.Min(playerTrain.Name.Length, 20))); if (playerTrain.ControlMode == Train.TRAIN_CONTROL.INACTIVE) { // no info available StationPreviousName.Text = ""; StationPreviousArriveScheduled.Text = ""; StationPreviousArriveActual.Text = ""; StationPreviousDepartScheduled.Text = ""; StationPreviousDepartActual.Text = ""; StationPreviousDistance.Text = ""; StationCurrentName.Text = ""; StationCurrentArriveScheduled.Text = ""; StationCurrentArriveActual.Text = ""; StationCurrentDepartScheduled.Text = ""; StationCurrentDistance.Text = ""; StationNextName.Text = ""; StationNextArriveScheduled.Text = ""; StationNextDepartScheduled.Text = ""; StationNextDistance.Text = ""; Message.Text = Viewer.Catalog.GetString("Train not active."); Message.Color = Color.White; if (playerTrain.GetType() == typeof(TTTrain)) { TTTrain playerTimetableTrain = playerTrain as TTTrain; if (playerTimetableTrain.ActivateTime.HasValue) { DateTime activateDT = new DateTime((long)(Math.Pow(10, 7) * playerTimetableTrain.ActivateTime.Value)); Message.Text = String.Concat(Message.Text, Viewer.Catalog.GetString(" Activation time : "), activateDT.ToString("HH:mm:ss")); } } } else { // previous stop if (playerTrain.PreviousStop == null) { StationPreviousName.Text = ""; StationPreviousArriveScheduled.Text = ""; StationPreviousArriveActual.Text = ""; StationPreviousDepartScheduled.Text = ""; StationPreviousDepartActual.Text = ""; StationPreviousDistance.Text = ""; } else { StationPreviousName.Text = playerTrain.PreviousStop.PlatformItem.Name; StationPreviousArriveScheduled.Text = playerTrain.PreviousStop.arrivalDT.ToString("HH:mm:ss"); if (playerTrain.PreviousStop.ActualArrival >= 0) { DateTime actArrDT = new DateTime((long)(Math.Pow(10, 7) * playerTrain.PreviousStop.ActualArrival)); StationPreviousArriveActual.Text = actArrDT.ToString("HH:mm:ss"); StationPreviousArriveActual.Color = actArrDT < playerTrain.PreviousStop.arrivalDT ? Color.LightGreen : Color.LightSalmon; DateTime actDepDT = new DateTime((long)(Math.Pow(10, 7) * playerTrain.PreviousStop.ActualDepart)); StationPreviousDepartActual.Text = actDepDT.ToString("HH:mm:ss"); StationPreviousDepartActual.Color = actDepDT > playerTrain.PreviousStop.arrivalDT ? Color.LightGreen : Color.LightSalmon; } else { StationPreviousArriveActual.Text = Viewer.Catalog.GetString("(missed)"); StationPreviousArriveActual.Color = Color.LightSalmon; StationPreviousDepartActual.Text = ""; } StationPreviousDepartScheduled.Text = playerTrain.PreviousStop.departureDT.ToString("HH:mm:ss"); StationPreviousDistance.Text = ""; } if (playerTrain.StationStops == null || playerTrain.StationStops.Count == 0) { StationCurrentName.Text = ""; StationCurrentArriveScheduled.Text = ""; StationCurrentArriveActual.Text = ""; StationCurrentDepartScheduled.Text = ""; StationCurrentDistance.Text = ""; StationNextName.Text = ""; StationNextArriveScheduled.Text = ""; StationNextDepartScheduled.Text = ""; StationNextDistance.Text = ""; Message.Text = Viewer.Catalog.GetString("No more stations."); } else { StationCurrentName.Text = playerTrain.StationStops[0].PlatformItem.Name; StationCurrentArriveScheduled.Text = playerTrain.StationStops[0].arrivalDT.ToString("HH:mm:ss"); if (playerTrain.StationStops[0].ActualArrival >= 0) { DateTime actArrDT = new DateTime((long)(Math.Pow(10, 7) * playerTrain.StationStops[0].ActualArrival)); StationCurrentArriveActual.Text = actArrDT.ToString("HH:mm:ss"); StationCurrentArriveActual.Color = actArrDT < playerTrain.StationStops[0].arrivalDT ? Color.LightGreen : Color.LightSalmon; } else { StationCurrentArriveActual.Text = ""; } StationCurrentDepartScheduled.Text = playerTrain.StationStops[0].departureDT.ToString("HH:mm:ss"); StationCurrentDistance.Text = FormatStrings.FormatDistanceDisplay(playerTrain.StationStops[0].DistanceToTrainM, metric); Message.Text = playerTrain.DisplayMessage; Message.Color = playerTrain.DisplayColor; if (playerTrain.StationStops.Count >= 2) { StationNextName.Text = playerTrain.StationStops[1].PlatformItem.Name; StationNextArriveScheduled.Text = playerTrain.StationStops[1].arrivalDT.ToString("HH:mm:ss"); StationNextDepartScheduled.Text = playerTrain.StationStops[1].departureDT.ToString("HH:mm:ss"); StationNextDistance.Text = ""; } else { StationNextName.Text = ""; StationNextArriveScheduled.Text = ""; StationNextDepartScheduled.Text = ""; StationNextDistance.Text = ""; } } } } // activity information if (act != null && playerTrain == Owner.Viewer.Simulator.OriginalPlayerTrain) { Current = act.Current == null ? act.Last as ActivityTaskPassengerStopAt : act.Current as ActivityTaskPassengerStopAt; at = Current != null ? Current.PrevTask as ActivityTaskPassengerStopAt : null; InfoAvail = true; } if (InfoAvail) { if (at != null) { StationPreviousName.Text = at.PlatformEnd1.Station; StationPreviousArriveScheduled.Text = at.SchArrive.ToString("HH:mm:ss"); StationPreviousArriveActual.Text = at.ActArrive.HasValue ? at.ActArrive.Value.ToString("HH:mm:ss") : Viewer.Catalog.GetString("(missed)"); StationPreviousArriveActual.Color = GetArrivalColor(at.SchArrive, at.ActArrive); StationPreviousDepartScheduled.Text = at.SchDepart.ToString("HH:mm:ss"); StationPreviousDepartActual.Text = at.ActDepart.HasValue ? at.ActDepart.Value.ToString("HH:mm:ss") : Viewer.Catalog.GetString("(missed)"); StationPreviousDepartActual.Color = GetDepartColor(at.SchDepart, at.ActDepart); StationPreviousDistance.Text = ""; if (playerTrain.StationStops.Count > 0 && playerTrain.StationStops[0].PlatformItem != null && String.Compare(playerTrain.StationStops[0].PlatformItem.Name, StationPreviousName.Text) == 0 && playerTrain.StationStops[0].DistanceToTrainM > 0) { StationPreviousDistance.Text = FormatStrings.FormatDistanceDisplay(playerTrain.StationStops[0].DistanceToTrainM, metric); } } else { StationPreviousName.Text = ""; StationPreviousArriveScheduled.Text = ""; StationPreviousArriveActual.Text = ""; StationPreviousDepartScheduled.Text = ""; StationPreviousDepartActual.Text = ""; StationPreviousDistance.Text = ""; } at = Current; if (at != null) { StationPlatform.Text = at.PlatformEnd1.ItemName; StationCurrentName.Text = at.PlatformEnd1.Station; StationCurrentArriveScheduled.Text = at.SchArrive.ToString("HH:mm:ss"); StationCurrentArriveActual.Text = at.ActArrive.HasValue ? at.ActArrive.Value.ToString("HH:mm:ss") : ""; StationCurrentArriveActual.Color = GetArrivalColor(at.SchArrive, at.ActArrive); StationCurrentDepartScheduled.Text = at.SchDepart.ToString("HH:mm:ss"); Message.Color = at.DisplayColor; Message.Text = at.DisplayMessage; StationCurrentDistance.Text = ""; if (playerTrain.StationStops.Count > 0 && playerTrain.StationStops[0].PlatformItem != null && String.Compare(playerTrain.StationStops[0].PlatformItem.Name, StationCurrentName.Text) == 0 && playerTrain.StationStops[0].DistanceToTrainM > 0) { StationCurrentDistance.Text = FormatStrings.FormatDistanceDisplay(playerTrain.StationStops[0].DistanceToTrainM, metric); } } else { StationPlatform.Text = ""; StationCurrentName.Text = ""; StationCurrentArriveScheduled.Text = ""; StationCurrentArriveActual.Text = ""; StationCurrentDepartScheduled.Text = ""; StationCurrentDistance.Text = ""; Message.Text = ""; } at = Current != null ? Current.NextTask as ActivityTaskPassengerStopAt : null; if (at != null) { StationNextName.Text = at.PlatformEnd1.Station; StationNextArriveScheduled.Text = at.SchArrive.ToString("HH:mm:ss"); StationNextDepartScheduled.Text = at.SchDepart.ToString("HH:mm:ss"); StationNextDistance.Text = ""; if (playerTrain.StationStops.Count > 0 && playerTrain.StationStops[0].PlatformItem != null && String.Compare(playerTrain.StationStops[0].PlatformItem.Name, StationNextName.Text) == 0 && playerTrain.StationStops[0].DistanceToTrainM > 0) { StationNextDistance.Text = FormatStrings.FormatDistanceDisplay(playerTrain.StationStops[0].DistanceToTrainM, metric); } } else { StationNextName.Text = ""; StationNextArriveScheduled.Text = ""; StationNextDepartScheduled.Text = ""; StationNextDistance.Text = ""; } if (act != null && act.IsComplete) { Message.Text = Viewer.Catalog.GetString("Activity completed."); } } } }
public TransferProcessStarted(Guid processId, TransferInfo transferInfo, string description) : base(processId, processId, transferInfo, description) { }
protected AbstractTransferEvent(object sourceId, Guid processId, TransferInfo transferInfo) : this(sourceId, processId, transferInfo, null) { }
public TransferOutRolledback(Guid processId, TransferInfo transferInfo, string description) : base(transferInfo.SourceAccountId, processId, transferInfo, description) { }
//отримання повідомлення void ReceiveMessages() { try { while (true) { byte[] infoBytes = new byte[8]; server.Receive(infoBytes); var info = TransferInfo.FromBytes(infoBytes); byte[] buffer = new byte[250]; MemoryStream memoryStream = new MemoryStream(); int left = info.Size; int count = 0; while (left > 0) { int download = left < buffer.Length ? left : buffer.Length; count = server.Receive(buffer, download, SocketFlags.None); memoryStream.Write(buffer, 0, count); left -= count; } string recive = Encoding.UTF8.GetString(memoryStream.ToArray()); switch (info.Type) { case MessageType.Test: { var serializer = new XmlSerializer(typeof(MakeTest)); //MakeTest desr; using (TextReader reader = new StringReader(recive)) { test = (MakeTest)serializer.Deserialize(reader); } Dispatcher.Invoke(() => { mainWindow.Children.Clear(); FillFild(); FillRadioAnswer(); FillQuestions(); EndExamButton.IsEnabled = true; }); break; } case MessageType.SendMark: { Dispatcher.Invoke(() => { YourMark.Text = recive; }); break; } case MessageType.Error: { System.Windows.MessageBox.Show("Uppss some error"); break; } } } } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); System.Windows.MessageBox.Show("Connection with server is lost"); } }
public int InsertMaster(TransferInfo oParam) { string sql = @"INSERT INTO St_Transfer ( SysNo, TransferID, StockSysNo, CreateTime, CreateUserSysNo, AuditTime, AuditUserSysNo, OutTime, OutUserSysNo, Status, Note ) VALUES ( @SysNo, @TransferID, @StockSysNo, @CreateTime, @CreateUserSysNo, @AuditTime, @AuditUserSysNo, @OutTime, @OutUserSysNo, @Status, @Note )"; SqlCommand cmd = new SqlCommand(sql); SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4); SqlParameter paramTransferID = new SqlParameter("@TransferID", SqlDbType.NVarChar, 20); SqlParameter paramStockSysNo = new SqlParameter("@StockSysNo", SqlDbType.Int, 4); SqlParameter paramCreateTime = new SqlParameter("@CreateTime", SqlDbType.DateTime); SqlParameter paramCreateUserSysNo = new SqlParameter("@CreateUserSysNo", SqlDbType.Int, 4); SqlParameter paramAuditTime = new SqlParameter("@AuditTime", SqlDbType.DateTime); SqlParameter paramAuditUserSysNo = new SqlParameter("@AuditUserSysNo", SqlDbType.Int, 4); SqlParameter paramOutTime = new SqlParameter("@OutTime", SqlDbType.DateTime); SqlParameter paramOutUserSysNo = new SqlParameter("@OutUserSysNo", SqlDbType.Int, 4); SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4); SqlParameter paramNote = new SqlParameter("@Note", SqlDbType.NVarChar, 200); if (oParam.SysNo != AppConst.IntNull) { paramSysNo.Value = oParam.SysNo; } else { paramSysNo.Value = System.DBNull.Value; } if (oParam.TransferID != AppConst.StringNull) { paramTransferID.Value = oParam.TransferID; } else { paramTransferID.Value = System.DBNull.Value; } if (oParam.StockSysNo != AppConst.IntNull) { paramStockSysNo.Value = oParam.StockSysNo; } else { paramStockSysNo.Value = System.DBNull.Value; } if (oParam.CreateTime != AppConst.DateTimeNull) { paramCreateTime.Value = oParam.CreateTime; } else { paramCreateTime.Value = System.DBNull.Value; } if (oParam.CreateUserSysNo != AppConst.IntNull) { paramCreateUserSysNo.Value = oParam.CreateUserSysNo; } else { paramCreateUserSysNo.Value = System.DBNull.Value; } if (oParam.AuditTime != AppConst.DateTimeNull) { paramAuditTime.Value = oParam.AuditTime; } else { paramAuditTime.Value = System.DBNull.Value; } if (oParam.AuditUserSysNo != AppConst.IntNull) { paramAuditUserSysNo.Value = oParam.AuditUserSysNo; } else { paramAuditUserSysNo.Value = System.DBNull.Value; } if (oParam.OutTime != AppConst.DateTimeNull) { paramOutTime.Value = oParam.OutTime; } else { paramOutTime.Value = System.DBNull.Value; } if (oParam.OutUserSysNo != AppConst.IntNull) { paramOutUserSysNo.Value = oParam.OutUserSysNo; } else { paramOutUserSysNo.Value = System.DBNull.Value; } if (oParam.Status != AppConst.IntNull) { paramStatus.Value = oParam.Status; } else { paramStatus.Value = System.DBNull.Value; } if (oParam.Note != AppConst.StringNull) { paramNote.Value = oParam.Note; } else { paramNote.Value = System.DBNull.Value; } cmd.Parameters.Add(paramSysNo); cmd.Parameters.Add(paramTransferID); cmd.Parameters.Add(paramStockSysNo); cmd.Parameters.Add(paramCreateTime); cmd.Parameters.Add(paramCreateUserSysNo); cmd.Parameters.Add(paramAuditTime); cmd.Parameters.Add(paramAuditUserSysNo); cmd.Parameters.Add(paramOutTime); cmd.Parameters.Add(paramOutUserSysNo); cmd.Parameters.Add(paramStatus); cmd.Parameters.Add(paramNote); return(SqlHelper.ExecuteNonQuery(cmd)); }
public TransferedIn(Guid processId, TransferInfo transferInfo, string description) : base(processId, transferInfo, description) { }
public RollbackTransferOutRequested(Guid processId, TransferInfo transferInfo, ErrorInfo errorInfo) : base(processId, processId, transferInfo) { ErrorInfo = errorInfo; }
public TransferedIn(Guid processId, TransferInfo transferInfo, string description) : base(transferInfo.TargetAccountId, processId, transferInfo, description) { }
public void Import() { /* 涉及的问题 * 1 还货记录的处理 * 2 库存的处理 * 3 状态的处理 * 4 还有单据id的对应,这个要特别注意 */ if (!AppConfig.IsImportable) { throw new BizException("Is Importable is false"); } string sql = " select top 1 sysno from st_transfer"; DataSet ds = SqlHelper.ExecuteDataSet(sql); if (Util.HasMoreRow(ds)) { throw new BizException("the table transfer is not empty"); } TransactionOptions options = new TransactionOptions(); options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; options.Timeout = TransactionManager.DefaultTimeout; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)) { string sql_old = @"select old.sysno, old.transferid, stock_con.newsysno as stocksysno, create_con.newsysno as createusersysno, audit_con.newsysno as auditusersysno, audit_con.newsysno as outusersysno, createtime, audittime,audittime as outtime, auditstatus, note, '1' as status from ipp2003..st_transfer as old, ippconvert..sys_user as create_con, ippconvert..sys_user as audit_con, ippconvert..stock as stock_con where old.createusersysno *= create_con.oldsysno and old.auditusersysno *= audit_con.oldsysno and old.stocksysno = stock_con.oldsysno order by old.sysno" ; DataSet ds_old = SqlHelper.ExecuteDataSet(sql_old); if (!Util.HasMoreRow(ds_old)) { return; } foreach (DataRow dr in ds_old.Tables[0].Rows) { /* newStatus audit * abandon -1 * origin 0 * verified 1 */ int newStatus = (int)AppEnum.TransferStatus.Origin; int auditStatus = Util.TrimIntNull(dr["auditStatus"]); if (auditStatus == -1) { newStatus = (int)AppEnum.TransferStatus.Abandon; } else if (auditStatus == 0) { newStatus = (int)AppEnum.TransferStatus.Origin; } else if (auditStatus == 1) { newStatus = (int)AppEnum.TransferStatus.OutStock; } else { throw new BizException("old transfer status out of range"); } TransferInfo oInfo = new TransferInfo(); map(oInfo, dr); oInfo.Status = newStatus; if (new TransferDac().InsertMaster(oInfo) != 1) { throw new BizException("master expected one row error"); } //insert item string sql_item = @"select '0' as sysno, TransferSysNo, con_product.newsysno as productsysno, transferqty, transfercost, transferstatus as transfertype from ipp2003..St_Transfer_Item sti, ippconvert..productbasic as con_product where sti.productsysno = con_product.oldsysno and TransferSysNo=" + oInfo.SysNo; DataSet ds_item = SqlHelper.ExecuteDataSet(sql_item); if (!Util.HasMoreRow(ds_item)) { continue; } foreach (DataRow drItem in ds_item.Tables[0].Rows) { TransferItemInfo oItem = new TransferItemInfo(); map(oItem, drItem); if (oItem.TransferCost == 0) { oItem.TransferCost = AppConst.IntNull; } int resultitem = new TransferDac().InsertItem(oItem); if (resultitem < 1) { throw new BizException("insert item row < 1"); } if (oInfo.Status == (int)AppEnum.TransferStatus.Origin && oItem.TransferType == (int)AppEnum.TransferItemType.Source) { InventoryManager.GetInstance().SetAvailableQty(oInfo.StockSysNo, oItem.ProductSysNo, oItem.TransferQty); } } } string sqlMaxSysNo = "select top 1 sysno from ipp2003..st_transfer order by sysno desc"; DataSet dsMax = SqlHelper.ExecuteDataSet(sqlMaxSysNo); if (!Util.HasMoreRow(dsMax)) { throw new BizException("got max sysno error"); } int maxSysNo = Util.TrimIntNull(dsMax.Tables[0].Rows[0]["sysno"]); // 将自动生成的sysno填到目前的最大单据号 int newSysNo; do { newSysNo = SequenceDac.GetInstance().Create("St_Transfer_Sequence"); } while(newSysNo < maxSysNo); scope.Complete(); } }
/// <summary> /// 转账 /// </summary> /// <param name="user"></param> /// <returns></returns> public abstract TransferResult Transfer(TransferInfo info);
public async Task <ResultInfo <int> > SaveTransferAsync([FromBody] TransferInfo info) { var result = await this.bll.SaveTransferAsync(info); return(result); }
public TransferProcessStarted(Guid processId, TransferInfo transferInfo, string description) : base(processId, transferInfo, description) { }
/// <summary> /// Handles transfer progress events. /// </summary> /// <param name="info">The transfer information.</param> private static void OnTransferProgress(TransferInfo info) { lock (SThreeQLConsole.SyncRoot) { Console.ForegroundColor = ConsoleColor.Cyan; if (info.FileSize > 0 && info.BytesTransferred > 0) { Console.CursorLeft = 0; Console.Write( "{0} of {1} ({2}%) ", info.BytesTransferred.ToFileSize(), info.FileSize.ToFileSize(), (int)((double)info.BytesTransferred / info.FileSize * 100)); } Console.ResetColor(); } }
public TransferOutRolledback(Guid processId, TransferInfo transferInfo, string description) : base(processId, transferInfo, description) { }
public void AddInternalTransfer(TransferInfo transferInfo) { this.internalTransfers.Add(transferInfo); }
public TransferProcessCompleted(Guid processId, TransferInfo transferInfo, TransferProcessResult processResult) : base(processId, transferInfo) { ProcessResult = processResult; }
public async Task <ActionResult <ApiResult <int> > > VerifyTransfer([FromBody] TransferInfo transferInfo) { try { int employeeId = transferInfo.EmployeeId; int projectId = transferInfo.ProjectId; int dutyId = transferInfo.DutyId; DateTime transferDate = transferInfo.TransferDate == null ? DateTime.Today : transferInfo.TransferDate.Value; if (employeeId <= 0 || projectId <= 0 || dutyId <= 0) { return(Error <int>("员工ID,项目ID,职责ID都不能为无效(小于或等于0)")); } bool hasWarning = false; System.Text.StringBuilder warningBuilder = new System.Text.StringBuilder(); var employee = await DbHelper.FindEntity <Entity.Employee>(Connector, employeeId); if (employee == null || employee.ID <= 0) { throw new Exception("人员不在库中"); } var project = await DbHelper.FindEntity <Entity.Project>(Connector, projectId); if (project == null || project.ID <= 0) { throw new Exception("项目不在库中"); } Duty duty = await DbHelper.FindEntity <Reference>(Connector, dutyId); if (duty == null || duty.DutyID <= 0) { throw new Exception("职责不在库中"); } if (employee.InProjectID > 0) { //人员已经在项目中,列为警告 var inProject = await DbHelper.FindEntity <Entity.Project>(Connector, employee.InProjectID); hasWarning = true; warningBuilder.Append($"已在项目[{inProject.ShortName}]中。"); } var pageRequired = await DbHelper.SearchEntities <DutyQualification>(Connector, new Dictionary <string, object> { [nameof(DutyQualification.DutyID)] = dutyId }, 0, int.MaxValue, "", false); if (pageRequired.Total > 0) { //职责有资格要求 var pagedCertifications = await DbHelper.SearchEntities <Certification>(Connector, new Dictionary <string, object> { [nameof(Certification.EmployeeID)] = employeeId }, 0, int.MaxValue, nameof(Certification.ExpireDate), true); foreach (DutyQualification reqired in pageRequired.Records) { if (pagedCertifications.Total > 0) { //人员具备一些资格证书,需要检查是否有所需的并且没有到期 var matched = from certification in pagedCertifications.Records where certification.QualificationID == reqired.QualificationID && certification.ExpireDate >= transferDate select certification; if (matched.Count() == 0) { hasWarning = true; Qualification qualification = await DbHelper.FindEntity <Reference>( Connector, reqired.QualificationID); warningBuilder.Append($"无[{qualification.Name}]资格或已过期。"); } } else { //人员没有任何资格证书 hasWarning = true; Qualification qualification = await DbHelper.FindEntity <Reference>( Connector, reqired.QualificationID); warningBuilder.Append($"无[{qualification.Name}]资格。"); } } } if (hasWarning) { return(Success(1, warningBuilder.ToString())); } else { return(Success(0)); } } catch (Exception ex) { return(Error <int>(ex.ToString())); } }
public async Task <ActionResult> Transfer(TransferInfo transferInfo) { await _applicationService.TansferAsync(User.Identity.Name, transferInfo); return(RedirectToAction("Transfer")); }
public async Task <ActionResult <ApiResult <int> > > Transfer([FromBody] TransferInfo transferInfo) { try { int employeeId = transferInfo.EmployeeId; int projectId = transferInfo.ProjectId; int dutyId = transferInfo.DutyId; int userId = transferInfo.UserId; DateTime transferDate = transferInfo.TransferDate == null ? DateTime.Today : transferInfo.TransferDate.Value; if (employeeId <= 0) { return(Error <int>("员工ID不能为无效(小于或等于0)")); } if (projectId > 0 && dutyId <= 0) { return(Error <int>("调入项目的同时必须分配职责")); } var employee = await DbHelper.FindEntity <Entity.Employee>(Connector, employeeId); if (employee == null || employee.ID <= 0) { throw new Exception("人员不在库中"); } Entity.Project project; Duty duty; if (projectId > 0) { project = await DbHelper.FindEntity <Entity.Project>(Connector, projectId); if (project == null || project.ID <= 0) { throw new Exception("项目不在库中"); } duty = await DbHelper.FindEntity <Reference>(Connector, dutyId); if (duty == null || duty.DutyID <= 0) { throw new Exception("职责不在库中"); } } else { project = null; duty = null; } if (employee.InProjectID > 0) { Entity.Project outProject = await DbHelper.FindEntity <Entity.Project>(Connector, employee.InProjectID); //添加调出日志 TransferOutLog outLog = new TransferOutLog() { ActiveStatus = true, CreatedBy = userId, CreatedOn = DateTime.Now, OutDate = transferDate, OutDutyID = employee.InDutyID, OutEmployeeID = employeeId, OutProjectID = employee.InProjectID, EmployeeName = employee.Name, ProjectName = string.IsNullOrEmpty(outProject.ShortName) ? outProject.FullName : outProject.ShortName, }; if (employee.InDutyID > 0) { outLog.DutyName = (await DbHelper.FindEntity <Reference>(Connector, employee.InDutyID)).ReferenceValue; } await DbHelper.InsertEntity(Connector, outLog); } if (project == null) { //将人员设置为自由, 无需任何调入日志 employee.InDate = ValueHelper.DbDate_Null; employee.InDutyID = ValueHelper.DBKEY_NULL; employee.InProjectID = ValueHelper.DBKEY_NULL; employee.ProjectName = string.Empty; employee.DutyName = string.Empty; } else { //添加调入日志 TransferInLog inLog = new TransferInLog() { ActiveStatus = true, CreatedBy = userId, CreatedOn = DateTime.Now, InDate = transferDate, InDutyID = dutyId, InEmployeeID = employeeId, InProjectID = projectId, EmployeeName = employee.Name, ProjectName = string.IsNullOrEmpty(project.ShortName) ? project.FullName : project.ShortName, DutyName = duty.Name }; await DbHelper.InsertEntity(Connector, inLog); //修改人员状态 employee.InDate = transferDate; employee.InDutyID = dutyId; employee.InProjectID = projectId; employee.ProjectName = string.IsNullOrEmpty(project.ShortName) ? project.FullName : project.ShortName; employee.DutyName = duty.Name; } await DbHelper.UpdateEntity(Connector, employee); return(Success(0)); } catch (Exception ex) { return(Error <int>(ex.Message)); } }
protected AbstractTransferEvent(object sourceId, Guid processId, TransferInfo transferInfo, string description) : base(sourceId) { ProcessId = processId; TransferInfo = transferInfo; Description = description; }
public Task TransferDataAsync(TransferInfo transfer, Func <Task, TransferInfo, Task>?handler = null) => TransferDataAsync(new[] { transfer }, handler);
/// <summary> /// 转账 /// </summary> /// <param name="user"></param> /// <returns></returns> public override TransferResult Transfer(TransferInfo info) { throw new NotImplementedException(); }
public AbstractTransferEvent(Guid processId, TransferInfo transferInfo) : this(processId, transferInfo, null) { }
/// <summary> /// Adds a single value transfer to an address, which will be used in all future accounting. /// Used when performing an external contract create/call to reflect the value sent with /// the contract invocation transaction. /// </summary> public void AddInitialTransfer(TransferInfo transferInfo) { this.InitialTransfer = transferInfo; }
public AbstractTransferEvent(Guid processId, TransferInfo transferInfo, string description) { ProcessId = processId; TransferInfo = transferInfo; Description = description; }
public async Task ConnectToServer( ) { _connection = new HubConnectionBuilder() .WithUrl(url) .Build(); await _connection.StartAsync(); isConnected = true; connectionStatus = "Connected"; _connection.Closed += async(s) => { isConnected = false; connectionStatus = "Disconnected"; await _connection.StartAsync(); isConnected = true; }; _connection.On <string, string, int, int, string, string, double, string> ("CallInfo", async(SessionId, UserToken, studentID, teacherID, Class, subject, cost, studentName) => { if (takeTuition == true) { if (teacher.TeacherID == teacherID) { _connection.StopAsync(); ac++; takeTuition = false; TransferInfo Info = new TransferInfo(); Info.Student.Name = studentName; Info.Class = Class; Info.SubjectName = subject; Info.SessionID = SessionId; Info.UserToken = UserToken; Info.Student.StudentID = studentID; Info.Teacher = teacher; Info.Teacher.Amount = cost; activelbl.Text = "Inactive"; activeback.BackgroundColor = Color.FromHex("#A7A7A7"); ShowOffLineInStudentWindowRealTime("On Tuition"); setOnTuitionOFF(1); if (StaticPageForOnSleep.isSleep == true) { StaticPageForOnSleep.isCallPending = true; StaticPageForOnSleep.info = Info; MainThread.BeginInvokeOnMainThread(() => { DependencyService.Get <INotification> ().CreateNotification("Shikkhanobish", studentName + " is calling you for tuition. Tap to continue..."); }); } else { MainThread.BeginInvokeOnMainThread(async( ) => { await Application.Current.MainPage.Navigation.PushModalAsync(new CallingPageForTeacher(Info, 0, ShortNote)).ConfigureAwait(false); }); } } } }); _connection.On <int, string>("SendShortNote", async(teacherID, shortNote) => { if (teacherID == teacher.TeacherID) { StaticPageForOnSleep.shortNote = shortNote; ShortNote = shortNote; } }); }
public TransferProcessCompleted(Guid processId, TransferInfo transferInfo, TransferProcessResult processResult) : base(processId, processId, transferInfo) { ProcessResult = processResult; }
public RollbackTransferOutRequested(Guid processId, TransferInfo transferInfo, Exception processException) : base(processId, transferInfo) { ProcessException = processException; }