Ejemplo n.º 1
0
 public void RemoveItemsFromOutputLists()
 {
     x.Clear();
     Sx.Clear();
     dxx1.Clear();
     mx.Clear();
     qx.Clear();
     px.Clear();
     Lx.Clear();
     Tx.Clear();
     ex.Clear();
 }
Ejemplo n.º 2
0
        public string to_string()
        {
            string str = n.ToString() + " " + nj.ToString() + " " + nx.ToString() + "\r\n";

            str += Lj.ToString() + " " + Lx.ToString() + "\r\n";
            str += Vj.ToString() + " " + Vx.ToString() + "\r\n";
            str += Cj.ToString() + " " + Cx.ToString() + "\r\n";
            str += Pt.ToString() + " " + At.ToString() + "\r\n";
            foreach (var t in targets)
            {
                str += t.to_string() + "\r\n";
            }
            return(str);
        }
Ejemplo n.º 3
0
        public void Run()
        {
            for (int i = 1; i < Lx.Count; i++)
            {
                //get d;
                CurrentPoint = Lx[i];
                Ly           = Lx.Take(i).ToList();
                Ly           = Ly.OrderBy(e => e.Y).ToList();
                // width of Active Window
                for (int j = 0; j < Ly.Count; j++)
                {
                    if (Lx[i].X - Ly[j].X > Distance)
                    {
                        Ly.RemoveAt(j);
                    }
                }
                // height of Active Index
                var upper = CurrentPoint.Y + Distance;
                var lower = CurrentPoint.Y - Distance;
                for (int k = 0; k < Ly.Count; k++)
                {
                    if (Ly[k].Y > upper || Ly[k].Y < lower)
                    {
                        Ly.RemoveAt(k);
                    }
                }

                //get the new distance
                for (int c = 0; c < Ly.Count; c++)
                {
                    double tempDist = Math.Sqrt(
                        Math.Pow(Ly[c].X - Lx[i].X, 2) +
                        Math.Pow(Ly[c].Y - Lx[i].Y, 2)
                        );

                    if (tempDist < Distance)
                    {
                        Distance  = tempDist;
                        Result[0] = Lx[i];
                        Result[1] = Ly[c];
                        //FIRE THE STEP EVENT
                        step(this, new EventArgs());
                    }
                }
            }
        }
