예제 #1
0
        public static ReasonCode CreateReasonCode(string reasonCodeId)
        {
            ReasonCode reasonCode = new ReasonCode();

            reasonCode.ReasonCodeId = reasonCodeId;
            return(reasonCode);
        }
예제 #2
0
        public LifecyclePacketsV5(int packetId, byte header, ReasonCode reason, string reasonString, IReadOnlyList <UserProperty>?userProperties)
        {
            PacketId        = packetId;
            _header         = header;
            _reason         = reason;
            _reasonString   = reasonString;
            _userProperties = userProperties ?? Array.Empty <UserProperty>();
            _contentSize    = 3;
            bool hasReason         = !string.IsNullOrEmpty(reasonString);
            bool hasUserProperties = userProperties?.Count > 0;

            if (hasReason || hasUserProperties)
            {  // property: 1 byte + property content
                if (hasReason)
                {
                    _propertiesSize += 1 + reasonString.MQTTSize();
                }
                if (hasUserProperties)
                {
                    _propertiesSize += userProperties.Sum(s => s.Size);
                }
                _contentSize += _propertiesSize + _propertiesSize.CompactByteCount();
            }
            _getSize = GetSize(ProtocolLevel.MQTT5) + 1 + _contentSize.CompactByteCount() + _contentSize;
        }
예제 #3
0
        public string RecordLine()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(recordType); // (2) - static length
            sb.Append(SduBatchId.PadLeft(20, '0'));
            sb.Append(SduTranId);  //(20) - static length
            sb.Append(ReceiptNumber.PadLeft(7, '0'));
            sb.Append(StrRetransmittalIndicator.PadRight(1));
            sb.Append(PayorID.PadRight(13));
            sb.Append(PayorSSN.PadRight(9));
            sb.Append(PaidBy.PadRight(15));
            sb.Append(PayorLastName.PadRight(25));
            sb.Append(PayorFirstName.PadRight(20));
            sb.Append(PayorMiddleName.PadRight(20));
            sb.Append(PayorSuffix.PadRight(3));
            sb.Append(StrAmount.PadLeft(15, '0'));
            sb.Append(StrOfcAmount.PadLeft(15, '0'));
            sb.Append(PaymentMode.PadRight(2));
            sb.Append(PaymentSource.PadRight(4));
            sb.Append(ReceiptReceivedDate.PadRight(8));
            sb.Append(ReceiptEffectiveDate.PadRight(8));
            sb.Append(CheckNumber.PadRight(18));
            sb.Append(ComplianceExemptionReason.PadRight(1));
            sb.Append(TargetedPaymentIndicator.PadRight(1, '0'));
            sb.Append(Fips.PadRight(7));
            sb.Append(CourtCaseNumber.PadRight(25));
            sb.Append(CourtJudgementNumber.PadLeft(3, '0'));
            sb.Append(CourtGuidelineNumber.PadLeft(3, '0'));
            sb.Append(ReasonCode.PadRight(3));
            sb.Append(filler.PadRight(32));

            return(sb.ToString());
        }
예제 #4
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as CareTeam;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (Identifier != null)
            {
                dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
            }
            if (StatusElement != null)
            {
                dest.StatusElement = (Code <Hl7.Fhir.Model.CareTeam.CareTeamStatus>)StatusElement.DeepCopy();
            }
            if (Category != null)
            {
                dest.Category = new List <Hl7.Fhir.Model.CodeableConcept>(Category.DeepCopy());
            }
            if (NameElement != null)
            {
                dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopy();
            }
            if (Subject != null)
            {
                dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy();
            }
            if (Context != null)
            {
                dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopy();
            }
            if (Period != null)
            {
                dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopy();
            }
            if (Participant != null)
            {
                dest.Participant = new List <Hl7.Fhir.Model.CareTeam.ParticipantComponent>(Participant.DeepCopy());
            }
            if (ReasonCode != null)
            {
                dest.ReasonCode = new List <Hl7.Fhir.Model.CodeableConcept>(ReasonCode.DeepCopy());
            }
            if (ReasonReference != null)
            {
                dest.ReasonReference = new List <Hl7.Fhir.Model.ResourceReference>(ReasonReference.DeepCopy());
            }
            if (ManagingOrganization != null)
            {
                dest.ManagingOrganization = new List <Hl7.Fhir.Model.ResourceReference>(ManagingOrganization.DeepCopy());
            }
            if (Note != null)
            {
                dest.Note = new List <Hl7.Fhir.Model.Annotation>(Note.DeepCopy());
            }
            return(dest);
        }
