Exemplo n.º 1
0
        public void portDataOperation(string portReceivedDate)
        {
            string[] portDataArr       = portReceivedDate.Split(',');
            int      portDateArrLenght = portDataArr.Length;

            classes.PortDataDetails portDetailsObj = new classes.PortDataDetails();

            if (portDateArrLenght >= 17)
            {
                portDetailsObj.partNumber        = portDataArr[0];
                portDetailsObj.revisionNumber    = portDataArr[1];
                portDetailsObj.dateTime          = portDataArr[2] + ' ' + portDataArr[3];
                portDetailsObj.testResult        = portDataArr[4];
                portDetailsObj.testingMode       = portDataArr[5];
                portDetailsObj.passCount         = portDataArr[6];
                portDetailsObj.failCount         = portDataArr[7];
                portDetailsObj.failTypePoints    = portDataArr[8];
                portDetailsObj.cutterCount       = portDataArr[9];
                portDetailsObj.labelSerialNumber = portDataArr[10];
                portDetailsObj.printedBarCode    = portDataArr[11];
                portDetailsObj.operatorCode      = portDataArr[12];
                portDetailsObj.shift             = portDataArr[13];
                portDetailsObj.lotCount          = portDataArr[14];
                portDetailsObj.lotQuantity       = portDataArr[15];
                portDetailsObj.customField       = portDataArr[16];

                //MessageBox.Show(portDetailsObj.ToString());

                insertPortData(portDetailsObj);
            }

            //MessageBox.Show(portDateArrLenght.ToString());
        }
Exemplo n.º 2
0
        public void insertPortData(classes.PortDataDetails portDetObj)
        {
            const string insertQuerystr = "insert into Face_Connect(" +
                                          "part_number, " +
                                          "date_time, " +
                                          "test_result, " +
                                          "testing_mode, " +
                                          "pass_count, " +
                                          "fail_count, " +
                                          "fail_type_points, " +
                                          "cutter_count, " +
                                          "label_serial_number, " +
                                          "printed_barcode, " +
                                          "operator_code, " +
                                          "shift, " +
                                          "lot_count, " +
                                          "lot_quantity, " +
                                          "custom_field)" +
                                          "values(" +
                                          "@partNumber, " +
                                          "@dateTime, " +
                                          "@testResult, " +
                                          "@testingMode, " +
                                          "@passCount, " +
                                          "@failCount, " +
                                          "@failTypePoints, " +
                                          "@cutterCount, " +
                                          "@labelSerialNumber, " +
                                          "@printedBarCode, " +
                                          "@operatorCode, " +
                                          "@shift, " +
                                          "@lotCount, " +
                                          "@lotQuantity, " +
                                          "@customField)";

            cmd = new OleDbCommand(insertQuerystr, con);

            cmd.Parameters.AddWithValue("@partNumber", portDetObj.partNumber);
            cmd.Parameters.AddWithValue("@dateTime", portDetObj.dateTime);
            cmd.Parameters.AddWithValue("@testResult", portDetObj.testResult);
            cmd.Parameters.AddWithValue("@testingMode", portDetObj.testingMode);
            cmd.Parameters.AddWithValue("@passCount", portDetObj.passCount);
            cmd.Parameters.AddWithValue("@failCount", portDetObj.failCount);
            cmd.Parameters.AddWithValue("@failTypePoints", portDetObj.failTypePoints);
            cmd.Parameters.AddWithValue("@cutterCount", portDetObj.cutterCount);
            cmd.Parameters.AddWithValue("@labelSerialNumber", portDetObj.labelSerialNumber);
            cmd.Parameters.AddWithValue("@printedBarCode", portDetObj.printedBarCode);
            cmd.Parameters.AddWithValue("@operatorCode", portDetObj.operatorCode);
            cmd.Parameters.AddWithValue("@shift", portDetObj.shift);
            cmd.Parameters.AddWithValue("@lotCount", portDetObj.lotCount);
            cmd.Parameters.AddWithValue("@lotQuantity", portDetObj.lotQuantity);
            cmd.Parameters.AddWithValue("@customField", portDetObj.customField);



            try {
                con.Open();
                if (cmd.ExecuteNonQuery() > 0)
                {
                    MessageBox.Show("Data inserted successfully");
                }
                con.Close();

                //retrieveData();
            }
            catch (Exception ex) {
                con.Close();
                MessageBox.Show(ex.Message);
            }
        }