예제 #1
0
        private void displayCompanyList()
        {
            try
            {
                lvOfCompanies.Items.Clear();
                companyList = CompanyDB.GetInvoicesDue();

                if (companyList.Count > 0)
                {
                    Company company;
                    for (int i = 0; i < companyList.Count; i++)
                    {
                        company = companyList[i];
                        lvOfCompanies.Items.Add(company.CompanyId);
                        lvOfCompanies.Items[i].SubItems.Add(company.CompanyName);
                        lvOfCompanies.Items[i].SubItems.Add(company.CompanyVolatility);
                        lvOfCompanies.Items[i].SubItems.Add(company.CategoryVolatility);
                        lvOfCompanies.Items[i].SubItems.Add(company.Curprice);
                    }
                }
                lvOfCompanies.Refresh();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.GetType().ToString());
                this.Close();
            }
        }
예제 #2
0
        private void refreshCompanyList()
        {
            if (companyList.Count > 0)
            {
                for (int i = 0; i < companyList.Count; i++)
                {
                    companyList.RemoveAt(i);
                }
            }

            try
            {
                companyList = CompanyDB.GetInvoicesDue();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.GetType().ToString());
                this.Close();
            }
        }
예제 #3
0
        private void makeUpdate()
        {
            Company company;


            double priceUpdate   = 0;
            double categoryIndex = 0;
            double varationPercentage;

            for (int i = 0; i < companyList.Count; i++)
            {
                company = companyList[i];



                ////////////////////////////////////////////////////////////////////////Category Velotility
                if (company.CategoryVolatility == "1")
                {
                    categoryIndex = trends[rnd.Next(4), rnd.Next(5)];
                }
                else if (company.CategoryVolatility == "2")
                {
                    categoryIndex = trends[rnd.Next(4), rnd.Next(5)];
                }
                else if (company.CategoryVolatility == "3")
                {
                    categoryIndex = trends[rnd.Next(4), rnd.Next(5)];
                }
                else if (company.CategoryVolatility == "4")
                {
                    categoryIndex = trends[rnd.Next(4), rnd.Next(5)];
                }
                else
                {
                    categoryIndex = trends[rnd.Next(4), rnd.Next(5)];
                }

                varationPercentage = varation.Next(-20, 150);


                priceUpdate = ((Int32.Parse(company.CategoryVolatility) * categoryIndex) + (Int32.Parse(company.CategoryVolatility) * (varationPercentage) / 100));


                company.Curprice = ((float.Parse(company.Curprice) + priceUpdate)).ToString();



                if (float.Parse(company.Curprice) < 0)
                {
                    //company.Curprice = "0.99";
                    company.Curprice = companyVelotility[rnd.Next(5)].ToString();
                }



                CompanyDB.UpdateCompanyPrice(company);
                System.Threading.Thread.Sleep(DELAY_BETWEEN_RECORDS);
                CompanyDB.InsertIntoHistory(company);
                System.Threading.Thread.Sleep(DELAY_BETWEEN_RECORDS);
            }
        }