예제 #5
0
        public async Task <ActionResult> UpdateReasonCodeAsync([FromBody] ReasonCode reasonCodeToUpdate)
        {
            var reasonCode = await _appointmentContext.ReasonCodes.SingleOrDefaultAsync(i => i.Id == reasonCodeToUpdate.Id);

            if (reasonCode == null)
            {
                return(NotFound(new { Message = $"Item with id {reasonCodeToUpdate.Id} not found." }));
            }

            var oldName = reasonCode.Code;
            var raiseCodeChangedEvent = oldName != reasonCodeToUpdate.Code;

            // Update current reasonCode
            reasonCode = reasonCodeToUpdate;
            _appointmentContext.ReasonCodes.Update(reasonCode);

            if (raiseCodeChangedEvent) // Save reasonCode's data and publish integration event through the Event Bus if price has changed
            {
                //Create Integration Event to be published through the Event Bus
                var reasonCodeChangedEvent = new AppointmentReasonCodeChangedIntegrationEvent(reasonCode.Id, reasonCodeToUpdate.Code, oldName);

                // Achieving atomicity between original ReasonCode database operation and the IntegrationEventLog thanks to a local transaction
                await _appointmentIntegrationEventService.SaveEventAndReasonCodeContextChangesAsync(reasonCodeChangedEvent);

                // Publish through the Event Bus and mark the saved event as published
                await _appointmentIntegrationEventService.PublishThroughEventBusAsync(reasonCodeChangedEvent);
            }
            else // Just save the updated reason code because the ReasonCode cod hasn't changed.
            {
                await _appointmentContext.SaveChangesAsync();
            }

            return(CreatedAtAction(nameof(ItemByIdAsync), new { id = reasonCodeToUpdate.Id }, null));
        }
예제 #6
0
        public virtual void CreateWriteOff(ReasonCode reasonCode, string WOSubCD, DateTime?WODate, string WOFinPeriodID, ARRegister ardoc)
        {
            Int32?WOAccountID = reasonCode.AccountID;

            if (WOAccountID == null)
            {
                throw new ArgumentNullException("WOAccountID");
            }

            if (WOSubCD == null)
            {
                throw new ArgumentNullException("WOSubCD");
            }

            this.Clear();
            customer.Current = null;
            _CustomerID      = ardoc.CustomerID;

            ARPayment payment = new ARPayment();

            payment.BranchID = ardoc.BranchID;
            payment          = PXCache <ARPayment> .CreateCopy(this.Document.Insert(payment));

            payment.CustomerID         = ardoc.CustomerID;
            payment.CustomerLocationID = ardoc.CustomerLocationID;
            payment.AdjDate            = WODate;
            payment.AdjFinPeriodID     = WOFinPeriodID;
            payment.DocDate            = WODate;
            payment.FinPeriodID        = WOFinPeriodID;
            payment.CuryID             = ardoc.CuryID;
            payment.ARAccountID        = WOAccountID;
            payment.Hold    = false;
            payment.DocDesc = reasonCode.Descr;

            payment = this.Document.Update(payment);
            this.Document.Cache.SetValueExt <ARPayment.aRSubID>(payment, WOSubCD);

            ARAdjust adj = new ARAdjust();

            adj.AdjdDocType = ardoc.DocType;
            adj.AdjdRefNbr  = ardoc.RefNbr;

            adj = this.Adjustments.Insert(adj);

            Document.Current.CuryDocBal += (decimal)adj.CuryAdjgAmt;
            Document.Current.DocBal     += (decimal)adj.AdjAmt;

            Document.Current.CuryOrigDocAmt += (decimal)adj.CuryAdjgAmt;
            Document.Current.OrigDocAmt     += (decimal)adj.AdjAmt;

            ARReleaseProcess.UpdateARBalances(this, Document.Current, adj.AdjAmt);

            if (Document.Cache.GetStatus(Document.Current) == PXEntryStatus.Notchanged)
            {
                Document.Cache.SetStatus(Document.Current, PXEntryStatus.Updated);
            }

            this.Actions.PressSave();
        }
