Esempio n. 1
0
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            if (startCbox.SelectedIndex != -1)
            {
                ComboBoxItem item = (ComboBoxItem)startCbox.SelectedItem;
                ShapeInfo    si   = (ShapeInfo)item.Tag;
                startV = si;
            }
            if (endCbox.SelectedIndex != -1)
            {
                ComboBoxItem item = (ComboBoxItem)endCbox.SelectedItem;
                ShapeInfo    si   = (ShapeInfo)item.Tag;
                endV = si;
            }

            string          connectString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + dbFile + ";Persist Security Info=False;";
            OleDbConnection conn          = new OleDbConnection(connectString);

            conn.Open();
            if (isExit)
            {
                StringBuilder sqlSB = new StringBuilder("update vstream set ");
                sqlSB.Append("streamname").Append("='").Append(this.txtName.Text).Append("',");
                //sqlSB.Append("Temperature").Append("='").Append(this.txtTemp.Text).Append("',");
                //sqlSB.Append("Pressure").Append("='").Append(this.txtPres.Text).Append("',");
                //sqlSB.Append("WeightFlow").Append("='").Append(this.txtPres.Text).Append("',");
                //sqlSB.Append("Enthalpy").Append("='").Append(this.txtPres.Text).Append("',");
                //sqlSB.Append("SpEnthalpy").Append("='").Append(this.txtPres.Text).Append("',");
                //sqlSB.Append("VaporFraction").Append("='").Append(this.txtVabFrac.Text).Append("' ");

                sqlSB.Append(" where nameU='").Append(nameU).Append("'");
                OleDbCommand cmd = new OleDbCommand(sqlSB.ToString(), conn);
                cmd.ExecuteNonQuery();
            }
            else
            {
                StringBuilder sqlSB = new StringBuilder("insert into vstream(nameU,streamname,Temperature,Pressure,WeightFlow,Enthalpy,SpEnthalpyVaporFraction)values(");
                // sqlSB.Append("'").Append(nameU).Append("','").Append(this.txtName.Text).Append("','").Append(this.txtTemp.Text).Append("','").Append(this.txtPres.Text).Append("','").Append(this.txtWf.Text).Append("','").Append(this.txtH.Text).Append("','").Append(this.txtSph.Text).Append("','").Append(this.txtVabFrac.Text).Append("'");
                sqlSB.Append(")");
                OleDbCommand cmd = new OleDbCommand(sqlSB.ToString(), conn);
                cmd.ExecuteNonQuery();
            }
            conn.Close();
            this.DialogResult = true;



            this.DialogResult = true;
        }
Esempio n. 2
0
        private List <ShapeInfo> getAllConnectors(VisioDrawing v)
        {
            List <ShapeInfo> list = new List <ShapeInfo>();
            AxDrawingControl dc   = v.visioControl;

            Visio.Page currentPage = dc.Window.Application.ActivePage;
            foreach (Visio.Shape shp in currentPage.Shapes)
            {
                if (shp.NameU.Contains("Connector"))
                {
                    ShapeInfo si = new ShapeInfo();
                    si.NameU = shp.NameU;
                    si.Text  = shp.Text;
                    list.Add(si);
                }
            }
            return(list);
        }
Esempio n. 3
0
        private void bindCombox(string values, ComboBox cbx)
        {
            cbx.Items.Clear();
            string[] items = values.Split(',');
            foreach (string i in items)
            {
                if (i != string.Empty)
                {
                    ShapeInfo si = new ShapeInfo();
                    si.Text  = i;
                    si.NameU = i;
                    ComboBoxItem item = new ComboBoxItem();
                    item.Content = si.Text;
                    item.Tag     = si;
                    cbx.Items.Add(item);
                }
            }


            if (cbx.Items.Count > 0)
            {
                cbx.SelectedIndex = 0;
            }
        }