Exemplo n.º 1
0
        /// <summary>
        /// Save Conendser data
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            decimal water      = decimal.Parse(txtWater.Text.Trim());
            decimal air        = decimal.Parse(txtAir.Text.Trim());
            decimal wetair     = decimal.Parse(txtWetAir.Text.Trim());
            decimal pumpabound = decimal.Parse(txtPumpAbound.Text.Trim());
            decimal duty       = decimal.Parse(txtDuty.Text.Trim());

            if (duty != (water + air + wetair + pumpabound))
            {
                //txtWaterFactor.Focus();
                txtWaterFactor.BorderBrush     = Brushes.Red;
                txtWaterFactor.BorderThickness = new Thickness(2, 2, 2, 2);
                return;
            }

            dr["heatername"]       = txtName.Text.Trim();
            dr["description"]      = txtDescription.Text.Trim();
            dr["heaterduty"]       = txtDuty.Text.Trim();
            dr["water"]            = txtWater.Text.Trim();
            dr["waterfactor"]      = txtWaterFactor.Text.Trim();
            dr["air"]              = txtAir.Text.Trim();
            dr["airfactor"]        = txtAirFactor.Text.Trim();
            dr["wetair"]           = txtWetAir.Text.Trim();
            dr["wetairfactor"]     = txtWetAirFactor.Text.Trim();
            dr["pumpabound"]       = txtPumpAbound.Text.Trim();
            dr["pumpaboundfactor"] = txtPumpAboundFactor.Text.Trim();
            dr["visiofile"]        = vsdFile;

            getColor(ref dr, "heatername_color", txtName);
            getColor(ref dr, "heaterduty_color", txtDuty);
            getColor(ref dr, "water_color", txtWater);
            getColor(ref dr, "waterFactor_color", txtWaterFactor);
            getColor(ref dr, "air_color", txtAir);
            getColor(ref dr, "airFactor_color", txtAirFactor);
            getColor(ref dr, "wetair_color", txtWetAir);
            getColor(ref dr, "wetairfactor_color", txtWetAirFactor);
            getColor(ref dr, "pumpabound_color", txtPumpAbound);
            getColor(ref dr, "pumpaboundFactor_color", txtPumpAboundFactor);
            dbR.saveDataByRow(dr, op);
            chkGeneralElectricalPowerFailure();
            this.DialogResult = true;
        }
Exemplo n.º 2
0
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (txtName.Text.Trim() == string.Empty)
                {
                    txtName.BorderBrush     = Brushes.Red;
                    txtName.BorderThickness = new Thickness(2, 2, 2, 2);
                    txtName.Focus();
                    return;
                }

                if (txtMaxPressure.Text.Trim() == string.Empty)
                {
                    txtMaxPressure.BorderBrush     = Brushes.Red;
                    txtMaxPressure.BorderThickness = new Thickness(2, 2, 2, 2);
                    txtMaxPressure.Focus();
                    return;
                }
                //string lastSourceName = dr["sourcename"].ToString();
                dr["sourcename"]          = txtName.Text;
                dr["description"]         = txtDescription.Text;
                dr["sourcetype"]          = cbxType.Text;
                dr["maxpossiblepressure"] = txtMaxPressure.Text;
                dr["ismaintained"]        = chkIsMaintained.IsChecked;
                dr["visiofile"]           = vsdFile;

                getColor(ref dr, "sourcename_color", txtName);
                getColor(ref dr, "sourcetype_color", cbxType);
                getColor(ref dr, "maxpossiblepressure_color", txtMaxPressure);
                getColor(ref dr, "ismaintained_color", chkIsMaintained);
                dbR.saveDataByRow(dr, op);
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Action");
            }
            this.DialogResult = true;
        }