예제 #7
0
 public static Result Failure(string errorMessage, string detailErrorMessage, ReasonCode reasonCode, Exception?exception)
 {
     return(new Result
     {
         ErrorMessage = errorMessage,
         ReasonCode = reasonCode,
         Exception = exception,
         DetailErrorMessage = detailErrorMessage
     });
 }
예제 #8
0
        private void ProcessException(PeerConnection peer, Messages.MineralMessage message, System.Exception exception)
        {
            string     reason_message = "";
            ReasonCode code           = ReasonCode.Unknown;

            if (exception is P2pException)
            {
                P2pException.ErrorType type = ((P2pException)exception).Type;
                switch (type)
                {
                case P2pException.ErrorType.BAD_TRX:
                    code = ReasonCode.BadTx;
                    break;

                case P2pException.ErrorType.BAD_BLOCK:
                    code = ReasonCode.BadBlock;
                    break;

                case P2pException.ErrorType.NO_SUCH_MESSAGE:
                case P2pException.ErrorType.MESSAGE_WITH_WRONG_LENGTH:
                case P2pException.ErrorType.BAD_MESSAGE:
                    code = ReasonCode.BadProtocol;
                    break;

                case P2pException.ErrorType.SYNC_FAILED:
                    code = ReasonCode.SyncFail;
                    break;

                case P2pException.ErrorType.UNLINK_BLOCK:
                    code = ReasonCode.Unlinkable;
                    break;

                default:
                    code = ReasonCode.Unknown;
                    break;
                }

                reason_message = string.Format("Message from {0} process failed, {1} \n type: {2}, detail: {3}.",
                                               peer.Address,
                                               message,
                                               type,
                                               exception.Message);
                Logger.Error(reason_message);
            }
            else
            {
                code           = ReasonCode.Unknown;
                reason_message = string.Format("Message from {0} process failed, {1}",
                                               peer.Address,
                                               message);
                Logger.Error(reason_message);
            }

            peer.Disconnect(code, reason_message);
        }
예제 #9
0
        /// <summary>
        /// Callback handler which processes a <see cref="AW.AW_CALLBACK.AW_CALLBACK_LOGIN"/> callback.
        /// </summary>
        /// <param name="sender">The <see cref="AW.IInstance"/> instance which triggered the callback.</param>
        /// <param name="reasonCode">The <see cref="AW.ReasonCode"/> result of the call to <see cref="AW.IInstance.Login"/>.</param>
        private void CallbackLogin_CallbackHandler(IInstance sender, ReasonCode reasonCode)
        {
            if (reasonCode != ReasonCode.Success)
            {
                throw new Exception($"Failed to login (reason {reasonCode})");
            }

            Console.WriteLine("Login Successful!");

            _aw.Enter(_config.EntryWorld);
        }
예제 #10
0
        public void HandleReponse(ActionCode actionCode, ReasonCode reasonCode, string data)
        {
            BaseRequest request;

            requestDict.TryGetValue(actionCode, out request);
            if (request == null)
            {
                Console.WriteLine("无法得到ActionCode[" + actionCode + "]对应的Request类"); return;
            }
            request.OnResponse(GetReason(reasonCode), data);
        }
        public async Task <IActionResult> Create([Bind("rsnId,rsnNm,rsnDesc")] ReasonCode reasonCode)
        {
            if (ModelState.IsValid)
            {
                _context.Add(reasonCode);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(reasonCode));
        }
예제 #12
0
        public static byte[] PackData(ActionCode actionCode, ReasonCode reasonCode, string data)
        {
            byte[] requestCodeBytes = BitConverter.GetBytes((int)actionCode);
            byte[] reasonCodeBytes  = BitConverter.GetBytes((int)reasonCode);
            byte[] dataBytes        = Encoding.UTF8.GetBytes(data);
            int    dataAmount       = requestCodeBytes.Length + reasonCodeBytes.Length + dataBytes.Length;

            byte[] dataAmountBytes = BitConverter.GetBytes(dataAmount);
            byte[] newBytes        = dataAmountBytes.Concat(requestCodeBytes).ToArray <byte>();//Concat(dataBytes);
            return(newBytes.Concat(reasonCodeBytes).Concat(dataBytes).ToArray <byte>());
        }
