Ejemplo n.º 1
0
 protected void rdbMultiple_CheckedChanged(object sender, EventArgs e)
 {
     if (ViewState["MS"].ToString() == "N")
     {
         TxtAMTCOLL.Text    = FDR.GetCurrentBalance("X_" + Session["MID"].ToString(), "Y").ToString();
         TxtDiff.Text       = TxtAMTCOLL.Text;
         TxtDepoAmt.Enabled = true;
         ClearFD();
         string DD;
         DD = FDR.GetDUEDATE(ViewState["FDTP"].ToString(), Session["BRCD"].ToString(), "DUED", ViewState["ACC"].ToString(), ViewState["CT"].ToString());
         if (DD != null)
         {
             dtDeposDate.Text = DD.ToString();
         }
         TxtDepoAmt.Text    = "0";
         ViewState["CTYPE"] = "M";
     }
     else
     {
         TxtAMTCOLL.Text    = FDR.GetCurrentBalance("X_" + Session["MID"].ToString(), "Y").ToString();
         TxtDiff.Text       = TxtAMTCOLL.Text;
         TxtDepoAmt.Enabled = true;
         ClearFD();
         string DD;
         TxtDepoAmt.Text    = "0";
         ViewState["CTYPE"] = "M";
         TxtProcode.Focus();
     }
 }
        /**
         * This routine simply tests for robustness of the toString function.
         *
         * @param xdd
         */
        private static void WriteRepeatedSqrt(DD xdd)
        {
            int count = 0;

            while (xdd.ToDoubleValue() > 1e-300)
            {
                count++;
                //if (count == 100)
                //    count = count;
                double x     = xdd.ToDoubleValue();
                DD     xSqrt = xdd.Sqrt();
                String s     = xSqrt.ToString();
//			System.out.println(count + ": " + s);

                DD     xSqrt2 = DD.Parse(s);
                DD     xx     = xSqrt2.Multiply(xSqrt2);
                double err    = Math.Abs(xx.ToDoubleValue() - x);
                //assertTrue(err < 1e-10);

                xdd = xSqrt;

                // square roots converge on 1 - stop when very close
                DD     distFrom1DD = xSqrt.Subtract(DD.ValueOf(1.0));
                double distFrom1   = distFrom1DD.ToDoubleValue();
                if (Math.Abs(distFrom1) < 1.0e-40)
                {
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            DD dd = new DD()
            {
                Latitude  = -45.6456,
                Longitude = 23.3545
            };

            Console.WriteLine("原始数据: " + dd.ToString());
            var dms = GeographyConvert.DD2DMS(dd);

            Console.WriteLine("1.DD2DMS: " + dms.ToString());
            dd = GeographyConvert.DMS2DD(dms);
            Console.WriteLine("2.DMS2DD: " + dd.ToString());
            var utm = GeographyConvert.DD2UTM(dd);

            Console.WriteLine("3.DD2UTM: " + utm.ToString());
            dd = GeographyConvert.UTM2DD(utm);
            Console.WriteLine("4.UTM2DD: " + dd.ToString());
            var mgrs = GeographyConvert.DD2MGRS(dd);

            Console.WriteLine("5.DD2MGRS: " + mgrs.ToString());
            dd = GeographyConvert.MGRS2DD(mgrs);
            Console.WriteLine("6.MGRS2DD: " + dd.ToString());



            //var utm2 = new UTM()
            //{
            //    ZoneLat = "V",
            //    ZoneLong = 35,
            //    Easting = 414668,
            //    Northing = 6812844
            //};
            //Console.WriteLine("原始数据: " + utm2.ToString());
            //var dd2 = GeographyConvert.UTM2DD(utm2);
            //Console.WriteLine("1.UTM2DD: " + dd2.ToString());
            //var mgrs2 = GeographyConvert.DD2MGRS(dd2);
            //Console.WriteLine("2.DD2MGRS: " + mgrs2.ToString());
            //dd2 = GeographyConvert.MGRS2DD(mgrs2);
            //Console.WriteLine("3.MGRS2DD: " + dd2.ToString());


            Console.ReadKey();
        }
Ejemplo n.º 4
0
 public void Validar()
 {
     AddNotifications(new Contract()
                      .Requires()
                      .HasMaxLen(DD?.ToString(), 2, "Cliente.Telefone", "o Campo DD nao pode ter mais que 2 caracteres")
                      .IsNotNullOrEmpty(DD?.ToString(), "Cliente.Telefone", "O campo DD nao pode estar vazio")
                      .HasMaxLen(NumeroFone?.ToString(), 10, "Cliente.Telefone", "O campo NumeroFone nao pode ter mais que 10 caracteres")
                      .IsNotNullOrEmpty(NumeroFone?.ToString(), "CLiente.Telefone", "O campo NumeroFone nao pode estar vazio"));
 }
        /// <summary>
        /// Tests that printing values with many decimal places works.
        /// This tests the correctness and robustness of both output and input.
        /// </summary>
        static void WriteAndReadSqrt(double x)
        {
            DD     xdd   = DD.ValueOf(x);
            DD     xSqrt = xdd.Sqrt();
            String s     = xSqrt.ToString();
//		System.out.println(s);

            DD     xSqrt2 = DD.Parse(s);
            DD     xx     = xSqrt2 * xSqrt2;
            String xxStr  = xx.ToString();
//		System.out.println("==>  " + xxStr);

            DD     xx2 = DD.Parse(xxStr);
            double err = Math.Abs(xx2.ToDoubleValue() - x);

            Assert.IsTrue(err < 1e-10);
        }
Ejemplo n.º 6
0
        private static void writeOutputTxt(string[,] student, double[] studentAvg, string[] studentLetterGrade)
        {
            string path = @"output.txt";                                                     // We specify the path of the file that we will read.

            FileStream   fs = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write); // Created a file stream object.
            StreamWriter sw = new StreamWriter(fs);                                          // Created a StreamWriter object for reading.

            // Results will be printed to file and console.

            for (int i = 0; i < numberOfStudents; i++) // Will return as many as the number of students
            {
                sw.WriteLine(student[i, 0] + " " + student[i, 1] + " " + student[i, 2] + " - Student Average: " + studentAvg[i] + " - Letter Grade: " + studentLetterGrade[i]);
                Console.WriteLine(student[i, 0] + " " + student[i, 1] + " " + student[i, 2] + " - Student Average: " + studentAvg[i] + " - Letter Grade: " + studentLetterGrade[i]);
            }

            sw.WriteLine("\n- LETTER GRADE STATUS OF THE CLASS -");
            sw.WriteLine("AA: " + AA.ToString() + " Person - " + Convert.ToInt32((AA * 100) / numberOfStudents) + "% OF THE CLASS");
            sw.WriteLine("BA: " + BA.ToString() + " Person - " + Convert.ToInt32((BA * 100) / numberOfStudents) + "% OF THE CLASS");
            sw.WriteLine("BB: " + BB.ToString() + " Person - " + Convert.ToInt32((BB * 100) / numberOfStudents) + "% OF THE CLASS");
            sw.WriteLine("CB: " + CB.ToString() + " Person - " + Convert.ToInt32((CB * 100) / numberOfStudents) + "% OF THE CLASS");
            sw.WriteLine("CC: " + CC.ToString() + " Person - " + Convert.ToInt32((CC * 100) / numberOfStudents) + "% OF THE CLASS");
            sw.WriteLine("DC: " + DC.ToString() + " Person - " + Convert.ToInt32((DC * 100) / numberOfStudents) + "% OF THE CLASS");
            sw.WriteLine("DD: " + DD.ToString() + " Person - " + Convert.ToInt32((DD * 100) / numberOfStudents) + "% OF THE CLASS");
            sw.WriteLine("FD: " + FD.ToString() + " Person - " + Convert.ToInt32((FD * 100) / numberOfStudents) + "% OF THE CLASS");
            sw.WriteLine("FF: " + FF.ToString() + " Person - " + Convert.ToInt32((FF * 100) / numberOfStudents) + "% OF THE CLASS");

            Console.WriteLine("\n- LETTER GRADE STATUS OF THE CLASS -");
            Console.WriteLine("AA: " + AA.ToString() + " Person - " + Convert.ToInt32((AA * 100) / numberOfStudents) + "% OF THE CLASS");
            Console.WriteLine("BA: " + BA.ToString() + " Person - " + Convert.ToInt32((BA * 100) / numberOfStudents) + "% OF THE CLASS");
            Console.WriteLine("BB: " + BB.ToString() + " Person - " + Convert.ToInt32((BB * 100) / numberOfStudents) + "% OF THE CLASS");
            Console.WriteLine("CB: " + CB.ToString() + " Person - " + Convert.ToInt32((CB * 100) / numberOfStudents) + "% OF THE CLASS");
            Console.WriteLine("CC: " + CC.ToString() + " Person - " + Convert.ToInt32((CC * 100) / numberOfStudents) + "% OF THE CLASS");
            Console.WriteLine("DC: " + DC.ToString() + " Person - " + Convert.ToInt32((DC * 100) / numberOfStudents) + "% OF THE CLASS");
            Console.WriteLine("DD: " + DD.ToString() + " Person - " + Convert.ToInt32((DD * 100) / numberOfStudents) + "% OF THE CLASS");
            Console.WriteLine("FD: " + FD.ToString() + " Person - " + Convert.ToInt32((FD * 100) / numberOfStudents) + "% OF THE CLASS");
            Console.WriteLine("FF: " + FF.ToString() + " Person - " + Convert.ToInt32((FF * 100) / numberOfStudents) + "% OF THE CLASS");


            sw.Flush(); // txt created

            sw.Close(); // Close file
            fs.Close();
        }
        public void Ejercicio2_4()
        {
            //Sentence:
            //Escribir un programa en  C# que calcule sueldo bruto (SB), sueldo neto (SN) y descuento (DD). Las
            //tarifas por horas(HT) y horas trabajadas(TH) se ingresan por teclado. El descuento aplicar a todos los
            //sueldos calculados es del 10 %.Imprimir sueldo bruto, descuento y sueldo neto.

            double SB, SN, DD, HT, TH;

            Console.WriteLine("===============>> PROGRAMA QUE CALCULA SUELDO <<===============");
            Console.WriteLine("Ingrese costo de tarifa por hora: ");
            HT = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("Ingrese total de horas trabajadas: ");
            TH = Convert.ToDouble(Console.ReadLine());
            SB = HT * TH;
            Console.WriteLine("El sueldo bruto es: ${0}", SB.ToString("N"));
            DD = SB * 0.10;
            Console.WriteLine("El descuento es: ${0}", DD.ToString("N"));
            SN = SB - DD;
            Console.WriteLine("El sueldo neto es: ${0}", SN.ToString("N"));
        }
        /**
         * This routine simply tests for robustness of the toString function.
         *
         * @param xdd
         */
        static void WriteRepeatedSqr(DD xdd)
        {
            if (xdd.GreaterOrEqualThan(DD.ValueOf(1)))
            {
                throw new ArgumentException("Argument must be < 1");
            }

            int count = 0;

            while (xdd.ToDoubleValue() > 1e-300)
            {
                count++;
                double x    = xdd.ToDoubleValue();
                DD     xSqr = xdd.Sqr();
                String s    = xSqr.ToString();
                Console.WriteLine(count + ": " + s);

                DD xSqr2 = DD.Parse(s);

                xdd = xSqr;
            }
        }
Ejemplo n.º 9
0
        static string convertSecDateToStr(long ansInSec)
        {
            long DD, MM, YY, hh, mm, ss;

            YY       = ansInSec / (12 * 30 * 24 * 60 * 60);
            ansInSec = ansInSec % (12 * 30 * 24 * 60 * 60);

            MM       = ansInSec / (30 * 24 * 60 * 60);
            ansInSec = ansInSec % (30 * 24 * 60 * 60);

            DD       = ansInSec / (24 * 60 * 60);
            ansInSec = ansInSec % (24 * 60 * 60);

            hh       = ansInSec / (60 * 60);
            ansInSec = ansInSec % (60 * 60);

            mm       = ansInSec / (60);
            ansInSec = ansInSec % (60);

            ss = ansInSec;

            return(DD.ToString() + ":" + MM.ToString() + ":" + YY.ToString() + ":" + hh.ToString() + ":" + mm.ToString() + ":" + ss.ToString());
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Возращает (String) дату события гггг.мм.дд
 /// </summary>
 /// <returns></returns>
 public string DateString()
 {
     return(GG.ToString("0000") + "." + MM.ToString("00") + "." + DD.ToString("00"));
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Возращает (String) дату и время события гггг.мм.дд.чч.мм.сс.мм.мм.нн
 /// </summary>
 /// <returns></returns>
 public string DateTimeString()
 {
     return(GG.ToString("0000") + "." + MM.ToString("00") + "." + DD.ToString("00") + "." + HH.ToString("00") + "." + Min.ToString("00") + "." + CC.ToString("00") + "." + Mil.ToString("00") + "." + ML.ToString("00") + "." + NN.ToString("00"));
 }
Ejemplo n.º 12
0
 public string TimeString()
 {
     return(DD.ToString("00") + "." + HH.ToString("00") + "." + Min.ToString("00") + "." + CC.ToString("00") + "." + Mil.ToString("00") + "." + ML.ToString("00") + "." + NN.ToString("00"));
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Запись конкретного оптимизационного прозода
        /// </summary>
        /// <param name="resultItem">Значение оптимизационного прохода</param>
        /// <param name="writer">Писатель</param>
        private static void WriteResultItem(OptimisationResult resultItem, XmlTextWriter writer)
        {
            // Запись коэффициентов
            #region Coefficients
            writer.WriteStartElement("Coefficients");

            // Пишем VaR
            #region VaR
            writer.WriteStartElement("VaR");

            WriteItem(writer, "90", resultItem.GetResult(SortBy.Q_90).ToString()); // Квантиль 90
            WriteItem(writer, "95", resultItem.GetResult(SortBy.Q_95).ToString()); // Квантиль 95
            WriteItem(writer, "99", resultItem.GetResult(SortBy.Q_99).ToString()); // Квантиль 99
            WriteItem(writer, "Mx", resultItem.GetResult(SortBy.Mx).ToString());   // Среднее по PL
            WriteItem(writer, "Std", resultItem.GetResult(SortBy.Std).ToString()); // среднеквадратическое отклонение по PL

            writer.WriteEndElement();
            #endregion

            // Пишем параметры PL / DD - крайние точки
            #region Max PL DD
            writer.WriteStartElement("Max_PL_DD");
            WriteItem(writer, "Profit", resultItem.GetResult(SortBy.MaxProfit).ToString());                                    // Суммарная прибыль
            WriteItem(writer, "DD", resultItem.GetResult(SortBy.MaxDD).ToString());                                            // Суммарный убыток
            WriteItem(writer, "Total Profit Trades", ((int)resultItem.GetResult(SortBy.MaxProfitTotalTrades)).ToString());     // Общее кол - во прибыльных трейдов
            WriteItem(writer, "Total Loose Trades", ((int)resultItem.GetResult(SortBy.MaxDDTotalTrades)).ToString());          // Общее кол - во убыточных трейдов
            WriteItem(writer, "Consecutive Wins", ((int)resultItem.GetResult(SortBy.MaxProfitConsecutivesTrades)).ToString()); // Прибыльных трейдов подряд
            WriteItem(writer, "Consecutive Loose", ((int)resultItem.GetResult(SortBy.MaxDDConsecutivesTrades)).ToString());    // Убыточный трейдов подряд
            writer.WriteEndElement();
            #endregion

            // Пишем результаты торгов по дням
            #region Trading_Days

            // Метод пишуший результаты торгов
            void AddDay(string Day, double Profit, double DD, int ProfitTrades, int DDTrades)
            {
                writer.WriteStartElement(Day);

                WriteItem(writer, "Profit", Profit.ToString());                        // прибыли
                WriteItem(writer, "DD", DD.ToString());                                // убытки
                WriteItem(writer, "Number Of Profit Trades", ProfitTrades.ToString()); // кол - во прибыльных трейдов
                WriteItem(writer, "Number Of Loose Trades", DDTrades.ToString());      // кол - во убыточных трейдов

                writer.WriteEndElement();
            }

            writer.WriteStartElement("Trading_Days");

            // Пн
            AddDay("Mn", resultItem.GetResult(SortBy.AverageDailyProfit_Mn),
                   resultItem.GetResult(SortBy.AverageDailyDD_Mn),
                   (int)resultItem.GetResult(SortBy.AverageDailyProfitTrades_Mn),
                   (int)resultItem.GetResult(SortBy.AverageDailyDDTrades_Mn));
            // Вт
            AddDay("Tu", resultItem.GetResult(SortBy.AverageDailyProfit_Tu),
                   resultItem.GetResult(SortBy.AverageDailyDD_Tu),
                   (int)resultItem.GetResult(SortBy.AverageDailyProfitTrades_Tu),
                   (int)resultItem.GetResult(SortBy.AverageDailyDDTrades_Tu));
            // Ср
            AddDay("We", resultItem.GetResult(SortBy.AverageDailyProfit_We),
                   resultItem.GetResult(SortBy.AverageDailyDD_We),
                   (int)resultItem.GetResult(SortBy.AverageDailyProfitTrades_We),
                   (int)resultItem.GetResult(SortBy.AverageDailyDDTrades_We));
            // Чт
            AddDay("Th", resultItem.GetResult(SortBy.AverageDailyProfit_Th),
                   resultItem.GetResult(SortBy.AverageDailyDD_Th),
                   (int)resultItem.GetResult(SortBy.AverageDailyProfitTrades_Th),
                   (int)resultItem.GetResult(SortBy.AverageDailyDDTrades_Th));
            // Пт
            AddDay("Fr", resultItem.GetResult(SortBy.AverageDailyProfit_Fr),
                   resultItem.GetResult(SortBy.AverageDailyDD_Fr),
                   (int)resultItem.GetResult(SortBy.AverageDailyProfitTrades_Fr),
                   (int)resultItem.GetResult(SortBy.AverageDailyDDTrades_Fr));

            writer.WriteEndElement();
            #endregion

            // Пишем остальные коэййициенты
            WriteItem(writer, "Custom", resultItem.GetResult(SortBy.Custom).ToString());
            WriteItem(writer, "Payoff", resultItem.GetResult(SortBy.Payoff).ToString());
            WriteItem(writer, "Profit factor", resultItem.GetResult(SortBy.ProfitFactor).ToString());
            WriteItem(writer, "Average Profit factor", resultItem.GetResult(SortBy.AverageProfitFactor).ToString());
            WriteItem(writer, "Recovery factor", resultItem.GetResult(SortBy.RecoveryFactor).ToString());
            WriteItem(writer, "Average Recovery factor", resultItem.GetResult(SortBy.AverageRecoveryFactor).ToString());
            WriteItem(writer, "Total trades", ((int)resultItem.GetResult(SortBy.TotalTrades)).ToString());
            WriteItem(writer, "PL", resultItem.GetResult(SortBy.PL).ToString());
            WriteItem(writer, "DD", resultItem.GetResult(SortBy.DD).ToString());
            WriteItem(writer, "Altman Z Score", resultItem.GetResult(SortBy.AltmanZScore).ToString());

            writer.WriteEndElement();
            #endregion

            // Пишем коэффициенты робота
            #region Bot params
            foreach (var item in resultItem.report.BotParams)
            {
                WriteItem(writer, item.Key, item.Value);
            }
            #endregion
        }
Ejemplo n.º 14
0
    protected void RdbSingle_CheckedChanged(object sender, EventArgs e)
    {
        try
        {
            if (ViewState["MS"].ToString() == "N")
            {
                TxtAMTCOLL.Text = FDR.GetCurrentBalance("X_" + Session["MID"].ToString(), "Y").ToString();
                if (rdbOP.Checked != true)
                {
                    TxtDiff.Text = TxtAMTCOLL.Text;
                }

                else
                {
                    TxtDiff.Text = (Convert.ToDouble(ViewState["TPAY"].ToString()) - Convert.ToDouble(ViewState["INTPAY"].ToString())).ToString();
                }
                TxtDepoAmt.Enabled = false;

                ClearFD();
                string DD;
                DD = FDR.GetDUEDATE(ViewState["FDTP"].ToString(), Session["BRCD"].ToString(), "DUED", ViewState["ACC"].ToString(), ViewState["CT"].ToString());
                if (DD != null)
                {
                    dtDeposDate.Text = DD.ToString();
                }


                if (rdbOP.Checked != true)
                {
                    TxtDepoAmt.Text = TxtAMTCOLL.Text;
                }

                else if (rdbOP.Checked == true && RdbSingle.Checked == true)
                {
                    TxtDepoAmt.Text = (Convert.ToDouble(ViewState["TPAY"].ToString()) - Convert.ToDouble(ViewState["TINTAMT"].ToString())).ToString();
                }
                //TxtDepoAmt.Text = FDR.GetCurrentBalance("X_" + Session["MID"].ToString(), "Y").ToString();
                else
                {
                    TxtDepoAmt.Text = (Convert.ToDouble(ViewState["TPAY"].ToString()) - Convert.ToDouble(ViewState["INTPAY"].ToString())).ToString();
                }



                ViewState["CTYPE"] = "S";
            }
            else
            {
                TxtAMTCOLL.Text = FDR.GetCurrentBalance("X_" + Session["MID"].ToString(), "Y").ToString();
                if (rdbOP.Checked != true)
                {
                    TxtDiff.Text = TxtAMTCOLL.Text;
                }

                else
                {
                    TxtDiff.Text = (Convert.ToDouble(ViewState["TPAY"].ToString()) - Convert.ToDouble(ViewState["INTPAY"].ToString())).ToString();
                }
                TxtDepoAmt.Enabled = false;

                ClearFD();

                if (rdbOP.Checked != true)
                {
                    TxtDepoAmt.Text = TxtAMTCOLL.Text;
                }

                else if (rdbOP.Checked == true && RdbSingle.Checked == true)
                {
                    //TxtDepoAmt.Text = (Convert.ToDouble(ViewState["TPAY"].ToString()) - Convert.ToDouble(ViewState["TINTAMT"].ToString())).ToString();
                    TxtDepoAmt.Text = FDR.GetCurrentBalance("X_" + Session["MID"].ToString(), "Y").ToString();
                }
                else
                {
                    TxtDepoAmt.Text = (Convert.ToDouble(ViewState["TPAY"].ToString()) - Convert.ToDouble(ViewState["INTPAY"].ToString())).ToString();
                }

                TxtProcode.Focus();
            }
        }
        catch (Exception Ex)
        {
            ExceptionLogging.SendErrorToText(Ex);
        }
    }
Ejemplo n.º 15
0
        /// <inheritdoc />
        public override string ToString(int level)
        {
            var spacer = GetSpacer(level);

            return($"{spacer}<dd>\r\n{DD.ToString(level+1)}\r\n{spacer}</dd>\r\n{spacer}<dt>\r\n{DT.ToString(level+1)}\r\n{spacer}</dt>\r\n");
        }
        public void DisplayDefaultOf3 <DD>() //Generische Methode
        {
            DD item = default(DD);

            Console.WriteLine($"Default value of {typeof(DD)} is {(item == null ? "null" : item.ToString())}.");
        }