Exemplo n.º 3
0
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            decimal water      = decimal.Parse(txtSteam.Text.Trim());
            decimal air        = decimal.Parse(txtHotOil.Text.Trim());
            decimal wetair     = decimal.Parse(txtHotStream.Text.Trim());
            decimal pumpabound = decimal.Parse(txtFurnace.Text.Trim());
            decimal duty       = decimal.Parse(txtDuty.Text.Trim());

            if (duty != (water + air + wetair + pumpabound))
            {
                //txtSteamFactor.Focus();
                txtSteamFactor.BorderBrush     = Brushes.Red;
                txtSteamFactor.BorderThickness = new Thickness(2, 2, 2, 2);
                return;
            }


            dr["heatername"]      = txtName.Text.Trim();
            dr["description"]     = txtDescription.Text.Trim();
            dr["heaterduty"]      = txtDuty.Text.Trim();
            dr["Steam"]           = txtSteam.Text.Trim();
            dr["SteamFactor"]     = txtSteamFactor.Text.Trim();
            dr["HotOil"]          = txtHotOil.Text.Trim();
            dr["HotOilFactor"]    = txtHotOilFactor.Text.Trim();
            dr["HotStream"]       = txtHotStream.Text.Trim();
            dr["HotStreamfactor"] = txtHotStreamFactor.Text.Trim();
            dr["Furnace"]         = txtFurnace.Text.Trim();
            dr["FurnaceFactor"]   = txtFurnaceFactor.Text.Trim();
            dr["iscontinued"]     = chkIsContinued.IsChecked;
            dr["visiofile"]       = vsdFile;

            getColor(ref dr, "heatername_color", txtName);
            getColor(ref dr, "heaterduty_color", txtDuty);
            getColor(ref dr, "Steam_color", txtSteam);
            getColor(ref dr, "SteamFactor_color", txtSteamFactor);
            getColor(ref dr, "HotOil_color", txtHotOil);
            getColor(ref dr, "HotOilFactor_color", txtHotOilFactor);
            getColor(ref dr, "HotStream_color", txtHotStream);
            getColor(ref dr, "HotStreamfactor_color", txtHotStreamFactor);
            getColor(ref dr, "Furnace_color", txtFurnace);
            getColor(ref dr, "FurnaceFactor_color", txtFurnaceFactor);
            getColor(ref dr, "iscontinued_color", chkIsContinued);

            DBRelief dbR = new DBRelief(dbFile);

            dbR.saveDataByRow(dr, op);
            this.DialogResult = true;
        }
Exemplo n.º 4
0
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            dr["sinkname"]            = txtName.Text;
            dr["visiofile"]           = vsdFile;
            dr["description"]         = txtDescription.Text;
            dr["sinktype"]            = cbxType.Text;
            dr["maxpossiblepressure"] = txtMaxPressure.Text;
            dr["ismaintained"]        = chkIsMaintained.IsChecked;
            getColor(ref dr, "sinkname_color", txtName);
            getColor(ref dr, "sinktype_color", cbxType);
            getColor(ref dr, "maxpossiblepressure_color", txtMaxPressure);
            getColor(ref dr, "ismaintained_color", chkIsMaintained);
            DBRelief dbR = new DBRelief(dbFile);

            dbR.saveDataByRow(dr, op);
            this.DialogResult = true;
        }
Exemplo n.º 5
0
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                dr["equipment_no"]       = this.txtEquipmentNO.Text.Trim();
                dr["equipment_service"]  = txtService.Text.Trim();
                dr["equipment_location"] = txtLocation.Text.Trim();
                dr["stream"]             = cbxStream.Text.Trim();

                dr["vessel_type"] = cbxVesselType.Text.Trim();
                dr["number_of_identical_vessels"] = txtNumberOfIdentcalVessels.Text.Trim();
                dr["diameter_identical_vessels"]  = txtIVDiameter.Text.Trim();
                dr["vessel_factor"]             = txtIVFactor.Text.Trim();
                dr["vessel_length"]             = txtIVLength.Text.Trim();
                dr["number_of_wetted_heads"]    = txtNumberOfWettedHeads.Text.Trim();
                dr["normal_liquid_level"]       = txtNormalLiquidLevel.Text.Trim();
                dr["fire_exposed_liquid_level"] = txtFireExposedLiquidLevel.Text.Trim();
                dr["elevation_to_bottom"]       = txtElevationtoBottom.Text.Trim();
                dr["diameter_wetted_heads"]     = txtWettedDiameter.Text.Trim();
                dr["tt"] = txtTT.Text.Trim();

                dr["heat_input"]      = txtHeatInput.Text.Trim();
                dr["c1"]              = txtC1.Text.Trim();
                dr["c2"]              = txtC2.Text.Trim();
                dr["c3"]              = txtC3.Text.Trim();
                dr["c4"]              = txtC4.Text.Trim();
                dr["c5"]              = txtC5.Text.Trim();
                dr["piping_inlet"]    = txtInlet.Text.Trim();
                dr["inlet_length"]    = txtInletLength.Text.Trim();
                dr["piping_outlet"]   = this.txtOutLet.Text.Trim();
                dr["outlet_length"]   = this.txtOutLength.Text.Trim();
                dr["piping_diameter"] = this.txtPipingDiameter.Text.Trim();
                dr["wetted_area"]     = this.txtWettedArea.Text.Trim();
                dr["visiofile"]       = vsdFile;
                DBRelief dbR = new DBRelief(dbFile);
                dbR.saveDataByRow(dr, op);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Action");
            }
            this.DialogResult = true;
        }
