예제 #1
0
        private void Clear()
        {
            vari.rTempCust = "";
            //clear quote list
            lbQuotes.DataContext = null;
            lbQuotes.ItemsSource = null;

            lbCust.UnselectAll();

            if (cmbDep != null)
            {
                QueryDetails();
            }

            //HIDE LABELS
            lPN.Visibility = System.Windows.Visibility.Hidden;
            lS.Visibility  = System.Windows.Visibility.Hidden;
            lC.Visibility  = System.Windows.Visibility.Hidden;
            lD.Visibility  = System.Windows.Visibility.Hidden;
            lSN.Visibility = System.Windows.Visibility.Hidden;

            //CLEAR DATABINDINGS
            databindings.Cust     A = new databindings.Cust(); { A.lCust = ""; } this.lCust.DataContext = A;
            databindings.Date     B = new databindings.Date(); { B.lDate = ""; } this.lDate.DataContext = B;
            databindings.PartNumb C = new databindings.PartNumb(); { C.lPartNumb = ""; } this.lPartNumb.DataContext = C;
            databindings.P1       D = new databindings.P1(); { D.lp1 = ""; } this.lP1.DataContext = D;
            databindings.P2       E = new databindings.P2(); { E.lp2 = ""; } this.lP2.DataContext = E;
            databindings.P3       F = new databindings.P3(); { F.lp3 = ""; } this.lP3.DataContext = F;
            databindings.P4       G = new databindings.P4(); { G.lp4 = ""; } this.lP4.DataContext = G;
            databindings.Plab1    H = new databindings.Plab1(); { H.lPlab1 = ""; } this.lPLab1.DataContext = H;
            databindings.Plab2    I = new databindings.Plab2(); { I.lPlab2 = ""; } this.lPLab2.DataContext = I;
            databindings.Plab3    J = new databindings.Plab3(); { J.lPlab3 = ""; } this.lPLab3.DataContext = J;
            databindings.Plab4    K = new databindings.Plab4(); { K.lPlab4 = ""; } this.lPLab4.DataContext = K;
            databindings.Watts    L = new databindings.Watts(); { L.lWatts = ""; } this.lWatts.DataContext = L;
            databindings.Volts    M = new databindings.Volts(); { M.lVolts = ""; } this.lVolts.DataContext = M;
            databindings.Term     N = new databindings.Term(); { N.lTerm = ""; } this.lTerm.DataContext = N;
            databindings.laWatts  O = new databindings.laWatts(); { O.labWatts = ""; } this.labWatts.DataContext = O;
            databindings.laVolts  P = new databindings.laVolts(); { P.labVolts = ""; } this.labVolts.DataContext = P;
            databindings.laTerm   Q = new databindings.laTerm(); { Q.labTerm = ""; } this.labTerm.DataContext = Q;
            databindings.Notes    R = new databindings.Notes(); { R.lNotes = ""; } this.lNotes.DataContext = R;
            databindings.rP1      S = new databindings.rP1(); { S.lPr1 = ""; } this.lPr1.DataContext = S;
            databindings.rP2      T = new databindings.rP2(); { T.lPr2 = ""; } this.lPr2.DataContext = T;
            databindings.rP3      U = new databindings.rP3(); { U.lPr3 = ""; } this.lPr3.DataContext = U;
            databindings.rP4      V = new databindings.rP4(); { V.lPr4 = ""; } this.lPr4.DataContext = V;
            databindings.Q1       W = new databindings.Q1(); { W.lQ1 = ""; } this.lQ1.DataContext = W;
            databindings.Q2       X = new databindings.Q2(); { X.lQ2 = ""; } this.lQ2.DataContext = X;
            databindings.Q3       Y = new databindings.Q3(); { Y.lQ3 = ""; } this.lQ3.DataContext = Y;
            databindings.Q4       Z = new databindings.Q4(); { Z.lQ4 = ""; } this.lQ4.DataContext = Z;
        }