Ejemplo n.º 4
0
 private void button1_Click(object sender, EventArgs e)
 {
     if ((string.IsNullOrEmpty(textBox1.Text)) || (string.IsNullOrEmpty(textBox2.Text)))
     {
         MessageBox.Show("Необходимо ввести значения h и hx");
     }
     else
     {
         h  = Convert.ToDouble(textBox1.Text);
         hx = Convert.ToDouble(textBox2.Text);
         //уровень защиты
         if ((radioButton4.Checked) || (radioButton5.Checked) || (radioButton6.Checked) || (radioButton7.Checked))
         {
             //0,9
             if (radioButton1.Checked)
             {
                 if ((h >= 0) && (h < 30))
                 {
                     Lmax = 5.75 * h;
                     Lc   = 2.5 * h;
                     //h0 ?
                     h0          = 0.85 * h;
                     hc          = ((Lmax - L) / (Lmax - Lc)) * h0;
                     r0          = 1.2 * h;
                     rx          = (r0 * (h0 - hx)) / h0;
                     Lx          = (L * (h0 - hx)) / (2 * (h0 - hc));
                     rcx         = (r0 * (hc - hx)) / hc;
                     label2.Text = "Резульаты расчёта:\n" + "Lmax= " + Lmax.ToString("##.##") + "м" + "\nLc= " +
                                   Lc.ToString("##.##") + "м" + "\nrx= " + rx.ToString("####.##") + "м" +
                                   "\nlx= " + Lx.ToString("####.##") + "м" + "\nhc= " + hc.ToString("####.##") + "м";
                 }
                 else if ((h >= 30) && (h < 100))
                 {
                     Lmax        = (5.75 - 3.57 * Math.Pow(10, -3) * (h - 30)) * h;
                     Lc          = 2.5 * h;
                     h0          = 0.85 * h;
                     hc          = ((Lmax - L) / (Lmax - Lc)) * h0;
                     r0          = 1.2 * h;
                     rx          = (r0 * (h0 - hx)) / h0;
                     Lx          = (L * (h0 - hx)) / (2 * (h0 - hc));
                     rcx         = (r0 * (hc - hx)) / hc;
                     label2.Text = "Резульаты расчёта:\n" + "Lmax= " + Lmax.ToString("##.##") + "м" + "\nLc= " +
                                   Lc.ToString("##.##") + "м" + "\nrx= " + rx.ToString("####.##") + "м" +
                                   "\nlx= " + Lx.ToString("####.##") + "м" + "\nhc= " + hc.ToString("####.##") + "м";
                 }
                 else if ((h >= 100) && (h < 150))
                 {
                     Lmax        = 5.5 * h;
                     Lc          = 2.5 * h;
                     h0          = 0.85 * h;
                     hc          = ((Lmax - L) / (Lmax - Lc)) * h0;
                     r0          = (1.2 - Math.Pow(10, -3) * (h - 100)) * h;
                     rx          = (r0 * (h0 - hx)) / h0;
                     Lx          = (L * (h0 - hx)) / (2 * (h0 - hc));
                     rcx         = (r0 * (hc - hx)) / hc;
                     label2.Text = "Резульаты расчёта:\n" + "Lmax= " + Lmax.ToString("##.##") + "м" + "\nLc= " +
                                   Lc.ToString("##.##") + "м" + "\nrx= " + rx.ToString("####.##") + "м" +
                                   "\nlx= " + Lx.ToString("####.##") + "м" + "\nhc= " + hc.ToString("####.##") + "м";
                 }
                 else
                 {
                     MessageBox.Show("Значение h не попадает в допустимый диапазон");
                 }
             }
             //0,99
             if (radioButton2.Checked)
             {
                 if ((h >= 0) && (h < 30))
                 {
                     Lmax = 4.75 * h;
                     Lc   = 2.25 * h;
                     //h0 ?
                     h0          = 0.8 * h;
                     hc          = ((Lmax - L) / (Lmax - Lc)) * h0;
                     r0          = 0.8 * h;
                     rx          = (r0 * (h0 - hx)) / h0;
                     Lx          = (L * (h0 - hx)) / (2 * (h0 - hc));
                     rcx         = (r0 * (hc - hx)) / hc;
                     label2.Text = "Резульаты расчёта:\n" + "Lmax= " + Lmax.ToString("##.##") + "м" + "\nLc= " +
                                   Lc.ToString("##.##") + "м" + "\nrx= " + rx.ToString("####.##") + "м" +
                                   "\nlx= " + Lx.ToString("####.##") + "м" + "\nhc= " + hc.ToString("####.##") + "м";
                 }
                 else if ((h >= 30) && (h < 100))
                 {
                     Lmax        = (4.75 - 3.57 * Math.Pow(10, -3) * (h - 30)) * h;
                     Lc          = (2.25 - 0.00107 * (h - 30)) * h;
                     h0          = 0.8 * h;
                     hc          = ((Lmax - L) / (Lmax - Lc)) * h0;
                     r0          = (0.8 - 1.43 * Math.Pow(10, -3) * (h - 30)) * h;
                     rx          = (r0 * (h0 - hx)) / h0;
                     Lx          = (L * (h0 - hx)) / (2 * (h0 - hc));
                     rcx         = (r0 * (hc - hx)) / hc;
                     label2.Text = "Резульаты расчёта:\n" + "Lmax= " + Lmax.ToString("##.##") + "м" + "\nLc= " +
                                   Lc.ToString("##.##") + "м" + "\nrx= " + rx.ToString("####.##") + "м" +
                                   "\nlx= " + Lx.ToString("####.##") + "м" + "\nhc= " + hc.ToString("####.##") + "м";
                 }
                 else if ((h >= 100) && (h < 150))
                 {
                     Lmax        = 4.5 * h;
                     Lc          = 1.5 * h;
                     h0          = (0.8 - Math.Pow(10, -3) * (h - 100)) * h;
                     hc          = ((Lmax - L) / (Lmax - Lc)) * h0;
                     r0          = 0.7;
                     rx          = (r0 * (h0 - hx)) / h0;
                     Lx          = (L * (h0 - hx)) / (2 * (h0 - hc));
                     rcx         = (r0 * (hc - hx)) / hc;
                     label2.Text = "Резульаты расчёта:\n" + "Lmax= " + Lmax.ToString("##.##") + "м" + "\nLc= " +
                                   Lc.ToString("##.##") + "м" + "\nrx= " + rx.ToString("####.##") + "м" +
                                   "\nlx= " + Lx.ToString("####.##") + "м" + "\nhc= " + hc.ToString("####.##") + "м";
                 }
                 else
                 {
                     MessageBox.Show("Значение h не попадает в допустимый диапазон");
                 }
             }
             //0,999
             if (radioButton3.Checked)
             {
                 if ((h >= 0) && (h < 30))
                 {
                     Lmax = 4.25 * h;
                     Lc   = 2.25 * h;
                     //h0 ?
                     h0          = 0.7 * h;
                     hc          = ((Lmax - L) / (Lmax - Lc)) * h0;
                     r0          = 0.6 * h;
                     rx          = (r0 * (h0 - hx)) / h0;
                     Lx          = (L * (h0 - hx)) / (2 * (h0 - hc));
                     rcx         = (r0 * (hc - hx)) / hc;
                     label2.Text = "Резульаты расчёта:\n" + "Lmax= " + Lmax.ToString("##.##") + "м" + "\nLc= " +
                                   Lc.ToString("##.##") + "м" + "\nrx= " + rx.ToString("####.##") + "м" +
                                   "\nlx= " + Lx.ToString("####.##") + "м" + "\nhc= " + hc.ToString("####.##") + "м";
                 }
                 else if ((h >= 30) && (h < 100))
                 {
                     Lmax        = (4.25 - 3.57 * Math.Pow(10, -3) * (h - 30)) * h;
                     Lc          = (2.25 - 0.00107 * (h - 30)) * h;
                     h0          = (0.7 - 7.14 * Math.Pow(10, -4) * (h - 30)) * h;
                     hc          = ((Lmax - L) / (Lmax - Lc)) * h0;
                     r0          = (0.6 - 1.43 * Math.Pow(10, -4) * (h - 30)) * h;
                     rx          = (r0 * (h0 - hx)) / h0;
                     Lx          = (L * (h0 - hx)) / (2 * (h0 - hc));
                     rcx         = (r0 * (hc - hx)) / hc;
                     label2.Text = "Резульаты расчёта:\n" + "Lmax= " + Lmax.ToString("##.##") + "м" + "\nLc= " +
                                   Lc.ToString("##.##") + "м" + "\nrx= " + rx.ToString("####.##") + "м" +
                                   "\nlx= " + Lx.ToString("####.##") + "м" + "\nhc= " + hc.ToString("####.##") + "м";
                 }
                 else if ((h >= 100) && (h < 150))
                 {
                     Lmax        = 4.0 * h;
                     Lc          = 1.5 * h;
                     h0          = (0.65 - Math.Pow(10, -3) * (h - 100)) * h;
                     hc          = ((Lmax - L) / (Lmax - Lc)) * h0;
                     r0          = (0.5 - 2 * Math.Pow(10, -3) * (h - 100)) * h;
                     rx          = (r0 * (h0 - hx)) / h0;
                     Lx          = (L * (h0 - hx)) / (2 * (h0 - hc));
                     rcx         = (r0 * (hc - hx)) / hc;
                     label2.Text = "Резульаты расчёта:\n" + "Lmax= " + Lmax.ToString("##.##") + "м" + "\nLc= " +
                                   Lc.ToString("##.##") + "м" + "\nrx= " + rx.ToString("####.##") + "м" +
                                   "\nlx= " + Lx.ToString("####.##") + "м" + "\nhc= " + hc.ToString("####.##") + "м";
                 }
                 else
                 {
                     MessageBox.Show("Значение h не попадает в допустимый диапазон");
                 }
             }
         }
         else
         {
             MessageBox.Show("Значение уровня защиты не выбрано");
         }
     }
 }
        public string BuildEdi(List <Patient> patientList, InsuranceCompany insurance,
                               BillingProvider billingProvider)
        {
            var buildEdi = new StringBuilder();
            //Begin ISA
            var buildisa = new Isa();

            buildEdi.Append(buildisa.BuildIsa());

            //Begin GS
            var buildGs = new Gs();

            buildEdi.Append(buildGs.BuildGs());

            //Begin ST
            var buildSt = new St();

            buildEdi.Append(buildSt.BuildSt());

            //Begin BPR
            var buildBpr = new Bpr();

            buildEdi.Append(buildBpr.BuildBpr(insurance));

            //Build TRN
            var buildTrn = new Trn();

            buildEdi.Append(buildTrn.BuildTrn(insurance));

            //Ref Segment conditional, not included at this time
            //REF Receiver Identification
            //REF01 Receiver Reference Number
            //REF02 Receiver Reference Identification

            //Build DTM Loop Production Date
            var buildDtm = new Dtm();

            buildEdi.Append(buildDtm.BuildDtm(patientList));

            //Build N1 Insurance Company Identification Segment 1000A
            var buildNOne = new N1();

            buildEdi.Append(buildNOne.BuildNOne(insurance));

            //BuildN3 Insurance Company Identification Segment 1000A
            var buildNThree = new N3();

            buildEdi.Append(buildNThree.BuildNThree(insurance));

            // Build N4 Insurance Company Identification 1000A
            var buildNFour = new N4();

            buildEdi.Append(buildNFour.BuildN4(insurance));

            //Build Ref Insurance Company Identification 1000A
            var buildRef = new Ref();

            buildEdi.Append(buildRef.BuildRef());

            //Build Per Insurance Company Identification 1000A
            var buildPer = new Per();

            buildEdi.Append(buildPer.BuildPerPhone());

            //Build Per Insurance Company Website Information 1000A
            buildEdi.Append(buildPer.BuildPerWebSite());

            //Build N1 Provider Identifier Segment 1000B
            buildEdi.Append(buildNOne.BuildNOne(billingProvider));

            //Build N3 Provider Identifier Segment 1000B
            buildEdi.Append(buildNThree.BuildNThree(billingProvider));

            //Build N4 Provider Identifier Segment 1000B
            buildEdi.Append(buildNFour.BuildN4(billingProvider));

            //Build Ref Provider Identifier 1000B
            buildEdi.Append(buildRef.BuildRefAdditionalPayee());
            buildEdi.Append(buildRef.BuildRefAdditionalPayeeTwo());

            //LX Segment 2000B
            var buildLx = new Lx();

            buildEdi.Append(buildLx.BuildLx());

            //TS3 2000B NOT USED
            //TS2 2000B NOT USED
            //CLP Segment 2100

            foreach (Patient patient in patientList)
            {
                var buildClp = new Clp();
                buildEdi.Append(buildClp.BuildClp(patient));

                var buildNmOne = new Nm1();
                buildEdi.Append(buildNmOne.BuildNm1(patient));


                //MIA Inpatient Adjudication Information
                //MOA Outpatient Adjudication Information
                //REF Other CLaim Related Identification


                //Ref Rendering Provider Identifier 2100
                buildEdi.Append(buildRef.BuildRef(patient.Provider));

                //DTM Statement From or To Date 2100
                buildEdi.Append(buildDtm.BuildDtm(patient));

                //PER Claim Contact Information 2100

                //SVC Level 2110
                var buildSvc = new Svc();

                buildEdi.Append(buildSvc.BuildSvc(patient.Charge));
                buildEdi.Append(buildDtm.BuildDtm(patient.Charge));

                var buildCas = new Cas();
                if (patient.Charge.AdjustmentList != null)
                {
                    buildEdi.Append(buildCas.BuildCas(patient.Charge.AdjustmentList));
                    buildEdi.Append(buildCas.BuildCas(patient.Charge));
                }
                else
                {
                    buildEdi.Append(buildCas.BuildCas(patient.Charge));
                }
                buildEdi.Append(buildRef.BuildRefControlNumber());

                var buildAmt = new Amt();
                buildEdi.Append(buildAmt.BuildAmt(patient.Charge));
                //QTY 2110
                //LQ 2110
                //LQ01 Service Line Remittance Remark Code 1
                //LQ02 Service Line Remittance Remark Code 2

                foreach (AddonCharge addon in patient.Charge.AddonChargeList)
                {
                    buildEdi.Append(buildSvc.BuildSvc(addon));
                    buildEdi.Append(buildCas.BuildCas(addon.AdjustmentList));
                    buildEdi.Append(buildRef.BuildRefControlNumber());
                    buildEdi.Append(buildAmt.BuildAmt(addon));
                }
            }

            var buildSe = new Se();

            buildEdi.Append(buildSe.BuildSe());

            var buildGe = new Ge();

            buildEdi.Append(buildGe.BuildGe());

            var buildIea = new Iea();

            buildEdi.Append(buildIea.BuildIea());

            return(buildEdi.ToString());
        }