예제 #13
0
 public void Send(ActionCode actionCode, ReasonCode reasonCode, string data)
 {
     try
     {
         byte[] bytes = MessageHandle.PackData(actionCode, reasonCode, data);
         clientSocket.Send(bytes);
     }
     catch (Exception e)
     {
         Console.WriteLine("无法发送消息:" + e);
     }
 }
		internal WlanConnectionNotificationEventArgs(WlanInternNotificationData data, WlanInternNotificationConnectionData c)
		{
			Source = data.notificationSource;
			Code = data.NotificationCode;
			BssType = c.dot11BssType;
			ProfileName = c.profileName;
			ProfileXml = c.profileXml;
			SecurityEnabled = c.securityEnabled;
			ConnectionMode = c.ConnectionMode;
			ReasonCode = c.wlanReasonCode;
			Ssid = c.Dot11Ssid.GetSsid();
		}
        public int DeleteReasonDetails(ReasonCode objReason)
        {
            try
            {
                DataBaseServiceHandler.ExecuteNonQuery(CommonDataAccess.ExchangeConnectionString, CommandType.StoredProcedure, DBConstants.CONST_SP_DELETE_REASON_PROC,
                                                       DataBaseServiceHandler.AddParameter <string>(DBConstants.CONST_PARAM_REASONDESCRIPTION, DbType.String, objReason.ReasonDescription));
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }

            return(1);
        }
예제 #16
0
        public async Task <ActionResult> CreateProductAsync([FromBody] ReasonCode reasonCode)
        {
            var item = new ReasonCode
            {
                Code        = reasonCode.Code,
                Description = reasonCode.Description
            };

            _appointmentContext.ReasonCodes.Add(item);

            await _appointmentContext.SaveChangesAsync();

            return(CreatedAtAction(nameof(ItemByIdAsync), new { id = item.Id }, null));
        }
예제 #17
0
 /// <summary>
 /// 原因代码记录单击事件。
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void gridViewCode_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
 {
     CtrlState   = ControlState.Edit;
     _reasonCode = new ReasonCode(this.gridViewCode.GetRowCellValue(e.RowHandle, this.gcolCodeKey).ToString());
     this.txtEditCodeName.Text        = this.gridViewCode.GetRowCellValue(e.RowHandle, this.gcolCodeName).ToString();
     this.txtEditCodeDescription.Text = Convert.ToString(this.gridViewCode.GetRowCellValue(e.RowHandle, this.gcolDescription));
     this.lueType.EditValue           = Convert.ToString(this.gridViewCode.GetRowCellValue(e.RowHandle, this.gcolCodeType));
     this.lueClass.EditValue          = Convert.ToString(this.gridViewCode.GetRowCellValue(e.RowHandle, this.gcolClass));
     _reasonCode.CodeName             = this.txtEditCodeName.Text;
     _reasonCode.CodeType             = this.lueType.EditValue.ToString();
     _reasonCode.CodeDescriptions     = this.txtEditCodeDescription.Text;
     _reasonCode.CodeClass            = Convert.ToString(this.lueClass.EditValue);
     _reasonCode.Editor       = PropertyService.Get(PROPERTY_FIELDS.USER_NAME);
     _reasonCode.EditTimeZone = PropertyService.Get(PROPERTY_FIELDS.TIMEZONE);
     _reasonCode.ResetDirtyList();
 }
