Esempio n. 1
0
        private void InsertLabelDataIntoDatabase(int BatchNumber)
        {
            var sqlConnection = new SqlConn(DbConnectionString());

            //  DataTable dt = _butcherLabelsTable;

            foreach (DataRow dr in _butcherLabelsTable.Rows)
            {
                var insert = new InsertCommand(sqlConnection.GetSqlConnection());

                insert.ProductionDate         = (DateTime)(dateEdit_ProdDate.EditValue);
                insert.ProdCode               = lookUpEdit_Product.GetColumnValue("ProdCode").ToString();
                insert.ProdDescription        = lookUpEdit_Product.Text;
                insert.Customer               = lookUpEdit_Customer.Text;
                insert.Shift                  = lookUpEdit_Shift.Text;
                insert.LabelDescription       = lookUpEdit_Product.GetColumnValue("LabelType").ToString();
                insert.RawMaterialCode        = dr["product"].ToString();
                insert.RawMaterialDescription = dr["description"].ToString();

                switch (_batchOrPallet)
                {
                case SqlQueryBatchPallet.PalletBatchField.palletid:
                    insert.PalletId = dr["PalletNumber"].ToString();
                    break;

                case SqlQueryBatchPallet.PalletBatchField.batchno:
                    insert.BatchNumber = dr["PalletNumber"].ToString();
                    break;

                default:
                    break;
                }

                insert.Udf2             = dr["udf2"].ToString();
                insert.Udf3             = dr["udf3"].ToString();
                insert.Udf4             = dr["udf4"].ToString();
                insert.KillDate         = (DateTime)(dr["killdate"]);
                insert.Lot              = dr["lot"].ToString();
                insert.LabelBatchNumber = BatchNumber;
                insert.Weight           = (decimal)(dr["Weight"]);
                insert.FactoryId        = Properties.Settings.Default.Factory;

                insert.ExecuteInsertLabel();
                dataForPrintLabel = insert;
            }
        }