Esempio n. 1
0
    public void Method2(string[] args)
    {
        SecondMethod y = new SecondMethod();

        Console.WriteLine("{0}", y.number1);
        y.number1 = 33;
        Console.WriteLine("{0}", y.number1);
        Console.ReadKey();
    }
Esempio n. 2
0
        public ActionResult CarregarExames(string sidx, string sord, int page, int rows)
        {
            List <Exame> list;

            list = OrderByJqGrid(sidx, sord, ListExame()).ToList();

            var iRowCount = list.Count;
            var iRest     = iRowCount % rows;
            int iCurrencyRows;

            var totalPages = rows > iRowCount
                                 ? 1
                                 : rows <= iRowCount ? (iRowCount / rows) + (iRest == 0 ? 0 : 1) : iRowCount;

            if ((iRowCount / rows) == 0)
            {
                iCurrencyRows = iRowCount;
            }
            else if ((totalPages).Equals(page))
            {
                iCurrencyRows = iRest == 0 ? rows : iRest;
            }
            else
            {
                iCurrencyRows = rows;
            }

            if (iRowCount < rows)
            {
                rows = iRowCount;
            }

            var second = new SecondMethod
            {
                total   = totalPages,
                page    = page,
                records = iRowCount,
                rows    = new RowElement[iCurrencyRows]
            };

            int iCount = ((rows * page) - rows);

            for (int currentRow = 0; currentRow < iCurrencyRows; currentRow++)
            {
                second.rows[currentRow] = new RowElement {
                    id = iCount + 1, cell = new string[4]
                };
                second.rows[currentRow].cell[0] = list[iCount].Id.ToString();
                second.rows[currentRow].cell[1] = list[iCount].TipoExame;
                second.rows[currentRow].cell[2] = list[iCount].Resultado;
                second.rows[currentRow].cell[3] = list[iCount].DataExame;

                iCount++;
            }

            return(Json(second, JsonRequestBehavior.AllowGet));
        }
Esempio n. 3
0
        public ActionResult IncluirProcedimentoAPaciente(string Id, string Nome, string DataProcedimento)
        {
            var second     = new SecondMethod();
            var pacienteId = Session["pacienteId"].ToString();

            _controller.IncluirProcedimentoAPaciente(Nome, DataProcedimento, pacienteId);

            return(Json(second, JsonRequestBehavior.AllowGet));
        }
Esempio n. 4
0
        public void Generator_ForSequence3()
        {
            double[] expected = { 1, 2, 2.5, 3.3, 4.05757575757576, 4.87086926018965, 5.70389834408211, 6.55785277425587, 7.42763417076325, 8.31053343902137 };
            var      method   = new SecondMethod();

            double[] actual = Generator.GenerateSequence(11, 1, 2, method).ToArray();

            int i = 0;

            foreach (var a in actual)
            {
                Assert.AreEqual(expected[i++], a, 0.00001);
            }

            Assert.AreEqual(10, i);
        }