예제 #18
0
        public ArrayList GetReasonCode(string StoreID, short Type)
        {
            RPDatasets.RPDataset1TableAdapters.Setup_Reason_CodesTableAdapter setup_Reason_CodesTableAdapter =
                new Setup_Reason_CodesTableAdapter {
                Connection = DAO.DataProvider.ConnectionData(StaticClass.RPServer)
            };
            DataTable dataTable = setup_Reason_CodesTableAdapter.GetData(StaticClass.storeId,
                                                                         Type);
            ArrayList reasonlist = new ArrayList();

            for (int i = 0; i < dataTable.Rows.Count; i++)
            {
                ReasonCode reasonCode = new ReasonCode(dataTable.Rows[i]["Reason_Code"].ToString(), Convert.ToInt32(dataTable.Rows[i]["Reason_Type"]));
                reasonlist.Add(reasonCode);
            }
            return(reasonlist);
        }
            /// <summary>
            ///     Writes the current packet properties to the backing ByteArraySegment.
            /// </summary>
            public override void UpdateCalculatedValues()
            {
                if ((this.header == null) || (this.header.Length > (this.header.BytesLength - this.header.Offset)) || (this.header.Length < this.FrameSize))
                {
                    this.header = new ByteArraySegment(new Byte[this.FrameSize]);
                }

                this.FrameControlBytes = this.FrameControl.Field;
                this.DurationBytes     = this.Duration.Field;
                this.SetAddress(0, this.DestinationAddress);
                this.SetAddress(1, this.SourceAddress);
                this.SetAddress(2, this.BssId);
                this.SequenceControlBytes = this.SequenceControl.Field;
                this.ReasonBytes          = this.Reason;

                this.header.Length = this.FrameSize;
            }
예제 #20
0
파일: Channel.cs 프로젝트: lovecpus/mineral
        public void Disconnect(ReasonCode reason, string message)
        {
            this.is_disconnect = true;
            Manager.Instance.ChannelManager.ProcessDisconnect(this, reason);

            Messages.DisconnectMessage msg = new Messages.DisconnectMessage(reason, message);
            Logger.Info(
                string.Format("Send to {0} online-time {1}s, {2}",
                              this.context.Channel.RemoteAddress.ToString(),
                              (Helper.CurrentTimeMillis() - this.start_time) / 1000,
                              msg));

            this.node_statistics.NodeDisconnectedLocal(reason);

            Task task = this.context.WriteAndFlushAsync(msg.GetSendData());

            task.Wait();
            Close();
        }
예제 #21
0
        public Result(bool success, ReasonCode reason, string?userFriendlyMessage, string?developerFriendlyMessage, [CanBeNull][AllowNull] TEntity entity)
            : base(success, reason, userFriendlyMessage, developerFriendlyMessage)
        {
            if (success && entity == null && reason != ReasonCode.NoContent)
            {
                throw new ArgumentException($"Parameter {nameof(entity)} must have a value when {nameof(success)} is 'true' and {nameof(reason)} is not '{nameof(ReasonCode.NoContent)}'.");
            }

            if (success &&
                reason != ReasonCode.Accepted &&
                reason != ReasonCode.NoContent &&
                reason != ReasonCode.Success)
            {
                throw new ArgumentException(
                          $"Parameter '{nameof(success)}' is set to 'true' but the value of the '{reason}' is not one of the values: " +
                          $"'{nameof(ReasonCode.Accepted)}', '{nameof(ReasonCode.NoContent)}', '{nameof(ReasonCode.Success)}'.");
            }

            _entity = entity !;
        }
예제 #22
0
        public static void ThrowsReasonCode(ReasonCode rc, Action <object> act)
        {
            ReasonCode?thrown = null;

            try
            {
                act(new object());
            }
            catch (VPException ex)
            {
                thrown = ex.Reason;
            }

            if (!thrown.HasValue)
            {
                Assert.Fail("Delegate did not throw a VPException. Expected: {0}", rc);
            }

            Assert.AreEqual(rc, thrown.Value);
        }
예제 #23
0
        public void ProcessDisconnect(Channel channel, ReasonCode reason)
        {
            if (channel.Address == null)
            {
                return;
            }

            switch (reason)
            {
            case ReasonCode.BadProtocol:
            case ReasonCode.BadBlock:
            case ReasonCode.BadTx:
                AddBadPeer(channel.Address, reason);
                break;

            default:
                AddRecentlyDisconnected(channel.Address, reason);
                break;
            }
        }
        /// <summary>
        /// 获取ERP中的原因代码
        /// </summary>
        public void ReasonCmbBind()
        {
            //cmb_reason.AutoCompleteSource = AutoCompleteSource.ListItems;
            //cmb_reason.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
            //cmb_reason.Items.Clear();
            DataGridViewComboBoxColumn dgvcom1 = new DataGridViewComboBoxColumn();
            DataSet PartDS = ReasonCode.FindReasonDataset();

            dgvcom1.DataSource    = PartDS.Tables[0].DefaultView;
            dgvcom1.HeaderText    = "需求原因";
            dgvcom1.Name          = "需求原因";
            dgvcom1.DisplayMember = "DESCRIPTION";
            dgvcom1.ValueMember   = "REASON_CODE";
            //dgvcom1.sle = "正常申请";
            dgv1.Columns.Add(dgvcom1);
            //cmb_reason.DataSource = PartDS.Tables[0].DefaultView;
            //cmb_reason.DisplayMember = "DESCRIPTION";
            //cmb_reason.ValueMember = "REASON_CODE";
            //cmb_reason.SelectedValue = "1001";
        }
