Exemplo n.º 1
0
        protected override void NetworkWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            string dataString = e.Result as string;

            //Console.WriteLine(dataString);
            completedEventHandler(this, ExchangeHelper.ToExchangeCode(dataString), Encoding.UTF8.GetBytes(dataString.Substring(4)), passDown);
        }
Exemplo n.º 2
0
        public int SendAppoinments()
        {
            // string[] rooms = ScheduleUpdateController.GetWatchingRooms();

            int        sentCount = 0;
            ITransport transport = TransportFactory.Transport;

            foreach (RoomConfig room in RoomConfigurations.Values)
            {
                try
                {
                    ScheduleData roomSchedule = ExchangeHelper.LoadResouceCallendar(room.Location);
                    if (roomSchedule != null && roomSchedule.Schedule != null)
                    {
                        transport.SendAppointments(roomSchedule, room);
                        sentCount += roomSchedule.Schedule.Length;
                        Console.Out.WriteLine("Sucessfully sent {0} appointments for the room {1}", new object[] { roomSchedule.Schedule.Length, room.Location });
                    }
                    else
                    {
                        Console.Out.WriteLine("Nothing sent for the room {0}", room.Location);
                    }
                }catch (Exception ex)
                {
                    Console.Out.WriteLine(String.Format("Error {0} sending data for room {1}", new object[] { ex.Message, room.Location }));
                }
            }

            return(sentCount);
        }
        static void WriteAppointments(XmlTextWriter xmlWriter)
        {
            string[] rooms = GetWatchingRooms();

            xmlWriter.WriteStartDocument();
            xmlWriter.WriteStartElement("Appointments");
            xmlWriter.WriteElementString("ImportTime", DateTime.Now.ToString());

            isError = false;

            foreach (string room in rooms)
            {
                try
                {
                    data.ScheduleData roomAppointments = ExchangeHelper.LoadResouceCallendar(room);
                    WriteRoomXml(roomAppointments, xmlWriter);
                }
                catch (Exception ex)
                {
                    isError = true; // Set error flag to prevent caching
                    Trace.TraceError("Error writing appointments for room {0} ErrMsg: {1}", room, ex.Message);
                    xmlWriter.WriteStartElement("Error");
                    xmlWriter.WriteAttributeString("Room", room);
                    xmlWriter.WriteStartElement("Message", ex.Message);
                    xmlWriter.WriteStartElement("Trace");
                    xmlWriter.WriteCData(ex.StackTrace);
                    xmlWriter.WriteEndElement();
                    xmlWriter.WriteEndElement();
                }
            }

            xmlWriter.WriteEndElement();
            xmlWriter.WriteEndDocument();
        }
        /// <inheritdoc />
        protected override void Execute(CodeActivityContext context)
        {
            var appointmentData = context.GetValue(Appointment) ?? GetAppointmentFromParameters(context);

            var service = ExchangeHelper.GetService(context.GetValue(OrganizerPassword), context.GetValue(ExchangeUrl), context.GetValue(OrganizerEmail));

            var recurrMeeting = new Appointment(service)
            {
                Subject    = appointmentData.Subject,
                Body       = new MessageBody(appointmentData.IsBodyHtml ? BodyType.HTML : BodyType.Text, appointmentData.Body),
                Start      = appointmentData.StartTime,
                End        = appointmentData.EndTime,
                Location   = appointmentData.Subject,
                Recurrence = appointmentData.Recurrence
            };

            var requiredAttendees = context.GetValue(RequiredAttendees);
            var optionalAttendees = context.GetValue(OptionalAttendees);

            AppointmentHelper.UpdateAttendees(recurrMeeting, requiredAttendees, optionalAttendees);

            // This method results in in a CreateItem call to EWS.
            recurrMeeting.Save(SendInvitationsMode.SendToAllAndSaveCopy);

            context.SetValue(AppointmentId, recurrMeeting.Id);
        }
