Exemple #1
0
        public static async Task InitializeAsync(string tenant, LoginView meta)
        {
            await DayEnd.InitializeAsync(tenant, meta.UserId, meta.OfficeId).ConfigureAwait(true);

            RevokeLogins(tenant, meta.UserId);
            await SendNotificationAsync(tenant, meta).ConfigureAwait(false);
        }
Exemple #2
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            // Create the tracing service
            ITracingService tracingService = executionContext.GetExtension <ITracingService>();

            if (tracingService == null)
            {
                throw new InvalidPluginExecutionException("Failed to retrieve tracing service.");
            }

            tracingService.Trace("Entered AppointmentGenerator.Execute(), Activity Instance Id: {0}, Workflow Instance Id: {1}",
                                 executionContext.ActivityInstanceId,
                                 executionContext.WorkflowInstanceId);

            // Create the context
            IWorkflowContext context = executionContext.GetExtension <IWorkflowContext>();

            if (context == null)
            {
                throw new InvalidPluginExecutionException("Failed to retrieve workflow context.");
            }

            tracingService.Trace("AppointmentGenerator.Execute(), Correlation Id: {0}, Initiating User: {1}",
                                 context.CorrelationId,
                                 context.InitiatingUserId);

            IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>();
            IOrganizationService        service        = serviceFactory.CreateOrganizationService(context.UserId);

            try
            {
                tracingService.Trace("Start : {0}, End : {1} , Doctor : {2} - ", DayStart.Get <DateTime>(executionContext),
                                     DayEnd.Get <DateTime>(executionContext), context.PrimaryEntityId, context.PrimaryEntityName);

                int appointments = GenerateAppointments(DayStart.Get <DateTime>(executionContext),
                                                        DayEnd.Get <DateTime>(executionContext), new EntityReference(context.PrimaryEntityName, context.PrimaryEntityId),
                                                        service, tracingService);

                TotalAppointments.Set(executionContext, appointments);
            }
            catch (FaultException <OrganizationServiceFault> e)
            {
                tracingService.Trace("Exception: {0}", e.ToString());

                throw;
            }

            tracingService.Trace("Exiting AppointmentGenerator.Execute(), Correlation Id: {0}", context.CorrelationId);
        }
        public async Task <ActionResult> InitializeAsync()
        {
            var meta = await AppUsers.GetCurrentAsync().ConfigureAwait(true);

            string tenant = this.Tenant;

            try
            {
                await DayEnd.InitializeAsync(tenant, meta.UserId, meta.OfficeId).ConfigureAwait(true);

                EodProcessing.RevokeLogins(tenant, meta.UserId);

                return(this.Ok());
            }
            catch (Exception ex)
            {
                return(this.Failed(ex.Message, HttpStatusCode.InternalServerError));
            }
        }
        public byte[] GetInfoData()
        {
            PangyaBinaryWriter result;

            result = new PangyaBinaryWriter();
            result.WriteByte(Compare.IfCompare <Byte>(Types <= 0, 0x2, Types));
            result.WriteUInt32(TypeID);
            result.WriteUInt32(Index);
            result.WriteUInt32(Compare.IfCompare <UInt32>(DayEnd > DateTime.Now, 1, 0));
            // ## if the item has a period time
            if ((DayEnd > DateTime.Now))
            {
                result.WriteUInt32((uint)DayStart.UnixTimeConvert());
                result.WriteUInt32((uint)DayEnd.UnixTimeConvert());
                result.WriteUInt32((uint)(DayEnd - DayStart).TotalDays);
            }
            else
            {
                result.WriteUInt32(PreviousQuan);
                result.WriteUInt32(NewQuan);
                result.WriteUInt32(NewQuan - PreviousQuan);
            }
            if ((Types == 0xC9))
            {
                result.WriteUInt16(C0_SLOT);
                result.WriteUInt16(C1_SLOT);
                result.WriteUInt16(C2_SLOT);
                result.WriteUInt16(C3_SLOT);
                result.WriteUInt16(C4_SLOT);
            }
            else if ((DayEnd > DayStart))
            {
                result.WriteZero(0x8);
                result.WriteUInt16((ushort)(DayEnd - DayStart).TotalDays);
            }
            else
            {
                result.WriteZero(0xA);
            }
            result.WriteUInt16((ushort)UCC.Length);
            result.WriteStr(UCC, 0x8);
            if (UCC.Length >= 8)
            {
                result.WriteUInt32(UCCStatus);
                result.WriteUInt16(UCCCopyCount);
                result.WriteZero(0x7);
            }
            else if ((Types == 0xCB))
            {
                result.WriteUInt32(CardTypeID);
                result.WriteByte(CharSlot);
            }
            else if ((Types == 0xCC))
            {
                result.WriteUInt32(0);
                result.WriteByte(0);
                result.WriteUInt16(C0_SLOT);
                result.WriteUInt16(C1_SLOT);
                result.WriteUInt16(C2_SLOT);
                result.WriteUInt16(C3_SLOT);
                result.WriteUInt16(C4_SLOT);
                result.WriteUInt32(ClubPoint);
                result.WriteByte(Compare.IfCompare <Byte>(WorkshopCount > 0, 0, 0xFF));
                result.WriteUInt32(WorkshopCount);
                result.WriteUInt32(CancelledCount);
            }
            else
            {
                result.WriteUInt32(0);
                result.WriteByte(0);
            }
            return(result.GetBytes());
        }