예제 #25
0
        public string GetReason(ReasonCode reasonCode)
        {
            switch (reasonCode)
            {
            case ReasonCode.IllegalCharacter:
                return("输入数据含有非法字符");

            case ReasonCode.None:
                return("");

            case ReasonCode.UsernameOrPwdError:
                return("用户名或者密码错误");

            case ReasonCode.DatabaseException:
                return("数据库异常");

            case ReasonCode.RepeatRegister:
                return("重复注册");
            }
            return("");
        }
예제 #26
0
        /// <summary>
        /// Callback handler which prcoesses a <see cref="AW.AW_CALLBACK.AW_CALLBACK_ENTER"/> callback.
        /// </summary>
        /// <param name="sender">The <see cref="AW.IInstance"/> instance which triggered the callback.</param>
        /// <param name="reasonCode">The <see cref="AW.ReasonCode"/> result of the call to <see cref="AW.IInstance.Enter()"/>.</param>
        private void CallbackEnter_CallbackHandler(IInstance sender, ReasonCode reasonCode)
        {
            ReasonCode rc = 0;

            if (reasonCode != ReasonCode.Success)
            {
                throw new Exception($"Failed to enter {_config.EntryWorld} (reason {reasonCode})");
            }

            Console.WriteLine($"Successfully entered world {_config.EntryWorld}!");

            _aw.Attributes.MyX   = 0;
            _aw.Attributes.MyZ   = 0;
            _aw.Attributes.MyYaw = 2250;

            rc = _aw.StateChange();
            if (rc != ReasonCode.Success)
            {
                throw new Exception($"Failed to change state (reason {rc})");
            }
        }
예제 #27
0
        // Command -> Event - how to track this simple use case?
        // Command -> Event -> Event -> Command -> Event ... or this one?

        public async Task HandleAsync(CreateReasonCode command, ICorrelationContext context)
        {
            // ReasonCode validation
            var rc = await _reasonCodesRepository.GetAsync(command.Code);

            if (rc != null)
            {
                //onError: -> publish CreateReasonCodeRejected
                throw new UsavcException("reason_code_already_exists",
                                         $"ReasonCode : '{command.Code}' exists.");
            }

            // Unique code validation
            var newReasonCode = new ReasonCode(command.Code, command.Description);
            await _reasonCodesRepository.AddAsync(newReasonCode);

            var @event = new ReasonCodeCreated(newReasonCode.Code, newReasonCode.Description);
            await _busPublisher.PublishAsync(@event, context);

            // Send an email about a new discount to the customer
        }
예제 #28
0
        protected virtual void INTran_ReasonCode_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
        {
            INTran row = e.Row as INTran;

            if (row != null)
            {
                ReasonCode reasoncd = PXSelect <ReasonCode, Where <ReasonCode.reasonCodeID, Equal <Optional <ReasonCode.reasonCodeID> > > > .Select(this, e.NewValue);

                if (reasoncd != null && row.ProjectID != null && !ProjectDefaultAttribute.IsNonProject(this, row.ProjectID))
                {
                    PX.Objects.GL.Account account = PXSelect <PX.Objects.GL.Account, Where <PX.Objects.GL.Account.accountID, Equal <Required <PX.Objects.GL.Account.accountID> > > > .Select(this, reasoncd.AccountID);

                    if (account != null && account.AccountGroupID == null)
                    {
                        sender.RaiseExceptionHandling <INTran.reasonCode>(e.Row, account.AccountCD, new PXSetPropertyException(PM.Messages.NoAccountGroup, PXErrorLevel.Warning, account.AccountCD));
                    }
                }

                e.Cancel = (reasoncd != null) &&
                           (row.TranType != INTranType.Issue && row.TranType != INTranType.Receipt && reasoncd.Usage == ReasonCodeUsages.Sales || reasoncd.Usage == row.DocType);
            }
        }