Exemplo n.º 6
0
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string name       = this.txtName.Text;
                string temp       = this.txtTemp.Text;
                string press      = this.txtPres.Text;
                string wf         = this.txtWf.Text;
                string enthalpy   = this.txtH.Text;
                string spenthalpy = this.txtSph.Text;
                string vf         = this.txtVabFrac.Text;

                dr["streamname"]    = name;
                dr["Temperature"]   = temp;
                dr["Pressure"]      = press;
                dr["Enthalpy"]      = enthalpy;
                dr["SpEnthalpy"]    = spenthalpy;
                dr["VaporFraction"] = vf;
                dr["WeightFlow"]    = wf;
                dr["Description"]   = txtDescription.Text;
                dr["visiofile"]     = vsdFile;

                getColor(ref dr, "streamname_color", txtName);
                getColor(ref dr, "Temperature_color", txtTemp);
                getColor(ref dr, "Pressure_color", txtPres);
                getColor(ref dr, "VaporFraction_color", txtVabFrac);
                getColor(ref dr, "WeightFlow_color", txtWf);
                getColor(ref dr, "Enthalpy_color", txtH);
                getColor(ref dr, "SpEnthalpy_color", txtSph);

                DBRelief dbr = new DBRelief(dbFile); //带参数,谨记
                dbr.saveDataByRow(dr, op);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Action");
            }
            this.DialogResult = true;
        }
Exemplo n.º 7
0
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            dr["accumulatorname"] = txtName.Text.Trim();
            if (voH.IsChecked == true)
            {
                dr["orientation"] = voH.Content.ToString();
            }
            else
            {
                dr["orientation"] = voV.Content.ToString();
            }

            dr["diameter"]      = this.txtDiameter.Text.Trim();
            dr["length"]        = this.txtLength.Text.Trim();
            dr["numberofheads"] = this.txtNumberofHeads.Text.Trim();
            dr["headratio"]     = this.txtHeadRatio.Text.Trim();

            dr["visiofile"] = vsdFile;
            DBRelief dbR = new DBRelief(dbFile);

            dbR.saveDataByRow(dr, op);
            AccumulationName  = txtName.Text.Trim();
            this.DialogResult = true;
        }
Exemplo n.º 8
0
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            DBRelief dbR = new DBRelief(dbFile);
            DataRow  dr  = dtTower.NewRow();

            if (op == 0)
            {
                Application.Current.Properties.Add("FeedData", dtFeed);
                Application.Current.Properties.Add("Condenser", dtCondenser);
                Application.Current.Properties.Add("HxCondenser", dtHxCondenser);
                Application.Current.Properties.Add("Reboiler", dtReboiler);
                Application.Current.Properties.Add("HxReboiler", dtHxReboiler);
                Application.Current.Properties.Add("ProdData", dtProd);


                dtTower.Rows.Add(dr);
                dr["towername"]   = txtName.Text;
                dr["stagenumber"] = this.txtStageNumber.Text;
                dr["description"] = this.txtDescription.Text;
                dr["visiofile"]   = vsdFile;

                if (!string.IsNullOrEmpty(przFile))
                {
                    dr["przfile"] = przFile;
                }
                DataTable dtCondenserTemp = dtCondenser.Clone();
                dtCondenserTemp.Merge(dtCondenser);
                dtCondenserTemp.Merge(dtHxCondenser);
                DataTable dtReboilerTemp = dtReboiler.Clone();
                dtReboilerTemp.Merge(dtReboiler);
                dtReboilerTemp.Merge(dtHxReboiler);


                dbR.saveDataByTable(dtFeed, vsdFile);
                dbR.saveDataByTable(dtProd, vsdFile);
                dbR.saveDataByTable(dtSource, vsdFile);
                dbR.saveDataByTable(dtSink, vsdFile);
                dbR.saveDataByTable(dtCondenserTemp, vsdFile);
                dbR.saveDataByTable(dtReboilerTemp, vsdFile);
                dbR.saveDataByTable(dtTower, vsdFile);
            }
            else
            {
                dr = dtTower.Rows[0];
                dr["towername"]   = txtName.Text;
                dr["stagenumber"] = this.txtStageNumber.Text;
                dr["description"] = this.txtDescription.Text;
                dr["visiofile"]   = vsdFile;

                if (!string.IsNullOrEmpty(przFile))
                {
                    dr["przfile"] = przFile;
                }
                if (txtName.BorderBrush == Brushes.Green)
                {
                    dr["towername_color"] = "green";
                }
                else
                {
                    dr["towername_color"] = "blue";
                }
                if (txtStageNumber.BorderBrush == Brushes.Green)
                {
                    dr["stagenumber_color"] = "green";
                }
                else
                {
                    dr["stagenumber_color"] = "blue";
                }
                dbR.saveDataByRow(dr, 1);
            }
            this.DialogResult = true;
        }