Esempio n. 5
0
        private void rButton3_Click(object sender, EventArgs e)
        {
            tabControl1.TabPages[1].Enabled = false;
            tabControl1.TabPages[0].Enabled = false;

            if (sRun)
            {
                sRun = false;
                super.Abort();
                rButton3.Text = "запуск";

                tabControl1.TabPages[1].Enabled = true;
                tabControl1.TabPages[0].Enabled = true;

                return;
            }

            sRun          = true;
            rButton3.Text = "cтоп";

            int selected = comboBox1.SelectedIndex;

            super = new Thread(() =>
            {
                double u0  = Convert.ToDouble(u0TextBox3.Text.Replace('.', ','));
                double u01 = Convert.ToDouble(u01TextBox3.Text.Replace('.', ','));
                double h   = Convert.ToDouble(hTextBox3.Text.Replace('.', ','));
                int n      = Convert.ToInt32(nTextBox3.Text.Replace('.', ','));
                double eps = Convert.ToDouble(epsTextBox3.Text.Replace('.', ','));
                double rb  = Convert.ToDouble(rbTextBox3.Text.Replace('.', ','));

                double a = Convert.ToDouble(aTextBox3.Text.Replace('.', ','));
                double b = Convert.ToDouble(bTextBox3.Text.Replace('.', ','));



                bool ctrl = !checkBox3.Checked;

                SecondMethod m = new SecondMethod(
                    (x, u1, u2) => (u2),
                    (x, u1, u2) => (-a * Math.Sqrt(u2 * u2 + 1) - b),
                    0, u0, u01, h, eps, ctrl);


                mainChart.Invoke(new Action(() =>
                {
                    mainChart.Series["Численное решение"].Points.Clear();
                    mainChart.Series["Точное решение"].Points.Clear();


                    chart1.Series["h"].Points.Clear();
                }));

                ++nums;
                info             = new DotForm();
                info.label1.Text = "Запуск номер " + nums + "; Метод 3";


                minDot      = double.MaxValue;
                maxDot      = double.MinValue;
                double minX = double.MaxValue;

                double minStep = double.MaxValue;
                double mns     = 0;

                double maxStep = double.MinValue;
                double mxs     = 0;

                MDot p = null;

                int count     = 0;
                double maxOLP = 0;

                foreach (var i in Enumerable.Range(0, n))
                {
                    double step = m.Step;
                    p           = m.nextStep(out double contr, out double olp);
                    if (Math.Abs(p.U1) < 1e-8)
                    {
                        p.U2 = 0;
                    }
                    if (Math.Abs(p.U1) > 10e+20)
                    {
                        break;
                    }
                    if (Math.Abs(p.X) < 1e-8)
                    {
                        p.X = 0;
                    }
                    if (Math.Abs(p.X) > 10e+20)
                    {
                        break;
                    }

                    Dot add = new Dot();

                    if (selected == 0)
                    {
                        add.X = p.X;
                        add.Y = p.U1;
                    }
                    if (selected == 1)
                    {
                        add.X = p.X;
                        add.Y = p.U2;
                    }
                    if (selected == 2)
                    {
                        add.X = p.U1;
                        add.Y = p.U2;
                    }

                    mainChart.Invoke(new Action(() => {
                        mainChart.Series["Численное решение"].Points.AddXY(add.X, add.Y);
                        chart1.Series["h"].Points.AddXY(i, step);
                    }));

                    Console.WriteLine(p.X + " " + p.U1);

                    mainChart.Invoke(new Action(() =>
                    {
                        info.dataGridView1.Rows.Add(i + "", add.Y, contr, olp, step, m.C1, m.C2, "-", "-");
                    }));

                    if (minDot > add.Y)
                    {
                        minDot = add.Y;
                    }

                    if (maxDot < add.Y)
                    {
                        maxDot = add.Y;
                    }

                    if (minX > add.X)
                    {
                        minX = add.X;
                    }

                    if (p.X > rb)
                    {
                        break;
                    }

                    if (maxOLP < Math.Abs(olp))
                    {
                        maxOLP = Math.Abs(olp);
                    }

                    if (step > maxStep)
                    {
                        maxStep = step;
                        mxs     = p.X;
                    }

                    if (step < minStep)
                    {
                        minStep = step;
                        mns     = p.X;
                    }

                    count++;
                }

                mainChart.Invoke(new Action(() =>
                {
                    correctAxis(rb, minDot - 0.01, maxDot + 0.01);

                    info.param.Text = $"n = : {count}, \nb-Xn: {rb - p.X}, \nmaxOLP: {maxOLP}, \nC1: {m.C1}, \nC2: {m.C2}, \nmax Hi: {maxStep} -> x: {mxs}, \nmin Hi: {minStep} -> x: {mns}";
                    info.Show();

                    sRun          = false;
                    rButton3.Text = "запуск";

                    tabControl1.TabPages[1].Enabled = true;
                    tabControl1.TabPages[0].Enabled = true;

                    if (selected == 0)
                    {
                        mainChart.ChartAreas[0].AxisX.Title = "x";
                        mainChart.ChartAreas[0].AxisY.Title = "u1";
                    }
                    if (selected == 1)
                    {
                        mainChart.ChartAreas[0].AxisX.Title = "x";
                        mainChart.ChartAreas[0].AxisY.Title = "u2";
                    }
                    if (selected == 2)
                    {
                        mainChart.ChartAreas[0].AxisX.Title = "u1";
                        mainChart.ChartAreas[0].AxisY.Title = "u2";

                        correctAxis(rb, minDot - 0.01, maxDot + 0.01, minX - 0.01);
                    }
                }));
            });

            super.Start();
        }
Esempio n. 6
0
        public ActionResult IncluirReceituarioAPaciente(string Id, string Nome, string Periodo)
        {
            var second = new SecondMethod();

            return(Json(second, JsonRequestBehavior.AllowGet));
        }
