コード例 #1
0
 public DissociateTokenTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #2
0
 public GetFileContentTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #3
0
 public SystemRestoreFileTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #4
0
 public SubscribeTopicTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #5
0
 public CreateNewTxIdTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #6
0
 public GetAddressBookTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #7
0
 public GetNetworkVersionInformationTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #8
0
        public IActionResult SendExpirationStatusEmail()
        {
            if (!_context.ChemicalFamily.Any() || !_context.Users.Any())
            {
                return(BadRequest());
            }

            var todayDateShort  = DateTime.Now.ToShortDateString();
            var todayDate       = DateTime.Parse(todayDateShort);
            var dayOfWeek       = (int)todayDate.DayOfWeek;
            var allChemicals    = _context.Chemicals.ToList();
            var chemicalsExpire = allChemicals
                                  .Where(x => (x.ExpirationDate - todayDate).TotalDays <= 1 || DateTime.Compare(x.ExpirationDate, todayDate) <= 0)
                                  .OrderByDescending(x => x.ExpirationDate)
                                  .ToList();

            //change 30 as needed, maybe by user setting
            var chemicalsSoon = allChemicals
                                .Where(x => (x.ExpirationDate - todayDate).TotalDays >= 2)
                                .Where(x => (x.ExpirationDate - todayDate).TotalDays < 30)
                                .OrderBy(x => x.ExpirationDate)
                                .ToList();

            var users       = _context.Users.Where(x => x.Notifications == true).ToList();
            var emailToList = new List <User>();

            if (chemicalsExpire.Count == 0 && chemicalsSoon.Count == 0)
            {
                return(NoContent());
            }

            foreach (var user in users)
            {
                if (user.Frequency == Enum.GetName(typeof(frequencyOfEmail), frequencyOfEmail.Daily))
                {
                    emailToList.Add(user);
                }
                else if (user.Frequency == Enum.GetName(typeof(frequencyOfEmail), frequencyOfEmail.Weekly))
                {
                    if (dayOfWeek == 1)
                    {
                        emailToList.Add(user);
                    }
                }
                else if (user.Frequency == Enum.GetName(typeof(frequencyOfEmail), frequencyOfEmail.Monthly))
                {
                    if ((dayOfWeek == 1 && todayDate.Day <= 7) || (todayDate.Day == 1 && dayOfWeek <= 5))
                    {
                        emailToList.Add(user);
                    }
                }
            }

            if (emailToList.Count == 0)
            {
                return(NoContent());
            }

            var sbExpired = new StringBuilder();

            if (chemicalsExpire.Count > 0)
            {
                sbExpired.AppendLine("The following are the chemical(s) that are expired or will expire in the next day:<br /><ul>");
                foreach (var chemical in chemicalsExpire)
                {
                    var lineText = "<li> " + chemical.ChemicalName + " with Barcode " + chemical.Barcode.ToString() + " expires on " + chemical.ExpirationDate.ToShortDateString();
                    if (chemical.Location != null && !string.IsNullOrEmpty(chemical.Location))
                    {
                        lineText += " found in " + chemical.Location;
                    }
                    lineText += "</li><br />";
                    sbExpired.AppendLine(lineText);
                }
                sbExpired.Append("</ul><br />");
            }

            var sbSoon = new StringBuilder();

            if (chemicalsSoon.Count > 0)
            {
                sbSoon.AppendLine("The following are the chemical(s) that will expire in the next 2-30 days:<br /><ul>");
                foreach (var chemical in chemicalsSoon)
                {
                    var lineText = "<li>" + chemical.ChemicalName + " (Barcode: " + chemical.Barcode.ToString() + ") expires on " + chemical.ExpirationDate.ToShortDateString();
                    if (chemical.Location != null && !string.IsNullOrEmpty(chemical.Location))
                    {
                        lineText += " found in " + chemical.Location;
                    }
                    lineText += "</li><br />";
                    sbSoon.AppendLine(lineText);
                }
                sbSoon.Append("</ul><br />");
            }

            var emailMessageBody = "This is an automated message regarding chemical expiration status. <br /><br />";

            emailMessageBody += chemicalsExpire.Count > 0 ? sbExpired.ToString() : "";
            emailMessageBody += chemicalsSoon.Count > 0 ? sbSoon.ToString() : "";


            SmtpClient client = new SmtpClient();

            client.Host = "smtp.googlemail.com";
            client.Port = 587;
            client.UseDefaultCredentials = false;
            client.DeliveryMethod        = SmtpDeliveryMethod.Network;
            client.EnableSsl             = true;
            var emailer = new NetworkCredentials();

            client.Credentials = new NetworkCredential(emailer.NetworkUserEmail, emailer.NetworkUserPassword);
            var msg = new MailMessage();

            msg.IsBodyHtml = true;
            msg.From       = new MailAddress(emailer.NetworkUserEmail);
            foreach (var to in emailToList)
            {
                msg.To.Add(new MailAddress(to.Email));
            }
            msg.Subject = "FlowBase Notification: Expiration Status";
            msg.Body    = emailMessageBody;
            client.Send(msg);

            return(Ok(emailToList));
        }