Exemplo n.º 5
0
        private EmailMessage[] GetMessageInfos(bool pushNotification, string contentListPath)
        {
            var contentList  = Node.LoadNode(contentListPath);
            var mailboxEmail = contentList["ListEmail"] as string;

            if (!pushNotification)
            {
                var service = ExchangeHelper.CreateConnection(mailboxEmail);
                if (service == null)
                {
                    return(new EmailMessage[0]);
                }

                var items = ExchangeHelper.GetItems(service, mailboxEmail);
                var infos = items.Select(item => EmailMessage.Bind(service, item.Id, new PropertySet(BasePropertySet.FirstClassProperties, ItemSchema.Body, ItemSchema.Attachments, ItemSchema.MimeContent)));

                return(infos.ToArray());
            }
            else
            {
                var incomingEmails = SenseNet.Search.ContentQuery.Query(ContentRepository.SafeQueries.InFolder,
                                                                        new Search.QuerySettings {
                    EnableAutofilters = FilterStatus.Disabled
                },
                                                                        RepositoryPath.Combine(contentListPath, ExchangeHelper.PUSHNOTIFICATIONMAILCONTAINER));

                if (incomingEmails.Count == 0)
                {
                    return(new EmailMessage[0]);
                }

                var service = ExchangeHelper.CreateConnection(mailboxEmail);
                if (service == null)
                {
                    return(new EmailMessage[0]);
                }

                var msgs = new List <EmailMessage>();
                foreach (var emailnode in incomingEmails.Nodes)
                {
                    var ids = emailnode["Description"] as string;
                    if (string.IsNullOrEmpty(ids))
                    {
                        continue;
                    }

                    var idList = ids.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

                    foreach (var id in idList)
                    {
                        var msg = EmailMessage.Bind(service, id, new PropertySet(BasePropertySet.FirstClassProperties, ItemSchema.Body, ItemSchema.Attachments, ItemSchema.MimeContent));
                        msgs.Add(msg);
                    }

                    // delete email node
                    emailnode.ForceDelete();
                }
                return(msgs.ToArray());
            }
        }
Exemplo n.º 6
0
        /// <inheritdoc />
        protected override void Execute(CodeActivityContext context)
        {
            // The activity will forward the AppointmentId referecned appointment only to not-responding attendees with ReminderText as a forward
            var service = ExchangeHelper.GetService(context.GetValue(OrganizerPassword), context.GetValue(ExchangeUrl), context.GetValue(OrganizerEmail));

            var appointment = AppointmentHelper.GetAppointmentById(service, context.GetValue(AppointmentId));

            if (appointment == null)
            {
                return;
            }

            var toRemind = new List <EmailAddress>();

            toRemind.AddRange(
                appointment
                .RequiredAttendees
                .Where(x => x.ResponseType == MeetingResponseType.Unknown || x.ResponseType == MeetingResponseType.NoResponseReceived));

            toRemind.AddRange(
                appointment
                .OptionalAttendees
                .Where(x => x.ResponseType == MeetingResponseType.Unknown || x.ResponseType == MeetingResponseType.NoResponseReceived));

            // Remind if any
            if (toRemind.Count > 0)
            {
                appointment.Forward(context.GetValue(ReminderText), toRemind);
            }
        }
Exemplo n.º 7
0
        public bool Start()
        {
            if (Settings.GetValue(MailHelper.MAILPROCESSOR_SETTINGS, MailHelper.SETTINGS_MODE, null, MailProcessingMode.ExchangePull) != MailProcessingMode.ExchangePush)
            {
                return(false);
            }

            // renew subscriptions
            //  1: go through doclibs with email addresses
            var doclibs = ContentQuery.Query("+TypeIs:DocumentLibrary +ListEmail:* -ListEmail:\"\"");

            if (doclibs.Count > 0)
            {
                Logger.WriteInformation(Logger.EventId.NotDefined, String.Concat("Exchange subscription service enabled, running subscriptions (", doclibs.Count.ToString(), " found)"), ExchangeHelper.ExchangeLogCategory);
                foreach (var doclib in doclibs.Nodes)
                {
                    try
                    {
                        ExchangeHelper.Subscribe(doclib);
                    }
                    catch (Exception ex)
                    {
                        Logger.WriteException(ex, ExchangeHelper.ExchangeLogCategory);
                    }
                }
            }
            else
            {
                Logger.WriteInformation(Logger.EventId.NotDefined, "Exchange subscription service enabled, no subscriptions found.", ExchangeHelper.ExchangeLogCategory);
            }

            return(true);
        }