예제 #2
0
        private void QueryCartQuote()
        {
            // SET THE DATABASE CONNECTION VARS
            string file             = vari.DefaultDirectory + "Quotes.accdb";
            string ConnectionString = "Provider = Microsoft.ACE.OLEDB.12.0;Data Source =" + file + ";";

            // Attempt to connect to the database
            using (var connection1 = new OleDbConnection(ConnectionString))
            {
                OleDbCommand OComm = new OleDbCommand();
                OComm.Connection = connection1;
                try
                {
                    connection1.Open();
                    // Query the database to find all entries without a FINISH TIME
                    OleDbDataAdapter DA = new OleDbDataAdapter("SELECT * FROM MicaQuotes WHERE ID = " + vari.rQuoteID + ";", connection1);
                    var DataSet         = new DataSet();
                    DA.Fill(DataSet, "*");

                    lPN.Visibility = System.Windows.Visibility.Visible;
                    lS.Visibility  = System.Windows.Visibility.Visible;
                    lC.Visibility  = System.Windows.Visibility.Visible;
                    lD.Visibility  = System.Windows.Visibility.Visible;
                    lSN.Visibility = System.Windows.Visibility.Visible;

                    vari.rQD = new string[DataSet.Tables[0].Columns.Count];
                    //vari.rQD[0] = DataSet.Tables[0].Rows[0][0].ToString();

                    for (int col = 0; col < DataSet.Tables[0].Columns.Count; col++)
                    {
                        vari.rQD[col] = DataSet.Tables[0].Rows[0][col].ToString();
                    }

                    databindings.Cust     A = new databindings.Cust(); { A.lCust = DataSet.Tables[0].Rows[0][1].ToString(); } this.lCust.DataContext = A;
                    databindings.Date     B = new databindings.Date(); { B.lDate = DataSet.Tables[0].Rows[0][2].ToString(); } this.lDate.DataContext = B;
                    databindings.PartNumb C = new databindings.PartNumb(); { C.lPartNumb = DataSet.Tables[0].Rows[0][29].ToString(); } this.lPartNumb.DataContext = C;
                    databindings.P1       D = new databindings.P1(); { D.lp1 = DataSet.Tables[0].Rows[0][11].ToString(); } this.lP1.DataContext = D;
                    databindings.P2       E = new databindings.P2(); { E.lp2 = string.Format("{0:0.00}", DataSet.Tables[0].Rows[0][13]); } this.lP2.DataContext = E;
                    databindings.P3       F = new databindings.P3(); { F.lp3 = string.Format("{0:0.00}", DataSet.Tables[0].Rows[0][14]); } this.lP3.DataContext = F;
                    databindings.P4       G = new databindings.P4(); { G.lp4 = DataSet.Tables[0].Rows[0][12].ToString(); } this.lP4.DataContext = G;
                    databindings.Plab1    H = new databindings.Plab1(); { H.lPlab1 = "seg:"; } this.lPLab1.DataContext = H;
                    databindings.Plab2    I = new databindings.Plab2(); { I.lPlab2 = "dia:"; } this.lPLab2.DataContext = I;
                    databindings.Plab3    J = new databindings.Plab3(); { J.lPlab3 = "wid:"; } this.lPLab3.DataContext = J;
                    databindings.Plab4    K = new databindings.Plab4(); { K.lPlab4 = "lockup:"; } this.lPLab4.DataContext = K;
                    databindings.Watts    L = new databindings.Watts(); { L.lWatts = string.Format("{0:00}", DataSet.Tables[0].Rows[0][15]); } this.lWatts.DataContext = L;
                    databindings.Volts    M = new databindings.Volts(); { M.lVolts = string.Format("{0:00}", DataSet.Tables[0].Rows[0][16]); } this.lVolts.DataContext = M;
                    databindings.Term     N = new databindings.Term(); { N.lTerm = DataSet.Tables[0].Rows[0][17].ToString(); } this.lTerm.DataContext = N;
                    databindings.laWatts  O = new databindings.laWatts(); { O.labWatts = "watts:"; } this.labWatts.DataContext = O;
                    databindings.laVolts  P = new databindings.laVolts(); { P.labVolts = "volts:"; } this.labVolts.DataContext = P;
                    databindings.laTerm   Q = new databindings.laTerm(); { Q.labTerm = "term style:"; } this.labTerm.DataContext = Q;
                    databindings.Notes    R = new databindings.Notes(); { R.lNotes = DataSet.Tables[0].Rows[0][25].ToString(); } this.lNotes.DataContext = R;
                    databindings.rP1      S = new databindings.rP1(); { S.lPr1 = string.Format("{0:c2}", DataSet.Tables[0].Rows[0][7]); } this.lPr1.DataContext = S;
                    databindings.rP2      T = new databindings.rP2(); { T.lPr2 = string.Format("{0:c2}", DataSet.Tables[0].Rows[0][8]); } this.lPr2.DataContext = T;
                    databindings.rP3      U = new databindings.rP3(); { U.lPr3 = string.Format("{0:c2}", DataSet.Tables[0].Rows[0][9]); } this.lPr3.DataContext = U;
                    databindings.rP4      V = new databindings.rP4(); { V.lPr4 = string.Format("{0:c2}", DataSet.Tables[0].Rows[0][10]); } this.lPr4.DataContext = V;
                    databindings.Q1       W = new databindings.Q1(); { W.lQ1 = DataSet.Tables[0].Rows[0][3].ToString(); } this.lQ1.DataContext = W;
                    databindings.Q2       X = new databindings.Q2(); { X.lQ2 = DataSet.Tables[0].Rows[0][4].ToString(); } this.lQ2.DataContext = X;
                    databindings.Q3       Y = new databindings.Q3(); { Y.lQ3 = DataSet.Tables[0].Rows[0][5].ToString(); } this.lQ3.DataContext = Y;
                    databindings.Q4       Z = new databindings.Q4(); { Z.lQ4 = DataSet.Tables[0].Rows[0][6].ToString(); } this.lQ4.DataContext = Z;

                    //MessageBox.Show(DataSet.Tables[0].Rows[0][1].ToString() + " | " + DataSet.Tables[0].Rows[0][29].ToString());
                }
                catch (Exception ex)
                { MessageBox.Show(ex.Message); }
                finally
                { connection1.Close(); }
            }
        }