Esempio n. 7
0
        public ActionResult CarregarPacientes(string sidx, string sord, int page, int rows, string nome, string prontuario, string cpf)
        {
            List <RegistroPaciente> list;

            list = string.IsNullOrEmpty(nome) ? OrderByJqGrid(sidx, sord, ListaDeRegistroPaciente()).ToList() : OrderByJqGrid(sidx, sord, ListaDeRegistroPaciente()).Where(p => p.Paciente.Contains(nome)).ToList();

            //list = string.IsNullOrEmpty(nome) && string.IsNullOrEmpty(prontuario)
            //           ? OrderByJqGrid(sidx, sord, ListaDeRegistroPaciente()).ToList()
            //           : OrderByJqGrid(sidx, sord, ListaDeRegistroPaciente())
            //                 .Where(p => nome != null && (p.Registro.Contains(prontuario) && p.Paciente.Contains(nome))).ToList();

            var iRowCount = list.Count;
            var iRest     = iRowCount % rows;
            int iCurrencyRows;

            var totalPages = rows > iRowCount
                                 ? 1
                                 : rows <= iRowCount ? (iRowCount / rows) + (iRest == 0 ? 0 : 1) : iRowCount;

            if ((iRowCount / rows) == 0)
            {
                iCurrencyRows = iRowCount;
            }
            else if ((totalPages).Equals(page))
            {
                iCurrencyRows = iRest == 0 ? rows : iRest;
            }
            else
            {
                iCurrencyRows = rows;
            }

            if (iRowCount < rows)
            {
                rows = iRowCount;
            }

            var second = new SecondMethod
            {
                total   = totalPages,
                page    = page,
                records = iRowCount,
                rows    = new RowElement[iCurrencyRows]
            };

            int iCount = ((rows * page) - rows);

            for (int currentRow = 0; currentRow < iCurrencyRows; currentRow++)
            {
                second.rows[currentRow] = new RowElement {
                    id = iCount + 1, cell = new string[8]
                };
                second.rows[currentRow].cell[1] = list[iCount].Id;
                second.rows[currentRow].cell[2] = list[iCount].Registro;
                second.rows[currentRow].cell[3] = list[iCount].Unidade;
                second.rows[currentRow].cell[4] = list[iCount].Paciente;
                second.rows[currentRow].cell[5] = list[iCount].Admissao;
                second.rows[currentRow].cell[6] = list[iCount].TipoPaciente;
                second.rows[currentRow].cell[7] = list[iCount].Saida;

                iCount++;
            }

            return(Json(second, JsonRequestBehavior.AllowGet));
        }
Esempio n. 8
0
        public ActionResult CarregarReceituarios(string sidx, string sord, int page, int rows)
        {
            List <Receituario> list;

            list = OrderByJqGrid(sidx, sord, ListReceituario()).ToList();

            var iRowCount = list.Count;
            var iRest     = iRowCount % rows;
            int iCurrencyRows;

            var totalPages = rows > iRowCount
                                 ? 1
                                 : rows <= iRowCount ? (iRowCount / rows) + (iRest == 0 ? 0 : 1) : iRowCount;

            if ((iRowCount / rows) == 0)
            {
                iCurrencyRows = iRowCount;
            }
            else if ((totalPages).Equals(page))
            {
                iCurrencyRows = iRest == 0 ? rows : iRest;
            }
            else
            {
                iCurrencyRows = rows;
            }

            if (iRowCount < rows)
            {
                rows = iRowCount;
            }

            var second = new SecondMethod
            {
                total   = totalPages,
                page    = page,
                records = iRowCount,
                rows    = new RowElement[iCurrencyRows]
            };

            int iCount = ((rows * page) - rows);

            for (int currentRow = 0; currentRow < iCurrencyRows; currentRow++)
            {
                second.rows[currentRow] = new RowElement {
                    id = iCount + 1, cell = new string[10]
                };
                second.rows[currentRow].cell[0] = list[iCount].Id.ToString();
                second.rows[currentRow].cell[1] = list[iCount].Nome;
                second.rows[currentRow].cell[2] = list[iCount].Dose;
                second.rows[currentRow].cell[3] = list[iCount].TipoDose;
                second.rows[currentRow].cell[4] = list[iCount].Apresentacao;
                second.rows[currentRow].cell[5] = list[iCount].TipoApresentacao;
                second.rows[currentRow].cell[6] = list[iCount].Via;
                second.rows[currentRow].cell[7] = list[iCount].Frequencia;
                second.rows[currentRow].cell[8] = list[iCount].Duracao;
                second.rows[currentRow].cell[9] = list[iCount].TipoDuaracao;

                iCount++;
            }

            return(Json(second, JsonRequestBehavior.AllowGet));
        }
Esempio n. 9
0
 public ActionResult IncluirReceituarioAPaciente(string Id, string Nome, string Periodo)
 {
     var second = new SecondMethod();
     return Json(second, JsonRequestBehavior.AllowGet);
 }
