Example #1
0
        public ConnectAPI(Privacies privacy)
        {
            int index = 0;

            this.privacy = privacy;
            InitializeComponent();

            foreach (Control control in Controls)
            {
                FindControlRecursive(control);
            }

            if (string.IsNullOrEmpty(privacy.SecurityAPI) == false)
            {
                securites                             = new Secrecy().Decipher(privacy.Security, privacy.SecurityAPI);
                textCertificate.Text                  = securites[index++];
                textPassword.Text                     = securites[++index];
                textIdentity.Text                     = securites[++index];
                checkPrivacy.CheckState               = CheckState.Checked;
                textPassword.UseSystemPasswordChar    = true;
                textCertificate.UseSystemPasswordChar = true;
            }
            var now = DateTime.Now;

            Codes      = new HashSet <Codes>();
            Strategics = new HashSet <IStrategics>();
            querys     = (now.Hour == 0xF && now.Minute < 0x2D || now.Hour < 0xF) && now.Hour > 4 ? new IQuerys <SendSecuritiesAPI>[] { new CFOBQ10500(), new T0441() } : new IQuerys <SendSecuritiesAPI>[] { new CCEBQ10500(), new CCEAQ50600() };
            Stocks     = new T8411();
            Options    = new T8414();
            JIF        = new JIF();
        }
Example #2
0
        public ConnectAPI(Privacies privacy)
        {
            int index = 0;

            this.privacy = privacy;
            InitializeComponent();

            foreach (Control control in Controls)
            {
                FindControlRecursive(control);
            }

            if (string.IsNullOrEmpty(privacy.SecurityAPI) == false)
            {
                securites                             = new Secrecy().Decipher(privacy.Security, privacy.SecurityAPI);
                textCertificate.Text                  = securites[index++];
                textPassword.Text                     = securites[++index];
                textIdentity.Text                     = securites[++index];
                checkPrivacy.CheckState               = CheckState.Checked;
                textPassword.UseSystemPasswordChar    = true;
                textCertificate.UseSystemPasswordChar = true;
            }
            Codes      = new HashSet <Codes>();
            Strategics = new HashSet <IStrategics>();
            Stocks     = new T8411();
            Options    = new T8414();
            JIF        = new JIF();
        }