Exemplo n.º 8
0
        public override void Initialize(IUnityContainer container)
        {
            //注册附件交互服务
            var exchange = ExchangeHelper.GetExchange();

            exchange.Register <IAttachmentExchange, AttachmentService>();
            IUnityContainer appContainer = Nefarian.Core.WebServiceSite.GetAppContainer();
        }
        /// <inheritdoc />
        protected override void Execute(CodeActivityContext context)
        {
            var service         = ExchangeHelper.GetService(context.GetValue(OrganizerPassword), context.GetValue(ExchangeUrl), context.GetValue(OrganizerEmail));
            var continueOnError = context.GetValue(ContinueOnError);

            var attendees = AppointmentHelper.ResolveAttendeeNames(service, context.GetValue(AttendeeNames), continueOnError);

            context.SetValue(Attendees, attendees.ToArray());
        }
Exemplo n.º 10
0
        protected override void NetworkWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            byte[] operationBytes = Encoding.UTF8.GetBytes(ExchangeHelper.ToString(operation));
            byte[] beSended       = ByteHelper.LinkBytes(operationBytes, beSendedData);

            byte[] receive    = net.Send(beSended, 10000, tryTimes);
            string originData = receive == null?ExchangeHelper.ToString(ExchangeCode.TIME_OUT) : Encoding.UTF8.GetString(receive);

            e.Result = originData;
        }
Exemplo n.º 11
0
        private void StartSubscription()
        {
            var subscribe = Settings.GetValue <MailProcessingMode>(
                MailHelper.MAILPROCESSOR_SETTINGS,
                MailHelper.SETTINGS_MODE,
                this.Path) == MailProcessingMode.ExchangePush;

            if (subscribe)
            {
                // subscribe to email after saving content. this is done separately from saving the content,
                // since subscriptionid must be persisted on the content and we use cyclic retrials for that
                ExchangeHelper.Subscribe(this);
            }

            var parent = GetMailProcessorWorkflowContainer(this);

            if (parent == null)
            {
                return;
            }

            // get the workflow to start
            var incomingEmailWorkflow = this.GetReference <Node>("IncomingEmailWorkflow");

            if (incomingEmailWorkflow == null)
            {
                return;
            }

            // set this list as the related content
            var workflowC = Content.CreateNew(incomingEmailWorkflow.Name, parent, incomingEmailWorkflow.Name);

            workflowC["RelatedContent"] = this;

            try
            {
                workflowC.Save();
            }
            catch (Exception ex)
            {
                SnLog.WriteException(ex, categories: ExchangeHelper.ExchangeLogCategory);
            }

            // reflection: because we do not have access to the workflow engine here
            var t = TypeResolver.GetType("SenseNet.Workflow.InstanceManager", false);

            if (t == null)
            {
                return;
            }

            var m = t.GetMethod("Start", BindingFlags.Static | BindingFlags.Public);

            m.Invoke(null, new object[] { workflowC.ContentHandler });
        }
        public void LoadAppointentByIdTest()
        {
            var service = ExchangeHelper.GetService(ExchangePass, ExchangeServerUrl, ExchangeLogin);

            DateTime.TryParse("10-Jun-2019", out var start);
            var meeting = AppointmentHelper.GetAppointmentBySubject(service, "Item1", start);

            AppointmentHelper.GetAppointmentById(service, meeting.Id.ToString());

            Assert.AreEqual(1, 1);
        }
        public void LoadAppointentBySubjTest()
        {
            var service = ExchangeHelper.GetService(ExchangePass, ExchangeServerUrl, ExchangeLogin);

            var subj = "Item1";

            DateTime.TryParse("10-Jun-2019", out var start);
            AppointmentHelper.GetAppointmentBySubject(service, subj, start);

            Assert.AreEqual(1, 1);
        }