Esempio n. 10
0
        public ActionResult IncluirProcedimentoAPaciente(string Id, string Nome, string DataProcedimento)
        {
            var second = new SecondMethod();
            var pacienteId = Session["pacienteId"].ToString();
            _controller.IncluirProcedimentoAPaciente(Nome, DataProcedimento, pacienteId);

            return Json(second, JsonRequestBehavior.AllowGet);
        }
Esempio n. 11
0
        public ActionResult CarregarAntimicrobianos(string sidx, string sord, int page, int rows)
        {
            List<Antimicrobiano> list;
            list = OrderByJqGrid(sidx, sord, ListAntimicrobiano()).ToList();

            var iRowCount = list.Count;
            var iRest = iRowCount % rows;
            int iCurrencyRows;

            var totalPages = rows > iRowCount
                                 ? 1
                                 : rows <= iRowCount ? (iRowCount / rows) + (iRest == 0 ? 0 : 1) : iRowCount;

            if ((iRowCount / rows) == 0)
            {
                iCurrencyRows = iRowCount;
            }
            else if ((totalPages).Equals(page))
            {
                iCurrencyRows = iRest == 0 ? rows : iRest;
            }
            else
            {
                iCurrencyRows = rows;
            }

            if (iRowCount < rows)
            {
                rows = iRowCount;
            }

            var second = new SecondMethod
            {
                total = totalPages,
                page = page,
                records = iRowCount,
                rows = new RowElement[iCurrencyRows]
            };

            int iCount = ((rows * page) - rows);

            for (int currentRow = 0; currentRow < iCurrencyRows; currentRow++)
            {
                second.rows[currentRow] = new RowElement { id = iCount + 1, cell = new string[4] };
                second.rows[currentRow].cell[0] = list[iCount].Id.ToString();
                second.rows[currentRow].cell[1] = list[iCount].Nome;
                second.rows[currentRow].cell[2] = list[iCount].Periodo;
                second.rows[currentRow].cell[3] = list[iCount].TipoPeriodo;
                iCount++;
            }

            return Json(second, JsonRequestBehavior.AllowGet);
        }
Esempio n. 12
0
        public ActionResult CarregarPacientes(string sidx, string sord, int page, int rows, string nome, string prontuario, string cpf)
        {
            List<RegistroPaciente> list;
            list = string.IsNullOrEmpty(nome) ? OrderByJqGrid(sidx, sord, ListaDeRegistroPaciente()).ToList() : OrderByJqGrid(sidx, sord, ListaDeRegistroPaciente()).Where(p => p.Paciente.Contains(nome)).ToList();

            //list = string.IsNullOrEmpty(nome) && string.IsNullOrEmpty(prontuario)
            //           ? OrderByJqGrid(sidx, sord, ListaDeRegistroPaciente()).ToList()
            //           : OrderByJqGrid(sidx, sord, ListaDeRegistroPaciente())
            //                 .Where(p => nome != null && (p.Registro.Contains(prontuario) && p.Paciente.Contains(nome))).ToList();

            var iRowCount = list.Count;
            var iRest = iRowCount % rows;
            int iCurrencyRows;

            var totalPages = rows > iRowCount
                                 ? 1
                                 : rows <= iRowCount ? (iRowCount / rows) + (iRest == 0 ? 0 : 1) : iRowCount;

            if ((iRowCount / rows) == 0)
            {
                iCurrencyRows = iRowCount;
            }
            else if ((totalPages).Equals(page))
            {
                iCurrencyRows = iRest == 0 ? rows : iRest;
            }
            else
            {
                iCurrencyRows = rows;
            }

            if (iRowCount < rows)
            {
                rows = iRowCount;
            }

            var second = new SecondMethod
                             {
                                 total = totalPages,
                                 page = page,
                                 records = iRowCount,
                                 rows = new RowElement[iCurrencyRows]
                             };

            int iCount = ((rows * page) - rows);

            for (int currentRow = 0; currentRow < iCurrencyRows; currentRow++)
            {
                second.rows[currentRow] = new RowElement { id = iCount + 1, cell = new string[8] };
                second.rows[currentRow].cell[1] = list[iCount].Id;
                second.rows[currentRow].cell[2] = list[iCount].Registro;
                second.rows[currentRow].cell[3] = list[iCount].Unidade;
                second.rows[currentRow].cell[4] = list[iCount].Paciente;
                second.rows[currentRow].cell[5] = list[iCount].Admissao;
                second.rows[currentRow].cell[6] = list[iCount].TipoPaciente;
                second.rows[currentRow].cell[7] = list[iCount].Saida;

                iCount++;
            }

            return Json(second, JsonRequestBehavior.AllowGet);
        }