예제 #29
0
            /// <summary>
            /// Calculates reason codes that are linked by other reason codes.
            /// </summary>
            /// <param name="reasonCodes">The reason codes collection.</param>
            /// <param name="reasonCode">The reason code.</param>
            /// <param name="context">The request context.</param>
            /// <returns>Collection of reason codes which are linked by present reason codes and not on the original collection.</returns>
            private static IEnumerable <ReasonCode> CalculateLinkedReasonCodes(
                IEnumerable <ReasonCode> reasonCodes,
                ReasonCode reasonCode,
                RequestContext context)
            {
                HashSet <string> missingIds = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
                IDictionary <string, ReasonCode> linkedReasonCodes = new Dictionary <string, ReasonCode>();
                var reasonCodesById = reasonCodes.ToDictionary(r => r.ReasonCodeId);

                missingIds.Add(reasonCode.LinkedReasonCodeId);

                // get all the missing reason codes. also makes sure all the linked reason codes by the missing reason codes are also included and so on.
                while (missingIds.Any())
                {
                    HashSet <string>          missingLinkedIds     = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
                    GetReasonCodesDataRequest getReasonCodeRequest = new GetReasonCodesDataRequest(QueryResultSettings.AllRecords, missingIds);
                    var missingReasonCodes = context.Execute <EntityDataServiceResponse <ReasonCode> >(getReasonCodeRequest).PagedEntityCollection.Results;

                    foreach (var missingReasonCode in missingReasonCodes)
                    {
                        if (!linkedReasonCodes.ContainsKey(missingReasonCode.ReasonCodeId) && !reasonCodesById.ContainsKey(missingReasonCode.ReasonCodeId))
                        {
                            linkedReasonCodes[missingReasonCode.ReasonCodeId] = missingReasonCode;

                            // if the new reason code links to a different one, and the new one is not present, adds it for later.
                            if (!string.IsNullOrWhiteSpace(missingReasonCode.LinkedReasonCodeId) &&
                                !reasonCodesById.ContainsKey(missingReasonCode.LinkedReasonCodeId))
                            {
                                missingLinkedIds.Add(missingReasonCode.LinkedReasonCodeId);
                            }
                        }
                    }

                    // verify the new linked reason codes
                    missingIds = missingLinkedIds;
                }

                return(linkedReasonCodes.Values);
            }
예제 #30
0
 /// <summary>
 /// 解析数据或者叫做读取数据
 /// </summary>
 public void ReadMessage(int newDataAmount, Action<ActionCode, ReasonCode, string> processDataCallback)
 {
     startIndex += newDataAmount;
     while (true)
     {
         //粘包分包
         if (startIndex <= 4) return;
         int count = BitConverter.ToInt32(data, 0);
         if ((startIndex - 4) >= count)
         {
             ActionCode actionCode = (ActionCode)BitConverter.ToInt32(data, 4);
             ReasonCode reasonCode = (ReasonCode)BitConverter.ToInt32(data, 8);
             string s = Encoding.UTF8.GetString(data, 12, count - 8);
             processDataCallback(actionCode, reasonCode, s);
             Array.Copy(data, count + 4, data, 0, startIndex - 4 - count);
             startIndex -= (count + 4);
         }
         else
         {
             break;
         }
     }
 }
