Exemplo n.º 1
0
        private void openCheck(string _tableName,string _bom,string _job)
        {
            myConnection = default(SqlCeConnection);
            DataTable dt = new DataTable();
            Adapter = default(SqlCeDataAdapter);
            myConnection = new SqlCeConnection(storagePath.getDatabasePath());
            myConnection.Open();
            myCommand = myConnection.CreateCommand();
            myCommand.CommandText = "SELECT [id] FROM [" + _tableName + "] WHERE id ='" + txtBom.Text + "' ";

            myCommand.CommandType = CommandType.Text;

            Adapter = new SqlCeDataAdapter(myCommand);
            Adapter.Fill(dt);

            myConnection.Close();
            if (dt.Rows.Count > 0)
            {

                frmCheck frmCheck = new frmCheck(this.txtJob.Text.ToUpper(),this.txtBom.Text.ToUpper(),"");

               // frmCheck.BindDataGrid();
                frmCheck.setBom(dt.Rows[0]["id"].ToString());
                frmCheck.setData(_bom, _job);
                frmCheck.Show();
               // frmCheck.setBom(this.txtBom.Text);
                //frmCheck.setJob(this.txtJob.Text);
                dt = null;
                MessageBox.Show("Bom : " + dt.Rows[0]["id"].ToString());
            }
            else
            {
                MessageBox.Show("Bom : " + txtBom.Text + " does not exited");
            }
        }
Exemplo n.º 2
0
        private void goToChecking()
        {
            int num = 10;
            if (this.txtJob.Text.ToUpper().Substring(0, 1) == "J")
            {
                Thread t = new Thread(delegate()
                {
                    this.progressBar1.Value = num;

                });
                progressBar1.Visible = true;
                progressBar1.Value = 30;

                //bomdata = XElement.Load(path);
                //XElement storedata;
                //IEnumerable<XElement> storeEle = null;
                //storedata = XElement.Load(path);
                //storeEle = from sEl in storedata.Descendants("BOM")
                //           where (string)sEl.Attribute("ID") == txtBom.Text
                //           // where (string)sEl.Attribute("Job") == job
                //           select sEl;
                //if (storeEle.Count() == 0)
                //{
                //    MessageBox.Show("Bom : " + txtBom.Text + " no have in system. Please update BOM");
                //}
                //else
                //{
                if (this.checkStoredata())
                {

                    progressBar1.Value = 60;
                    frmCheck frmCheck = new frmCheck(this.txtJob.Text.ToUpper(), this.txtBom.Text.ToUpper(), username);
                    //frmCheck.setBOMID(txtBomID.Text);
                    //frmCheck.setJob(txtJob.Text);
                    frmCheck.setPath(path);
                    frmCheck.setUsername(username);
                    frmCheck.Show();
                    progressBar1.Value = 100;
                    progressBar1.Visible = false;
                }
                else
                {
                    progressBar1.Value = 100;
                    progressBar1.Visible = false;
                    MessageBox.Show("Bom  : " + bm + " no have in system", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);

                }
            }
            else
            {
                MessageBox.Show("Job  : " + this.txtJob.Text + " no have in system", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);

            }
                    //}
        }