Exemplo n.º 14
0
        public string WithdrawCash(Transaction transaction)
        {
            var amount = transaction.Amount * ExchangeHelper.CurrencyExchange().GetValueOrDefault(transaction.Currency.ToString());

            if (!CheckBalance(amount))
            {
                return("Withdraw amount exceeds account balance.");
            }

            Account.Balance -= amount;
            return(string.Empty);
        }
Exemplo n.º 15
0
 public Startup(IConfiguration configuration)
 {
     Configuration   = configuration;
     _exchangeHelper = new ExchangeHelper();
     _exchange       = new Exchange(_exchangeHelper);
     _apiConnections = new ApiConnections()
     {
         UriString            = _uriString,
         RequestUriAllRates   = _requestUriAllRates,
         RequestUriSingleRate = _requestUriSingleRate
     };
 }
        public void LoadResponseByIdTest()
        {
            var service = ExchangeHelper.GetService(ExchangePass, ExchangeServerUrl, ExchangeLogin);

            var subj = "Item1";

            DateTime.TryParse("10-Jun-2019", out var start);
            var meeting = AppointmentHelper.GetAppointmentBySubject(service, subj, start);

            AppointmentHelper.GetAttendeesById(service, meeting.Id.ToString(), MeetingAttendeeType.Required);

            Assert.AreEqual(1, 1);
        }
Exemplo n.º 17
0
        /// <inheritdoc />
        protected override void Execute(CodeActivityContext context)
        {
            var service = ExchangeHelper.GetService(
                context.GetValue(OrganizerPassword),
                context.GetValue(ExchangeUrl),
                context.GetValue(OrganizerEmail));

            var id = context.GetValue(AppointmentId);

            var meeting = Appointment.Bind(service, new ItemId(id), new PropertySet(AppointmentSchema.Recurrence));

            meeting.Delete(DeleteMode.MoveToDeletedItems, SendCancellationsMode.SendToAllAndSaveCopy);
        }
Exemplo n.º 18
0
 public CashEntry(int batch, DeclarationFilterBy filterBy, string filterValue, string SiteCode, int CurrentIndex,IList<UndeclaredCollectionRecord> Collections)
     : this()
 {
     _objCollectionHelper = new CollectionHelper();
     _objExchangeHelper = new ExchangeHelper();
     _objTicketsHelper = new TicketsHelper();
     oDeclarationBiz = new DeclarationBiz();
     txtSiteInfo.Text = Application.Current.FindResource("ManualCashEntry_xaml_lblSiteCode").ToString().Trim() + " " + SiteCode;
     _IsPartCollection = (batch == 0) ? true : false;
     bEnableDefaultZero = Settings.ManualCashEntryEnableZero;
     this.Initialize(batch, filterBy, filterValue, CurrentIndex, Collections);
     cmbPosition.Focus();
 }
 public BillsTicketCounter()
 {
     InitializeComponent();
     MessageBox.childOwner = this;
     btnExceptionTickets.Visibility = (Settings.HANDLE_EXCEPTIONTICKETS_COUNTER) ? Visibility.Visible : Visibility.Collapsed;
     if (!String.IsNullOrEmpty(ManualCashEntry.sSiteCode))
     {
         txtHeader.Text += "\t\t\t\t" + Application.Current.FindResource("ManualCashEntry_xaml_lblSiteCode").ToString().Trim() + " " + ManualCashEntry.sSiteCode;
     }
     _objCollectionHelper = new CollectionHelper();
     _objExchangeHelper = new ExchangeHelper();
     _objTicketsHelper = new TicketsHelper();
 }
        public void ResolveNamesTest()
        {
            var service = ExchangeHelper.GetService(ExchangePass, ExchangeServerUrl, ExchangeLogin);

            string[] testNames = { "Obfuscated attendee1", "Obfuscated attendee2" };

            var attendees = AppointmentHelper.ResolveAttendeeNames(service, testNames, true);

            foreach (var item in attendees)
            {
                Console.WriteLine(item.Name + "::" + item.Address);
            }
        }
        public void LoadAppointmentsTest()
        {
            var service = ExchangeHelper.GetService(ExchangePass, ExchangeServerUrl, ExchangeLogin);

            DateTime.TryParse("10-Jun-2019", out var start);
            var meeting = AppointmentHelper.GetAppointmentBySubject(service, "Item1", start);

            var appointments = AppointmentHelper.GetAppointmentsById(service, meeting.Id.ToString());

            foreach (var item in appointments)
            {
                Console.WriteLine(item.AppointmentType.ToString());
            }
        }