Example #3
0
        private void BtnCalculate_Click(object sender, EventArgs e)
        {
            i = 0;

            #region InputFromTbx

            CbxSelectIndexValue();
            try
            {
                holeDepth  = 0; casingId = 0; casingShoe = 0; mudWeight = 0; flowRate = 0; PV = 0; YP = 0; dcLength = 0; dcId = 0; dcOd = 0;
                hwdpLength = 0; hwdpId = 0; hwdpOd = 0; surfacePressureLoss = 0; mudMoter = 0; dpLength = 0; dpOd = 0; dpId = 0;

                if (!string.IsNullOrEmpty(tbxHole.Text))
                {
                    holeDepth = Convert.ToDouble(tbxHole.Text);
                }
                if (!string.IsNullOrEmpty(tbxCasingID.Text))
                {
                    casingId = Convert.ToDouble(tbxCasingID.Text);
                }
                if (!string.IsNullOrEmpty(tbxCasingShoe.Text))
                {
                    casingShoe = Convert.ToDouble(tbxCasingShoe.Text);
                }
                if (!string.IsNullOrEmpty(tbxMudWeight.Text))
                {
                    mudWeight = Convert.ToDouble(tbxMudWeight.Text);
                }
                if (!string.IsNullOrEmpty(tbxFlowRate.Text))
                {
                    flowRate = Convert.ToDouble(tbxFlowRate.Text);
                }
                if (!string.IsNullOrEmpty(tbxPV.Text))
                {
                    PV = Convert.ToDouble(tbxPV.Text);
                }
                if (!string.IsNullOrEmpty(tbxYP.Text))
                {
                    YP = Convert.ToDouble(tbxYP.Text);
                }
                if (!string.IsNullOrEmpty(tbxDcLength.Text))
                {
                    dcLength = Convert.ToDouble(tbxDcLength.Text);
                }
                if (!string.IsNullOrEmpty(tbxDcId.Text))
                {
                    dcId = Convert.ToDouble(tbxDcId.Text);
                }
                if (!string.IsNullOrEmpty(tbxDcOd.Text))
                {
                    dcOd = Convert.ToDouble(tbxDcOd.Text);
                }
                if (!string.IsNullOrEmpty(tbxHwdpLength.Text))
                {
                    hwdpLength = Convert.ToDouble(tbxHwdpLength.Text);
                }
                if (!string.IsNullOrEmpty(tbxHwdpId.Text))
                {
                    hwdpId = Convert.ToDouble(tbxHwdpId.Text);
                }
                if (!string.IsNullOrEmpty(tbxHwdpOd.Text))
                {
                    hwdpOd = Convert.ToDouble(tbxHwdpOd.Text);
                }
                if (!string.IsNullOrEmpty(tbxDpId.Text))
                {
                    dpId = Convert.ToDouble(tbxDpId.Text);
                }
                if (!string.IsNullOrEmpty(tbxDpOd.Text))
                {
                    dpOd = Convert.ToDouble(tbxDpOd.Text);
                }
                if (!string.IsNullOrEmpty(tbxDpLength.Text))
                {
                    dpLength = Convert.ToDouble(tbxDpLength.Text);
                }
                if (!string.IsNullOrEmpty(tbxMudMoter.Text))
                {
                    mudMoter = Convert.ToDouble(tbxMudMoter.Text);
                }
                if (!string.IsNullOrEmpty(tbxSurfacePressure.Text))
                {
                    surfacePressureLoss = Convert.ToDouble(tbxSurfacePressure.Text);
                }
            }
            catch
            {
            }

            #endregion

            TryCatchNozzle();

            Calculate calculate = new Calculate();

            tbxResultSurfacePressure.Text      = surfacePressureLoss.ToString();
            tbxResultSurfacePressure.ForeColor = Color.Blue;

            tfaResult = Math.Round(calculate.CalculateResult(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12), 3);
            lblResultTotalFlow.Text      = tfaResult.ToString();
            lblResultTotalFlow.ForeColor = Color.Blue;

            bitPressureLossResult          = Math.Round(calculate.CalculateBitPressure(mudWeight, flowRate, tfaResult));
            tbxResultBitPressure.Text      = bitPressureLossResult.ToString();
            tbxResultBitPressure.ForeColor = Color.Blue;

            HHP = Math.Round(calculate.CalculateHHP(bitPressureLossResult, flowRate));
            tbxResultHHP.Text      = HHP.ToString();
            tbxResultHHP.ForeColor = Color.Blue;

            HSI = Math.Round(calculate.CalculateHSI(HHP, cbxValue), 2);
            tbxResultHSI.Text      = HSI.ToString();
            tbxResultHSI.ForeColor = Color.Blue;

            JIF = Math.Round(calculate.JIF(flowRate, mudWeight, bitPressureLossResult));
            tbxResultJIF.Text      = JIF.ToString();
            tbxResultJIF.ForeColor = Color.Blue;

            JIFin2 = Math.Round(calculate.JIFin2(JIF, cbxValue), 2);
            tbxResultJIFin2.Text      = JIFin2.ToString();
            tbxResultJIFin2.ForeColor = Color.Blue;

            nozzleVelocity            = Math.Round(calculate.NoozleResult(flowRate, tfaResult));
            tbxResultNoozle.Text      = nozzleVelocity.ToString();
            tbxResultNoozle.ForeColor = Color.Blue;

            drillStringLoss                = Math.Round(calculate.DrillStringLosses(mudWeight, flowRate, PV, hwdpLength, hwdpId, dcLength, dcId, dpLength, dpId));
            tbxResultDrillString.Text      = drillStringLoss.ToString();
            tbxResultDrillString.ForeColor = Color.Blue;

            annularPressure            = Math.Round(calculate.AnnularPressure(hwdpLength, mudWeight, flowRate, cbxValue, hwdpOd, PV, YP, dpLength, dpOd, dcLength, dcOd));
            tbxResultAnnular.Text      = annularPressure.ToString();
            tbxResultAnnular.ForeColor = Color.Blue;

            ECD = Math.Round(calculate.ECD(annularPressure, holeDepth, mudWeight), 2);
            tbxResultECD.Text      = ECD.ToString();
            tbxResultECD.ForeColor = Color.Blue;

            SPP = calculate.SPP(surfacePressureLoss, drillStringLoss, bitPressureLossResult, annularPressure, mudMoter);
            tbxResultSPP.Text      = Math.Round(SPP).ToString();
            tbxResultSPP.ForeColor = Color.Blue;

            btnPDF.Enabled = true;
        }