コード例 #9
0
 public DeleteCryptoAccountTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #10
0
 public GetRecordTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #11
0
 public SubmiLargeMessageTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #12
0
 public UnsafeSubmitTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #13
0
 public ContractBytecodeTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #14
0
 public GetFeeScheduleInfoTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #15
0
 public SuspendNetworkTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #16
0
 public TimeDriftTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #17
0
 public AddClaimTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #18
0
        public IActionResult SendReorderEmail()
        {
            if (!_context.ChemicalFamily.Any() || !_context.Users.Any())
            {
                return(BadRequest());
            }

            var todayDateShort = DateTime.Now.ToShortDateString();
            var todayDate      = DateTime.Parse(todayDateShort);
            var dayOfWeek      = (int)todayDate.DayOfWeek;
            var allChemicals   = _context.Chemicals.ToList();

            var users = _context.Users.Where(x => x.Notifications == true).ToList();

            if (users.Count == 0)
            {
                return(NoContent());
            }

            var emailToList = new List <User>();

            foreach (var user in users)
            {
                if (user.Frequency == Enum.GetName(typeof(frequencyOfEmail), frequencyOfEmail.Daily))
                {
                    emailToList.Add(user);
                }
                else if (user.Frequency == Enum.GetName(typeof(frequencyOfEmail), frequencyOfEmail.Weekly))
                {
                    if (dayOfWeek == 1)
                    {
                        emailToList.Add(user);
                    }
                }
                else if (user.Frequency == Enum.GetName(typeof(frequencyOfEmail), frequencyOfEmail.Monthly))
                {
                    if ((dayOfWeek == 1 && todayDate.Day <= 7) || (todayDate.Day == 1 && dayOfWeek <= 5))
                    {
                        emailToList.Add(user);
                    }
                }
            }

            if (emailToList.Count == 0)
            {
                return(NoContent());
            }

            var reorderChemicals = _context.ChemicalFamily.Where(x => x.Quantity <= x.reorderThreshold && x.reorderThreshold != -1).OrderBy(x => x.reorderThreshold).ToList();

            if (reorderChemicals.Count == 0)
            {
                return(NoContent());
            }

            var sbReorder = new StringBuilder();

            if (reorderChemicals.Count > 0)
            {
                sbReorder.AppendLine("The following are the chemical(s) that need to be reordered:<br /><ul>");
                foreach (var chemical in reorderChemicals)
                {
                    var lineText = "<li> " + chemical.ChemicalName + " (Current Quantity: " + chemical.Quantity.ToString() + ") needs an order of " + chemical.ReorderQuantity;
                    lineText += "</li><br />";
                    sbReorder.AppendLine(lineText);
                }
                sbReorder.Append("</ul><br />");
            }

            var emailMessageBody = "This is an automated message regarding chemical reorder status. <br /><br />";

            emailMessageBody += reorderChemicals.Count > 0 ? sbReorder.ToString() : "";

            SmtpClient client = new SmtpClient();

            client.Host = "smtp.googlemail.com";
            client.Port = 587;
            client.UseDefaultCredentials = false;
            client.DeliveryMethod        = SmtpDeliveryMethod.Network;
            client.EnableSsl             = true;
            var emailer = new NetworkCredentials();

            client.Credentials = new NetworkCredential(emailer.NetworkUserEmail, emailer.NetworkUserPassword);
            var msg = new MailMessage();

            msg.IsBodyHtml = true;
            msg.From       = new MailAddress(emailer.NetworkUserEmail);
            foreach (var to in emailToList)
            {
                msg.To.Add(new MailAddress(to.Email));
            }
            msg.Subject = "FlowBase Notification: Reorder Status";
            msg.Body    = emailMessageBody;
            client.Send(msg);

            return(Ok(emailToList));
        }