Exemplo n.º 22
0
        private EmailMessage GetMessageInfo(string itemId, string email)
        {
            var service = ExchangeHelper.CreateConnection(email);

            if (service == null)
            {
                return(null);
            }

            var item    = ExchangeHelper.GetItem(service, itemId);
            var message = EmailMessage.Bind(service, item.Id, new PropertySet(BasePropertySet.FirstClassProperties, ItemSchema.Body, ItemSchema.Attachments, ItemSchema.MimeContent));

            return(message);
        }
        private void StartSubscription()
        {
            if (Exchange.Configuration.SubscribeToPushNotifications)
            {
                // subscribe to email after saving content. this is done separately from saving the content,
                // since subscriptionid must be persisted on the content and we use cyclic retrials for that
                ExchangeHelper.Subscribe(this.ContextNode);
            }

            var contextNode = this.ContextNode;
            var parent      = GetParent(contextNode);

            if (parent == null)
            {
                return;
            }

            // start workflow
            var incomingEmailWorkflow = contextNode.GetReference <Node>("IncomingEmailWorkflow");

            if (incomingEmailWorkflow == null)
            {
                return;
            }

            var workflowC = Content.CreateNew(incomingEmailWorkflow.Name, parent, incomingEmailWorkflow.Name);

            workflowC["RelatedContent"] = contextNode;

            using (new SystemAccount())
            {
                try
                {
                    workflowC.Save();
                }
                catch (Exception ex)
                {
                    Logger.WriteException(ex, ExchangeHelper.ExchangeLogCategory);
                }
            }

            var t = TypeHandler.GetType("SenseNet.Workflow.InstanceManager");

            if (t != null)
            {
                var m = t.GetMethod("Start", BindingFlags.Static | BindingFlags.Public);
                m.Invoke(null, new object[] { workflowC.ContentHandler });
            }
        }
Exemplo n.º 24
0
        private void InitializeFields()
        {
            importHeaders = new Dictionary <int, string> ();
            // Insert an empty mapping for properties that will not be mapped
            importHeaders.Add(-1, string.Empty);
            foreach (string header in importer.GetDataHeaders(file))
            {
                importHeaders.Add(importHeaders.Count - 1, header);
            }

            foreach (ImportProperty prop in ExchangeHelper.GetExchangeInfo <ImportProperty> (typeof(T)))
            {
                AppendProperty(prop);
            }
        }