예제 #31
0
        private void button1_Click(object sender, EventArgs e)
        {
            FrmKeyBoard frmKeyBoard = new FrmKeyBoard("");

            if (frmKeyBoard.ShowDialog() == DialogResult.OK)
            {
                if (frmKeyBoard.value != "")
                {
                    foreach (var o in ReasonCodeList)
                    {
                        if (frmKeyBoard.value == o.ToString())
                        {
                            Alert.Show("Ghi chú đã có", Color.Red);
                            return;
                        }
                    }
                    ReasonCode reasonCode = new ReasonCode(frmKeyBoard.value, ReasonCode.KitchenNote);
                    reasonCode.isNew = true;
                    listBox1.Items.Add(reasonCode);
                    ReasonCodeList.Add(reasonCode);
                }
            }
        }
        public RuntimeProperties(ServiceConfigParameters ConfigParameters)
        {
            _ServiceConfigParameters = ConfigParameters;
            //personal
            _Staff_ID = new StaffID();
            _Full_Name = new FullName();
            _Country = new Country();
            _ContractType = new ContractType();
            _ContractTypeForReports = new ContractTypeForReports();
            _Position = new Position();
            _DateOfTREnd = new DateOfTREnd();
            _DateOfTRStart = new DateOfTRStart();
            _DateOfEntrance = new DateOfEntrance();
            _CalendarName = new CalendarName();
            _TemplateFilter = new TemplateFilter();
            _ArePropReadyPersonal = new ArePropReady();
            _BusinessUnitInfo = new BusinessUnitInfo();
            _PMSA = new PMSA();
            _PMSAItem = new PMSAItem();
            _Gender = new Gender();
            _ActivityCodeInfo = new ActivityCodeInfo();
            _OfficialLS = new OfficialLS();
            _PhoneDirOnly = new PhoneDirOnly();
            //update
            _SelectedDate = new SelectedDate();
            _SelectedDateStatus = new SelectedDateStatus();
            _SelectedDateTransactionStatus = new SelectedDateTransactionStatus();
            _SelectedDateType = new SelectedDateType();
            _SelectedDateisOptional = new SelectedDateisOptional();
            _PercentPerDay = new PercentPerDay();
            _SelectedJob = new SelectedJob();
            _MaxHoursDaily = new MaxHoursDaily();
            _ArePropReadyTRUpdate = new ArePropReady();
            _TRInputListClient = new TRInputListClient();
            _LastOpenDay = new LastOpenDay();

            //submit
            _SumOfHours = new SumOfHours();
            _TRInputList = new TRInputList();
            _WorkingHoursWeekly = new WorkingHoursWeekly();
            _MinHoursDaily = new MinHoursDaily();
            _FirstSubmitableDay = new FirstSubmitableDay();
            _SelectedActivityCode = new SelectedActivityCode();
            _Description = new Description();
            _Location = new Location();
            _BusinessUnit = new BusinessUnit();
            _ReasonCode = new ReasonCode();
            _ArePropReadyTRSubmit = new ArePropReady();
            _PeriodEnd = new PeriodEnd();
            //reports

            _PeriodStarting = new PeriodStarting();
            _ArePropReadyReports = new ArePropReady();
            _ReportIntervalFrom = new ReportIntervalFrom();
            _ReportIntervalTo = new ReportIntervalTo();
            _UserIDList = new UserIDList();
            _SelectedReportTemplate = new SelectedReportTemplate();
            _SelectedReportType = new SelectedReportType();

            //külön queryk-ben/Getparameters-ben kap értéket

            _LastSubmittedDay = new LastSubmittedDay();
            _JobCh = new JobCH();
            _InsertedHour = new InstertedHour();
            _ValidationConstraint = new ValidationConstraint();
            _JobFilter = new JobFilter();
            _ActivityCodeFilter = new ActivityCodeFilter();
            _UserGroup = new UserGroup();
            _ReasonCodeFilter = new ReasonCodeFilter();
        }
예제 #33
0
파일: Callbacks.cs 프로젝트: edwinr/VPNet
 public ObjectCallbackData(ReasonCode rc, VPObject vpObject)
 {
     Object = vpObject;
     Reason = rc;
 }
예제 #34
0
 public CompressionException(string text, CompressionException.ReasonCode reason)
     : base(text)
 {
     Reason = reason;
 }
		internal WlanReasonNotificationEventArgs(WlanInternNotificationData data, ReasonCode code)
		{
			Source = data.notificationSource;
			Code = data.NotificationCode;
			ReasonCode = code;
		}
예제 #36
0
파일: Wlan.cs 프로젝트: cssack/CsGlobals
		internal void OnReasonNotification(WlanInternNotificationData notificationdata, ReasonCode reason)
		{
			//var args = new WlanReasonNotificationEventArgs(notificationdata, reason);
		}
예제 #37
0
파일: VPException.cs 프로젝트: edwinr/VPNet
 public VPException(ReasonCode reason)
     : base(string.Format("VP SDK Error: {0} ({1})", reason, (int)reason))
 {
     Reason = reason;
 }