コード例 #19
0
 public EventEmittingContractTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #20
0
 public GetAssetInfoTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #21
0
 public UpdateAccountTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #22
0
 public GetPendingTransactionInfoTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #23
0
 public TransferTokenTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #24
0
 public ConfiscateAssetTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #25
0
ファイル: SignatureTests.cs プロジェクト: GmausDev/Hashgraph
 public SignatureTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #26
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            NetworkCredentials.Instance().NetworkDomain   = Properties.Settings.Default.networkdomain;
            NetworkCredentials.Instance().NetworkUsername = Properties.Settings.Default.networkusername;
            NetworkCredentials.Instance().NetworkPassord  = Properties.Settings.Default.networkpassword;
            //NetworkFileSystemUtilsProxy p = new NetworkFileSystemUtilsProxy();
            //p.UncFileExist(@"\\DESKTOP-E9KNOCC\ciccio\ciccio.txt");

            //initialize skinning properties
            barManager.ForceInitialize();
            MyBarLocalizer.Active = new MyBarLocalizer();
            SkinHelper.InitSkinPopupMenu(mPaintStyle);


            //initialize navigator
            _navUtil = new NavigationUtils(splitContainerControl.Panel2, this);

            //renders startup controls
            if (_customerId == "")
            {
                _navUtil.NavigateToStartupControl(Properties.Settings.Default.Main_StartCommand);
            }
            else
            {
                try
                {
                    IOpenCommand cmd = new CustomerCommand(this);
                    Hashtable    h   = new Hashtable();
                    h.Add("Id", _customerId);
                    cmd.Execute(h);
                    HistoryOfCommands.Instance().AddCommandToHistory(cmd);
                    MemoryHelper.ReduceMemory();
                }
                catch (Exception ex)
                {
                    ErrorHandler.Show(ex);
                    _navUtil.NavigateToStartupControl(Properties.Settings.Default.Main_StartCommand);
                }
            }

            //sets the caption text
            this.Text = "Gestionale appuntamenti - " + Properties.Settings.Default.Main_AppName;

            //sets the name of the current logged user
            string nome = ((User)(SecurityManager.Instance.CurrentUser)).Username;

            sItem.Caption = string.Format("Benvenuto: {0}!", nome);

            if (DataAccessServices.Instance().PersistenceFacade.DBType == DB.DBType.Access)
            {
                // barRipristina.Visibility = BarItemVisibility.Always;ù
                barButtonbackup.Visibility = BarItemVisibility.Always;
                UpdateLastBackInfo();
                barBack.Visibility = BarItemVisibility.Always;
            }
            else
            {
                //barRipristina.Visibility = BarItemVisibility.Never;
                barButtonbackup.Visibility = BarItemVisibility.Never;
                barBack.Visibility         = BarItemVisibility.Never;
            }



            //sets initial view
            splitContainerControl.Collapsed = Properties.Settings.Default.Main_PanelCollapsed;
            administration.Visible          = !Properties.Settings.Default.Main_ShowOnlyAgendaFunctions;
        }
コード例 #27
0
 public GetAccountBalanceTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #28
0
 public GetExchangeRatesTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #29
0
 public CreateContractTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #30
0
 public DeleteFileTests(NetworkCredentials network, ITestOutputHelper output)
 {
     _network        = network;
     _network.Output = output;
 }
コード例 #31
0
		WebClient GetClient ()
		{
			if (OAuthTokenSecret != null)
				return new WebClient (); 
			return null;
#if false
			// In the future, for connecting to non-OAuth twitter sites
			else 
				return new AuthenticatedWebClient () {
					Credentials = new NetworkCredentials (login, pass);
			}
#endif
		}