Exemplo n.º 25
0
 public ExchangeController(IExchange exchange,
                           Dictionary <string, int> codesForExchangeRates,
                           ExchangeDbEntities context,
                           IConversionDao conversionDao,
                           ICurrencyDao currencyDao,
                           ApiConnections apiConnections,
                           ExchangeHelper exchangeHelper)
 {
     _exchange = exchange;
     _codesForExchangeRates = codesForExchangeRates;
     _context        = context;
     _conversionDao  = conversionDao;
     _currencyDao    = currencyDao;
     _apiConnections = apiConnections;
     _exchangeHelper = exchangeHelper;
 }
        /// <inheritdoc />
        protected override void Execute(CodeActivityContext context)
        {
            var service = ExchangeHelper.GetService(
                context.GetValue(OrganizerPassword),
                context.GetValue(ExchangeUrl),
                context.GetValue(OrganizerEmail));

            // GetMaster Item
            // Bind to all RequiredAttendees.
            var meeting = Appointment.Bind(service, new ItemId(context.GetValue(AppointmentId)), AppointmentHelper.GetAttendeesPropertySet());

            AppointmentHelper.UpdateAttendees(meeting, context.GetValue(RequiredAttendees), context.GetValue(OptionalAttendees));

            // Save and Send Updates
            meeting.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendOnlyToChanged);
        }
Exemplo n.º 27
0
        private static void ImportData <T> (ImporterCallback <T> callback, bool usesLocation)
        {
            IDataImporter importer;
            string        filename;
            long?         locationId;

            BusinessDomain.FeedbackProvider.TrackEvent("Import data", typeof(T).Name.CamelSpace());

            using (ImportObjects <T> dialog = new ImportObjects <T> (usesLocation)) {
                if (dialog.Run() != ResponseType.Ok)
                {
                    return;
                }

                importer   = dialog.Importer;
                filename   = dialog.FileName;
                locationId = dialog.Location != null ? dialog.Location.Id : (long?)null;
            }

            if (importer.UsesFile && !File.Exists(filename))
            {
                MessageError.ShowDialog(Translator.GetString("Please select a valid source file to import!"));
                return;
            }

            try {
                PropertyMap propertyMap;
                using (ImportObjectsMapping <T> dialog = new ImportObjectsMapping <T> (importer, filename)) {
                    if (dialog.Run() != ResponseType.Ok)
                    {
                        return;
                    }

                    propertyMap = dialog.PropertyMap;
                }

                ExchangeHelper.ImportObjects(importer, filename, propertyMap, locationId, callback);
                MessageError.ShowDialog(Translator.GetString("Import completed successfully."), ErrorSeverity.Information);
            } catch (LicenseLimitationException ex) {
                MessageError.ShowDialog(ex.Message, ErrorSeverity.Warning, ex);
            } catch (IOException ex) {
                MessageError.ShowDialog(Translator.GetString("The selected source file is in use by another application! Please close all other applications and try again."), ErrorSeverity.Warning, ex);
            } catch (Exception ex) {
                MessageError.ShowDialog(Translator.GetString("Error occurred while performing import."), ErrorSeverity.Warning, ex);
            }
        }
Exemplo n.º 28
0
        private static void StartSubscription(ContentList list)
        {
            var subscribe = Settings.GetValue <MailProcessingMode>(
                MailHelper.MAILPROCESSOR_SETTINGS,
                MailHelper.SETTINGS_MODE,
                list.Path) == MailProcessingMode.ExchangePush;

            if (subscribe)
            {
                // subscribe to email after saving content. this is done separately from saving the content,
                // since subscriptionid must be persisted on the content and we use cyclic retrials for that
                ExchangeHelper.Subscribe(list);
            }

            var parent = GetMailProcessorWorkflowContainer(list);

            if (parent == null)
            {
                return;
            }

            // get the workflow to start
            var incomingEmailWorkflow = list.GetReference <Node>("IncomingEmailWorkflow");

            if (incomingEmailWorkflow == null)
            {
                return;
            }

            // set the list as the related content
            var workflowC = Content.CreateNew(incomingEmailWorkflow.Name, parent, incomingEmailWorkflow.Name);

            workflowC["RelatedContent"] = list;

            try
            {
                workflowC.Save();

                InstanceManager.Start(workflowC.ContentHandler as WorkflowHandlerBase);
            }
            catch (Exception ex)
            {
                SnLog.WriteException(ex, categories: ExchangeHelper.ExchangeLogCategory);
            }
        }
 private bool InitializeHelpers()
 {
     if (exchangeHelper == null)
     {
         exchangeHelper = new ExchangeHelper(userMail, password);
     }
     if (crmHelper == null)
     {
         crmHelper = new CrmHelper(crmUser, crmPass, crmUri);
     }
     if (exchangeHelper != null && crmHelper != null)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 30
0
        /// <inheritdoc />
        protected override void Execute(CodeActivityContext context)
        {
            var service = ExchangeHelper.GetService(context.GetValue(OrganizerPassword), context.GetValue(ExchangeUrl), context.GetValue(OrganizerEmail));

            var start = context.GetValue(AppointmentDateFrom);
            var appointmentSubject = context.GetValue(AppointmentSubject);

            var amount = context.GetValue(Amount);

            var itemView = new ItemView(amount)
            {
                PropertySet = new PropertySet(
                    ItemSchema.Subject,
                    AppointmentSchema.Start,
                    ItemSchema.DisplayTo,
                    AppointmentSchema.AppointmentType,
                    ItemSchema.DateTimeSent)
            };

            // Find appointments by subject.
            var substrFilter = new SearchFilter.ContainsSubstring(ItemSchema.Subject, appointmentSubject);
            var startFilter  = new SearchFilter.IsGreaterThanOrEqualTo(AppointmentSchema.Start, start);

            var filterList = new List <SearchFilter>
            {
                substrFilter,
                startFilter
            };

            var calendarFilter = new SearchFilter.SearchFilterCollection(LogicalOperator.And, filterList);

            var results = service.FindItems(WellKnownFolderName.SentItems, calendarFilter, itemView);

            var history = results.Select(item => new NotifyHistory
            {
                Subject = item.Subject,
                SentOn  = item.DateTimeSent,
                SentTo  = item.DisplayTo
            }).ToArray();

            context.SetValue(SentNotificationsHistory, history);
        }
Exemplo n.º 31
0
        private bool ValidateMappings()
        {
            foreach (ImportProperty property in exchangeProps)
            {
                property.MappedColumn = (int)property.Combo.GetSelectedValue();
                if (!property.IsRequired || property.MappedColumn >= 0)
                {
                    continue;
                }

                MessageError.ShowDialog(
                    string.Format(Translator.GetString("The property \"{0}\" is required and must have a valid mapping before the import process can begin!"), property.Name),
                    ErrorSeverity.Error);

                return(false);
            }

            propertyMap = ExchangeHelper.GeneratePropertyMap(exchangeProps);
            return(true);
        }
        /// <inheritdoc />
        protected override void Execute(CodeActivityContext context)
        {
            var service = ExchangeHelper.GetService(context.GetValue(OrganizerPassword), context.GetValue(ExchangeUrl), context.GetValue(OrganizerEmail));

            Appointment meeting;

            var id = context.GetValue(AppointmentId);

            if (string.IsNullOrEmpty(id))
            {
                var start = DateTime.Parse(context.GetValue(AppointmentDate));
                meeting = AppointmentHelper.GetAppointmentBySubject(service, context.GetValue(Subject), start);
            }
            else
            {
                meeting = AppointmentHelper.GetAppointmentById(service, id);
            }

            context.SetValue(FoundAppointment, meeting);
        }
 public BillsTicketCounter(string ExchangeConn, string TicketingConn)
     : this()
 {
     LogManager.WriteLog("BillsTicketCounter:BillsTicketCounter() Entry", LogManager.enumLogLevel.Info);
     LogManager.WriteLog("BillsTicketCounter:BillsTicketCounter() Site Code : " + ManualCashEntry.sSiteCode, LogManager.enumLogLevel.Debug);
     ExchangeConnectionString = ExchangeConn;
     TicketingConnectionString = TicketingConn;
     _objCollectionHelper = new CollectionHelper(ExchangeConn);
     _objExchangeHelper = new ExchangeHelper(ExchangeConn);
     _objTicketsHelper = new TicketsHelper(TicketingConn);
     LogManager.WriteLog("BillsTicketCounter:BillsTicketCounter() Exit", LogManager.enumLogLevel.Info);
 }
        public BillsTicketCounter(int batch, DeclarationFilterBy filterBy, string filterValue, string SiteCode, string ExchangeConn, string TicketingConn, int CollectionIndex)
            : this(batch, filterBy, filterValue, SiteCode, CollectionIndex)
        {
            LogManager.WriteLog("BillsTicketCounter:BillsTicketCounter() Entry", LogManager.enumLogLevel.Info);
            LogManager.WriteLog("BillsTicketCounter:BillsTicketCounter() Site Code : " + SiteCode, LogManager.enumLogLevel.Debug);
            ExchangeConnectionString = ExchangeConn;
            TicketingConnectionString = TicketingConn;
            _objCollectionHelper = new CollectionHelper(ExchangeConn);
            _objExchangeHelper = new ExchangeHelper(ExchangeConn);
            _objTicketsHelper = new TicketsHelper(TicketingConn);
            _CurrentCollectionIndex = CollectionIndex;
            RefreshData(_CurrentCollectionIndex);
            LogManager.WriteLog("BillsTicketCounter:BillsTicketCounter() Exit", LogManager.enumLogLevel.Info);


        }
        public BillsTicketCounter(int batch, DeclarationFilterBy filterBy, string filterValue, string SiteCode, int CurrentIndex)
        {
            InitializeComponent();
            LogManager.WriteLog("BillsTicketCounter:BillsTicketCounter() Entry", LogManager.enumLogLevel.Info);
            LogManager.WriteLog("BillsTicketCounter:BillsTicketCounter() Site Code : "+SiteCode, LogManager.enumLogLevel.Debug);
            try
            {
                _CurrentCollectionIndex = CurrentIndex;
                //CollectionHelper _collectionHelper = new CollectionHelper();
                this._filterBy = filterBy;
                this._filterValue = filterValue;
                this._batchNo = batch;
                this._SiteCode = SiteCode;
                _objCollectionHelper = new CollectionHelper();
                _objExchangeHelper = new ExchangeHelper();
                _objTicketsHelper = new TicketsHelper();
                btnExceptionTickets.Visibility = (Settings.HANDLE_EXCEPTIONTICKETS_COUNTER) ? Visibility.Visible : Visibility.Collapsed;
                RefreshData(_CurrentCollectionIndex);

                //this.txtAsset.Text = lstCollections[1].AssetNo;
                //this.txtPosition.Text = lstCollections[1].Position;
                //this.iCollectionNo = lstCollections[1].CollectionNo;
                //_CollectionNo = lstCollections[1].CollectionNo;
                //this.sPosition = lstCollections[1].Position;
                //this.txtGame.Text = "";

                MessageBox.childOwner = this;

                if (!String.IsNullOrEmpty(ManualCashEntry.sSiteCode))
                {
                    txtHeader.Text += "\t\t\t\t" + Application.Current.FindResource("ManualCashEntry_xaml_lblSiteCode").ToString().Trim() + " " + _SiteCode;
                }
                bool IsCounterEnabled = _objCollectionHelper.IsNoteCounterVisible();
                if (!IsCounterEnabled)
                {
                    btnApply.Visibility = Visibility.Hidden;
                    btnStart.Visibility = Visibility.Hidden;
                    btnClearAll.Visibility = Visibility.Hidden;
                }

            }
            catch (Exception Ex)
            {
                ExceptionManager.Publish(Ex);
            }
            LogManager.WriteLog("BillsTicketCounter:BillsTicketCounter() Exit", LogManager.enumLogLevel.Info);

        }